[Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream
nfxjfg at googlemail.com
Fri Aug 29 14:19:57 CEST 2014
On Thu, 28 Aug 2014 16:42:50 -0400
Krishna <krish.rao.v at gmail.com> wrote:
> 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.
You don't need a counter. Once you have no more packets, you start
feeding the decoder null packets. And once the decoder doesn't return a
new picture, even though you fed it a null packet, you know there are no
more frames in the decoder.
More information about the Libav-user