<div dir="rtl"><div style="direction: ltr;">It's a bit complicated to post the code.</div><div style="direction: ltr;">However, I did try to init the parameters on the encoder side, it didn't seem to do tny good.</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 17:23, כרמל מגן <span dir="ltr"><<a href="mailto:carmel.work@gmail.com" target="_blank">carmel.work@gmail.com</a>></span> wrote:<br>

<blockquote style="border-left:#ccc 1px solid;margin:0px 0.8ex;padding-left:1ex;padding-right:1ex;border-right:#ccc 1px solid" class="gmail_quote">
<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></blockquote>
<div> </div>
</div><div>av_read_frame takes an AVFormatContext* as the first parameter. How did you create this object on the receiver side? Can you post the relevant code snippet?</div>
<div> </div>
<div>And I still suspect that your sender used msx_b_frames == 2 when it initialized the AVCodecContext* encoderContext for avcodec_open().</div>
<div> </div>
<div>Cheers,</div>
<div>Alex</div></div></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>