[Ffmpeg-devel] Bug in libavcodec/x264.c?

Måns Rullgård mru
Thu Feb 2 12:41:39 CET 2006

Luca Abeni said:
> Hi all,
> in libavcodec/x264.c I see
>     x4->params.rc.i_qp_min = avctx->qmin;
>     x4->params.rc.i_qp_max = avctx->qmax;
>     x4->params.rc.i_qp_step = avctx->max_qdiff;
> But... qmin & qmax defaults are 2 & 31, whereas i_qp_min & i_qp_max
> defaults are 10 & 51... So, I suppose i_qp_min/i_qp_max use a different
> scale respect to qmin/qmax?

The H.264 quantizer is in the range 1..51.  Using a value of 10 or less
the results are usually visually indistinguishable from the original.
Values higher than 30 start giving a blocky look.

> The result of this is that using default parameters h264 rate control
> does not work very well in ffmpeg (if I encode mpeg4 video, it always
> matches the target bitrate, but if I try encoding h264 I often get a lot
> of VBV underflows and the final bitrate is wrong).
> So, how can I correctly convert qmin/qmax values in i_qp_min/i_qp_max
> values?

For the rate control to work properly you should not restrict the quantizer
range.  On the other hand, you really don't want to use values higher than
31 anyway, so if the rate control fails with that limit you should use a
higher bitrate.

M?ns Rullg?rd
mru at inprovide.com

More information about the ffmpeg-devel mailing list