Expose more nvenc options
1. Spatial AQ, for some reason NVENC have problems recovering details on flat regions of static images over multiple frames, official docs recommend to enable it for "game-streaming" 2. Percentage increase of default single-frame VBV/HRD, can act as low latency variable bitrate substitute
This commit is contained in:
@@ -939,6 +939,8 @@ namespace config {
|
||||
string_f(vars, "sw_tune", video.sw.sw_tune);
|
||||
|
||||
int_between_f(vars, "nvenc_preset", video.nv.quality_preset, { 1, 7 });
|
||||
int_between_f(vars, "nvenc_vbv_increase", video.nv.vbv_percentage_increase, { 0, 400 });
|
||||
bool_f(vars, "nvenc_spatial_aq", video.nv.adaptive_quantization);
|
||||
generic_f(vars, "nvenc_twopass", video.nv.two_pass, nv::twopass_from_view);
|
||||
bool_f(vars, "nvenc_h264_cavlc", video.nv.h264_cavlc);
|
||||
bool_f(vars, "nvenc_realtime_hags", video.nv_realtime_hags);
|
||||
|
||||
@@ -222,6 +222,9 @@ namespace nvenc {
|
||||
|
||||
if (get_encoder_cap(NV_ENC_CAPS_SUPPORT_CUSTOM_VBV_BUF_SIZE)) {
|
||||
enc_config.rcParams.vbvBufferSize = client_config.bitrate * 1000 / client_config.framerate;
|
||||
if (config.vbv_percentage_increase > 0) {
|
||||
enc_config.rcParams.vbvBufferSize += enc_config.rcParams.vbvBufferSize * config.vbv_percentage_increase / 100;
|
||||
}
|
||||
}
|
||||
|
||||
auto set_h264_hevc_common_format_config = [&](auto &format_config) {
|
||||
@@ -369,9 +372,10 @@ namespace nvenc {
|
||||
if (init_params.enableEncodeAsync) extra += " async";
|
||||
if (buffer_is_10bit()) extra += " 10-bit";
|
||||
if (enc_config.rcParams.multiPass != NV_ENC_MULTI_PASS_DISABLED) extra += " two-pass";
|
||||
if (config.vbv_percentage_increase > 0 && get_encoder_cap(NV_ENC_CAPS_SUPPORT_CUSTOM_VBV_BUF_SIZE)) extra += " vbv+" + std::to_string(config.vbv_percentage_increase);
|
||||
if (encoder_params.rfi) extra += " rfi";
|
||||
if (init_params.enableWeightedPrediction) extra += " weighted-prediction";
|
||||
if (enc_config.rcParams.enableAQ) extra += " adaptive-quantization";
|
||||
if (enc_config.rcParams.enableAQ) extra += " spatial-aq";
|
||||
if (enc_config.rcParams.enableMinQP) extra += " qpmin=" + std::to_string(enc_config.rcParams.minQP.qpInterP);
|
||||
if (config.insert_filler_data) extra += " filler-data";
|
||||
BOOST_LOG(info) << "NvEnc: created encoder " << quality_preset_string_from_guid(init_params.presetGUID) << extra;
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace nvenc {
|
||||
// Use optional preliminary pass for better motion vectors, bitrate distribution and stricter VBV(HRD), uses CUDA cores
|
||||
nvenc_two_pass two_pass = nvenc_two_pass::quarter_resolution;
|
||||
|
||||
// Percentage increase of VBV/HRD from the default single frame, allows low-latency variable bitrate
|
||||
int vbv_percentage_increase = 0;
|
||||
|
||||
// Improves fades compression, uses CUDA cores
|
||||
bool weighted_prediction = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user