<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Aug 29, 2014 at 8:19 AM, wm4 <span dir="ltr"><<a href="mailto:nfxjfg@googlemail.com" target="_blank">nfxjfg@googlemail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On Thu, 28 Aug 2014 16:42:50 -0400<br>
Krishna <<a href="mailto:krish.rao.v@gmail.com">krish.rao.v@gmail.com</a>> wrote:<br>
<br>
> Thanks Markus and wm4. I gave your suggestion a shot and this is what I<br>
> did. In my situation, I call the decoder() and expect a frame. However, the<br>
> decoder will buffer several packets right in the beginning. Since I need a<br>
> single frame per call, I now keep track of the number of times it read<br>
> packets without decoding (in the beginning). I call this "numInitPackets".<br>
><br>
> In the end I flush out that many packets using a null packet. And it<br>
> worked! Thank you so much for your help!<br>
> ah thank you. didnt know that one. but makes sense yes.<br>
<br>
</div>You don't need a counter. Once you have no more packets, you start<br>
feeding the decoder null packets. And once the decoder doesn't return a<br>
new picture, even though you fed it a null packet, you know there are no<br>
more frames in the decoder.<br>
<div class=""><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br>[sorry for the late reply] You are spot-on wm4! I got back to work today and tried what you suggested. I examined the value of "gotFrame" in <span style="font-size:13px;font-family:arial,sans-serif">avcodec_decode_video2() and when it is longer "1", it means that the frames have been fully flushed. This works! Thanks everyone for your help on this! </span><br clear="all">

<div><br></div>-- <br>Regards, <br>Krishna <br>
</div></div>