2013/8/5 Patrick Fischer <[email protected]> > ** > > Hello > > > > I would like to understand how i can calc the diff to the next PTS Value. > > Im processing a dvb stream. To be in sync i detect if a frame is missing > and add a dummy frame. > > For video frames a can use this formula: > > > > (1/fps) * 90000 * NUMBER_OF_THE_FRAME > > example: > > (1 / 30) * 90000 * 1 = 3600 > > > > i can't find out the formula for audio pts values. > > if i print out the diff to the last audio pts it is > > Stream #0:2[0x66](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, > stereo, s16p, 256 kb/s > > diff to last pts 2880 > > > > If i take an other video: > > Stream #0:1[0x1412](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 > Hz, stereo, s16p, 192 kb/s > > diff to last pts 2160 > > > > Can anybody give me a hint? > > > > Best Regards > > Patrick > > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user > > Hi
I've been using the following: being: AVCodecContext *cc; AVStream *st; then: (cc->frame_size / cc->sample_rate) * (st->time_base.den / st->time_base.num) * number I first multiply everything and then do the divisions for rounding reasons. Also, that 90000 you put in the first formula would be the stream (time_base.den / stream time_base.num), it may not be always 90000. I don't know if this is the right way, but this way seemed to work for me. If someone knows better please add further info or correct this Regards
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
