[Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream

Krishna krish.rao.v at gmail.com
Tue Sep 2 15:54:10 CEST 2014


On Fri, Aug 29, 2014 at 8:19 AM, wm4 <nfxjfg at googlemail.com> wrote:

> 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.
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>

[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
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!

-- 
Regards,
Krishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140902/9447a3ec/attachment.html>


More information about the Libav-user mailing list