[Ffmpeg-devel] Decoding a single MPEG2 GOP, missing 2 frames?

Mean fixounet
Fri May 27 15:34:10 CEST 2005

Robert Ficklin wrote:

>I'm trying to decode the frames from a single GOP from an MPEG2 stream.
>My intent is to be able to randomly seek to any GOP in a file (I have
>an index of all I-frames in the file), and decode the entire GOP, one
>frame at a time. The GOP size is 15, but what I see is the first 3
>frames swallowed by avcodec_decode_frame without producing an output
>image, the next 12 frames produce good images, and the
>avcodec_decode_frame function gives me one more image when I pass it
>NULL for the last input packet.  Total usuable frames = 13.  The next
>random GOP I try to decode gives me an error about zombie frame being
>dropped and produces
>only 13 frames also.
>I use av_seek_frame(..AVSEEK_FLAG_BYTE) to position the input file to
>the desired GOP.  Then av_read_frame to get each frame in the GOP, and
>finally avcodec_decode_frame to get each frame image. I'm also using
>the CVS snapshot from May 26.
My HO,
The 2 first B frames belong logically to the previous gop and are discarded
and the last 2 bframes are in next gop

More information about the ffmpeg-devel mailing list