X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=x264_encoder.cpp;h=8be53ceea635b8b832466d531007c65dfd69a093;hb=8cefe0ef1926be7931d4a9bbfed93ee6e85f3540;hp=0c1ecbc1fbd63c6649d6560da8c846b634695100;hpb=7297850cec443cb0c02f82d7301a30583744627d;p=nageru diff --git a/x264_encoder.cpp b/x264_encoder.cpp index 0c1ecbc..8be53ce 100644 --- a/x264_encoder.cpp +++ b/x264_encoder.cpp @@ -30,6 +30,9 @@ namespace { void update_vbv_settings(x264_param_t *param) { + if (global_flags.x264_bitrate == -1) { + return; + } if (global_flags.x264_vbv_buffer_size < 0) { param->rc.i_vbv_buffer_size = param->rc.i_bitrate; // One-second VBV. } else { @@ -127,8 +130,13 @@ void X264Encoder::init_x264() param.vui.i_colmatrix = 6; // BT.601/SMPTE 170M. } - param.rc.i_rc_method = X264_RC_ABR; - param.rc.i_bitrate = global_flags.x264_bitrate; + if (!isinf(global_flags.x264_crf)) { + param.rc.i_rc_method = X264_RC_CRF; + param.rc.f_rf_constant = global_flags.x264_crf; + } else { + param.rc.i_rc_method = X264_RC_ABR; + param.rc.i_bitrate = global_flags.x264_bitrate; + } update_vbv_settings(¶m); if (param.rc.i_vbv_max_bitrate > 0) { // If the user wants VBV control to cap the max rate, it is @@ -219,6 +227,7 @@ void X264Encoder::encoder_thread_func() perror("nice()"); // No exit; it's not fatal. } + pthread_setname_np(pthread_self(), "x264_encode"); init_x264(); x264_init_done = true;