Add new nvenc options to legacy ffmpeg path

This commit is contained in:
ns6089 2023-10-29 10:22:09 +03:00 committed by Cameron Gutman
parent 6ded2a9577
commit fe886632dc
3 changed files with 13 additions and 0 deletions

View File

@ -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);

View File

@ -37,6 +37,8 @@ namespace config {
int preset;
int multipass;
int h264_coder;
int aq;
int vbv_percentage_increase;
} nv_legacy;
struct {

View File

@ -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
}
}
}