[FFmpeg-devel] x264 encoder run-time re-configuration in ffmpeg

Nitish Prabhu nitishsprabhu at gmail.com
Tue Jan 16 07:15:02 EET 2018


I wanted to understand some aspects of run-time encoder re-configuration
happening in "X264_frame/reconfig_encoder" functions of the libx264.c
plugin file in FFmpeg.

It seems that if the rate control mode is set to CQP, then at run-time,
"x264_encoder_reconfig" API is called, which internally re-configures some
parameters like aq-mode, aq-strength, pb-ratio, etc.

For example, if you have the following ffmpeg command line:
$ ffmpeg -i input.mp4 -c:v libx264 -x264opts -preset medium "qp=26" -f h264
then, the x264 plugin detects that the rate control mode is CQP and then
calls the "x264_encoder_reconfig" API. This resets parameters like aq-mode,
aq-strength, etc.

Based on my understanding of how the x264 binary works, the parameters from
the preset definition should be set first, then only the value of "qp"
should be updated. But this does not seem to happen. The values of aq-mode
and aq-strength are re-set based on the rate control mode (and not retained
from the preset definitions).

This doesn't reflect how x264 command line with similar options, as
mentioned below, behaves.
$ x264 input.yuv -o test.264 --input-res 1920x1080 --preset medium --qp 26

Is this difference in behavior expected?



More information about the ffmpeg-devel mailing list