obs-ffmpeg: Add option to use b-frames as reference

According to nvidia's documentation using b-frames as reference results in
a slight quality improvement with no/negligible performance impact and is
recommended to be enabled by default when using multiple b-frames.
This commit is contained in:
derrod
2019-02-20 04:48:23 +01:00
parent 4722b764ca
commit adf3337d3c
3 changed files with 13 additions and 0 deletions

View File

@@ -318,6 +318,7 @@ static bool init_encoder(struct nvenc_data *enc, obs_data_t *settings)
const char *profile = obs_data_get_string(settings, "profile");
bool psycho_aq = obs_data_get_bool(settings, "psycho_aq");
bool lookahead = obs_data_get_bool(settings, "lookahead");
bool bframes_as_ref = obs_data_get_bool(settings, "bframes_as_ref");
int bf = (int)obs_data_get_int(settings, "bf");
bool vbr = astrcmpi(rc, "VBR") == 0;
NVENCSTATUS err;
@@ -435,6 +436,11 @@ static bool init_encoder(struct nvenc_data *enc, obs_data_t *settings)
config->rcParams.enableTemporalAQ = psycho_aq;
}
/* b-frames as reference */
if (bf >= 1 && bframes_as_ref &&
nv_get_cap(enc, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE))
h264_config->useBFramesAsRef = NV_ENC_BFRAME_REF_MODE_MIDDLE;
/* -------------------------- */
/* rate control */