[x264-devel] question regading encoded keyframe size at 720p

Henrik Gramner henrik at gramner.com
Fri Oct 16 17:03:47 CEST 2015


On Fri, Oct 16, 2015 at 2:44 PM, Carl Petersen <cpetersen at broadsoft.com> wrote:
> I certainly get totally different results with the only change being
> setting f_rf_constant_max vs not touching that setting. If I set
> f_rf_constant_max to 35 ; my crf is 24; I see the occasional downgrade in
> quality but no artifacts or glitches or anything. However not setting
> f_rf_constant_max, I get frequent grey bars across the bottom of the
> screen at the keyframe instants.

There is no guarantee that you'll abide by the VBV constraints when
using f_rf_constant_max since those options contradict each other (and
the latter takes precedence). You're telling the encoder to maintain a
minimum "quality level" while simultaneously enforcing a bitrate limit
which is obviously impossible in some cases. You don't even get any
warning when this happens (only a debug-level message) since using
both those options at the same time implies that you're OK with this.

What most likely happened in the scenario you mentioned is that you
violate the VBV constraints when using f_rf_constant_max, and when not
using it the encoder bails out and enters "VBV emergency mode" near
the end of the frame due to not having enough bits available and just
resorts to decimating all the remaining macroblocks in order to
enforce the VBV limits.

Periodic intra refresh solves this by spreading the cost of intra
blocks over several frames which results in a more consistent level of
quality. Seriously, you should use it.


More information about the x264-devel mailing list