View Single Post
Old 11th May 2013, 20:18   #8  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,392
Quote:
Are you sure VBV works by messing with the CRF value?
Any given frame or macroblock or whatever scale object you're interested in, has a QP, and a ratefactor, and a bitsize. Those 3 variables are all deterministically and monotonically related to each other, and have only 1 degree of freedom between them. Therefore, regardless of which one is mentioned in the sourcecode of a given algorithm, you can always interpret the effect of that algorithm has having messed with ratefactor.

jq963152 was also entirely correct to infer the above from the existence of the option --crf-max.

As for reporting which frames increased ratefactor to comply with VBV, here you go:
Code:
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -2548,6 +2548,9 @@ static float rate_estimate_qscale( x264_t *h )
 
             //FIXME use get_diff_limited_q() ?
             q = clip_qscale( h, pict_type, q );
+
+            if( h->param.rc.i_rc_method == X264_RC_CRF && rcc->b_vbv )
+                printf( "%d %.4f\n", h->fenc->i_frame, qscale2qp( q ) - rcc->qp_novbv );
         }
 
         rcc->last_qscale_for[pict_type] =
akupenguin is offline   Reply With Quote