diff --git a/src/config.cpp b/src/config.cpp index b19486382ce..7418fc0c112 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -953,6 +953,8 @@ namespace config { video.nv.two_pass == nvenc::nvenc_two_pass::full_resolution ? NV_ENC_TWO_PASS_FULL_RESOLUTION : NV_ENC_MULTI_PASS_DISABLED; video.nv_legacy.h264_coder = video.nv.h264_cavlc ? NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC : NV_ENC_H264_ENTROPY_CODING_MODE_CABAC; + video.nv_legacy.aq = video.nv.adaptive_quantization; + video.nv_legacy.vbv_percentage_increase = video.nv.vbv_percentage_increase; #endif int_f(vars, "qsv_preset", video.qsv.qsv_preset, qsv::preset_from_view); diff --git a/src/config.h b/src/config.h index 3ea736444c8..e08a87f3c4d 100644 --- a/src/config.h +++ b/src/config.h @@ -37,6 +37,8 @@ namespace config { int preset; int multipass; int h264_coder; + int aq; + int vbv_percentage_increase; } nv_legacy; struct { diff --git a/src/video.cpp b/src/video.cpp index 68402d29d81..206e7feeb62 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -638,6 +638,7 @@ namespace video { { "tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY }, { "rc"s, NV_ENC_PARAMS_RC_CBR }, { "multipass"s, &config::video.nv_legacy.multipass }, + { "aq"s, &config::video.nv_legacy.aq }, }, // SDR-specific options {}, @@ -658,6 +659,7 @@ namespace video { { "tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY }, { "rc"s, NV_ENC_PARAMS_RC_CBR }, { "multipass"s, &config::video.nv_legacy.multipass }, + { "aq"s, &config::video.nv_legacy.aq }, }, // SDR-specific options { @@ -681,6 +683,7 @@ namespace video { { "rc"s, NV_ENC_PARAMS_RC_CBR }, { "coder"s, &config::video.nv_legacy.h264_coder }, { "multipass"s, &config::video.nv_legacy.multipass }, + { "aq"s, &config::video.nv_legacy.aq }, }, // SDR-specific options { @@ -1698,6 +1701,12 @@ namespace video { } else { ctx->rc_buffer_size = bitrate / config.framerate; + +#ifndef __APPLE__ + if (encoder.name == "nvenc" && config::video.nv_legacy.vbv_percentage_increase > 0) { + ctx->rc_buffer_size += ctx->rc_buffer_size * config::video.nv_legacy.vbv_percentage_increase / 100; + } +#endif } } }