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

Michael Niedermayer michaelni at gmx.at
Thu Jul 3 03:44:02 CEST 2014

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)

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140703/0ab2c182/attachment.asc>

More information about the ffmpeg-devel mailing list