[FFmpeg-devel] delayed H.264 B frames not being flushed by the decoder

declan harrison harrison.declan at gmail.com
Thu Jul 3 08:32:43 CEST 2014


On Thu, Jul 3, 2014 at 2:44 AM, Michael Niedermayer <michaelni at gmx.at>
wrote:

> On Wed, Jul 02, 2014 at 11:28:12PM +0100, declan harrison wrote:
> > Hi
> >
> > I have a problem which is causing some issues for me. Im using the
> ffmpeg,
> > libav API within my application.
> >
> >  I have an input MP4 file with an H264 video stream and an AAC audio
> > stream.  The input video stream is encoded at High profile.
> >
> > I transcode these two streams at a lower bitrate and then output to an
> MP4
> > container.   I also output the H.264 profile to baseline (no B frames).
> >
> > The  the last 2 frame I send to the decoder are P then B frame. After
> input
> > is EOF I call the decoder with NULL packet to flush out the remaining
> > frames.  This causes the P frame (2nd last frame) to be returned and
> marked
> > as complete which I can then encode and mux out, The decoder then returns
> > the last frame (B) to be returned.  However when I encode this one its
> > marked as incomplete and cant be muxed out.
> >
> > At this point I then attempt to flush out all delayed frames in the
> encoder
> > by calling encode with a null picture type to flush the frames out.
> >  However the last frame is marked as incompelte and cannot be written.
> >
> > There are 177 samples in the video track.
> >
> > Note: Put file through H264 Visa, it indicates that the last B frame
> which
> > is sample number 177 is decoded as frame 176 and the sample number 176 (P
> > frame 2 nd last sample) is decoded as frame 177.
> >
> > Is there anything I need to do to get this frame to be output
>
> can this be reproduced with ffmpeg (the command line tool i mean)
> ?
>
>
>
> No, when i create a command line variant the video stream has the same
number of frames as the input stream 177 frames.

Ive uploaded a zip file of the orginal video and a command line variant of
the same (vine.cli.mp4) to Google drive.  You can download it here
https://drive.google.com/file/d/0B7Onnb400TJfZk9uSUJHSXdzd2M/edit?usp=sharing


More information about the ffmpeg-devel mailing list