<div dir="ltr"><div class="gmail_extra">2013/8/5 Patrick Fischer <span dir="ltr"><<a href="mailto:pfischer@como.com" target="_blank">pfischer@como.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>
<div>
<p>Hello</p><p> </p><p>I would like to understand how i can calc the diff to the next PTS Value.</p><p>Im processing a dvb stream. To be in sync i detect if a frame is missing and add a dummy frame.</p><p>For video frames a can use this formula:</p>
<p> </p><p> (1/fps) * 90000 * NUMBER_OF_THE_FRAME</p><p>example:</p><p>(1 / 30) * 90000 * 1 = 3600</p><p> </p><p>i can't find out the formula for audio pts values.</p><p>if i print out the diff to the last audio pts it is </p>
<p> Stream #0:2[0x66](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s</p><p>diff to last pts 2880</p><p> </p><p>If i take an other video:</p><p> Stream #0:1[0x1412](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s<br>
<br>diff to last pts 2160</p><p> </p><p>Can anybody give me a hint?</p><p> </p><p>Best Regards</p><span class="HOEnZb"><font color="#888888"><p>Patrick</p>
</font></span></div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">Hi</div><div class="gmail_extra"><br></div><div class="gmail_extra">I've been using the following:</div><div class="gmail_extra"><br></div><div class="gmail_extra">
being:</div><div class="gmail_extra">AVCodecContext *cc;</div><div class="gmail_extra">AVStream *st;</div><div class="gmail_extra"><br></div><div class="gmail_extra">then:</div><div class="gmail_extra">(cc->frame_size / cc->sample_rate) * (st->time_base.den / st->time_base.num) * number</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I first multiply everything and then do the divisions for rounding reasons.</div><div class="gmail_extra"><br></div><div class="gmail_extra">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.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">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</div><div class="gmail_extra">
<br></div><div class="gmail_extra">Regards</div></div>