<div dir="rtl"><div style="direction: ltr;">I am sending and receiving h.264 video on mpeg2-ts over udp.</div><div style="direction: ltr;">After noticing some lag, I added code that prints a timestamp and framenumber after sending and after av_read_frame returns. when comparing timestamps between frames with the same frame number, there is a ~60 ms delay (when sending 30 fps). Furthermore, if I stop at a breakpoint and delay the sending of frame number X, the timestamp of receiving frame number X-2 corresponds to the time of sending of  X (i.e., the time between receiving frame number X-3 and  frame number X-2 is longer if I delay the sending of X longer). The unavoidable conclusion is that av_read_frame <u>does not return</u> with frame X-2 until frame X starts arriving.</div>
<div style="direction: ltr;"><br></div><div style="direction: ltr;">Carmel</div><br><div class="gmail_quote"><div dir="ltr">2011/7/27 Alex Cohn <span dir="ltr"><<a href="mailto:alexcohn@netvision.net.il">alexcohn@netvision.net.il</a>></span></div>
<blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex"><div dir="ltr"><div class="gmail_quote"><div class="im">On Wed, Jul 27, 2011 at 10:27, כרמל מגן <span dir="ltr"><<a href="mailto:carmel.work@gmail.com" target="_blank">carmel.work@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex">
<div dir="rtl"><div style="direction:ltr">av_read_frame does not return until the third frame arrives. This introduces 2 frames delay <u>before</u> the decoding.</div><div></div></div></blockquote></div><div> <br>What do you mean "av_read_frame does not return"? <br>

<br>from avformat.h:<br> * This function returns what is stored in the file, and does not validate<br> * that what is there are valid frames for the decoder. It will split what is<br>...<br> * @return 0 if OK, < 0 on error or end of file<br>

<br>So, does it return negative number? Or the packet is not a video packet? Maybe, you have the first video packet spliced into three network packets? Note that the first video frame is large (it is a key frame, naturally). The subsequent packet are much much smaller, becasue they encode only delta.<br>

<br>Cheers,<br>Alex<br></div></div><br></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>