[Ffmpeg-devel] libavcode won't release final frame of MPEG or H.264

Bob Forsman thoth
Fri Nov 11 18:25:29 CET 2005

I'm feeding self-contained blocks of MPEG2 and H.264 -encoded video into
libavcodec, but I always get back one less frame than I expect.

apiexample.c claims to have extra code which solves this problem, but it
malfunctions the same as my code does (not surprising since my code is
based on apiexample.c).

(download http://www.purplefrog.com/~thoth/x/nal-confuses-libavcodec)

libavcodec/apiexample /tmp/nal-confuses-libavcodec

It only creates /tmp/test0.pgm .. test14.pgm .  test15.pgm is missing.

If I duplicate the byte sequence of the last frame, I can get the
renderer to spit out the first copy, but that's a disgusting kludge.

I will admit I am not a wizard at H.264, so I may have reconstructed the
NAL stream a little screwy, but if that is the case I'm hoping one of
you can help me straighten it out.

  How can I get libavcodec to give me the final frame of the MPEG or
H.264 stream?

More information about the ffmpeg-devel mailing list