[FFmpeg-user] How to get encoded AVPackets in display order?

Mike Scheutzow mike.scheutzow at alcatel-lucent.com
Mon Jun 11 15:17:45 CEST 2012

Unga wrote:
> Hi all
> The documentation for the avcodec_encode_video2() says:
> "The output packet does not necessarily contain data for the most recent 
> frame, as encoders can delay and reorder input frames internally as 
> needed."
> I'm interested getting output AVPackets in display order, that is, same input order as input AVFrames.
> What are my options for achieving that?

The answer is codec specific.

If you are using one of the mpeg-style encoders, set 'number of B 
frames' to 0 i.e. -bf 0

Mike Scheutzow

More information about the ffmpeg-user mailing list