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

wm4 nfxjfg at googlemail.com
Wed Aug 27 23:37:15 CEST 2014

On Wed, 27 Aug 2014 19:14:36 +0200
Markus Pfundstein <markuspfundstein86 at gmail.com> 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.

More information about the Libav-user mailing list