[FFmpeg-devel] WIP/RFC: Try to avoid decoding a frame to get the codec parameters

Matthieu Bouron matthieu.bouron at gmail.com
Sat Oct 17 22:34:21 CEST 2015


Hello,

As of now, avformat_find_info_stream decodes a frame in order to get the
codec parameters (width, height, pix_fmt (mandatory) and more depending on
the codec) which leads to having images decoded twice.

The following patchset addresses this issue:

  * by using the AVCodecContext skip_frame field and setting its value to
  AVDISCARD_ALL in the try_decode_frame function in lavformat/utils.c

  * by having the decoders interpretting this field a bit more differently:
  While they are honoring the skip_frame option, they *must* still extract and
  set the relevant codec parameters to the AVCodecContext.

Regarding the last patch which set the avctx->skip_frame to AVDISCARD_ALL, i've
choosen to whitelist the codecs that support this behaviour.
A blacklist system (that would reflect a todolist) can also be used but it's a
bit more risky as we can't miss any codec ids to not break the current probing
behaviour.

Matthieu



More information about the ffmpeg-devel mailing list