Thanks Markus and wm4. I gave your suggestion a shot and this is what I did. In my situation, I call the decoder() and expect a frame. However, the decoder will buffer several packets right in the beginning. Since I need a single frame per call, I now keep track of the number of times it read packets without decoding (in the beginning). I call this "numInitPackets".
In the end I flush out that many packets using a null packet. And it worked! Thank you so much for your help! ah thank you. didnt know that one. but makes sense yes. > On 27 aug. 2014, at 23:37, wm4 <[email protected]> wrote: > > On Wed, 27 Aug 2014 19:14:36 +0200 > Markus Pfundstein <[email protected]> wrote: > >> a frame can consist of several packets. thats why you need to call av_decode_video2 multiple times until it has a fully decoded frame for you. the return values tell you how much data was read. >> you should adjust packet.data and packet.size by those values. >> >> there a a lot of examples out there that show this. > > In libavcodec/libavformat, a packet consists of exactly one frame (and > libavformat goes out of its way to guarantee this). But decoding can > incur a delay of several frames. That means, at start of decoding you > have to feed the decoder several packets without getting a video frame > back, and at end of decoding you need to feed it null packets to get > the remaining frames. > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
