ffmpeg-encoder/nvenc: Fix Look Ahead setting

Also now disables Adaptive I & B as they do nothing without Look-Ahead set to non-zero.

Fixes #159
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-04-17 09:41:58 +02:00 committed by Michael Fabian Dirks
parent c03fc933bb
commit a9c881130e
1 changed files with 8 additions and 2 deletions

View File

@ -314,8 +314,8 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec)
} }
{ {
auto p = obs_properties_add_int_slider(grp, ST_RATECONTROL_LOOKAHEAD, D_TRANSLATE(ST_RATECONTROL_LOOKAHEAD), auto p = obs_properties_add_int_slider(grp, KEY_RATECONTROL_LOOKAHEAD,
-1, 32, 1); D_TRANSLATE(ST_RATECONTROL_LOOKAHEAD), -1, 32, 1);
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_LOOKAHEAD))); obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_LOOKAHEAD)));
obs_property_int_set_suffix(p, " frames"); obs_property_int_set_suffix(p, " frames");
//obs_property_set_modified_callback(p, modified_lookahead); //obs_property_set_modified_callback(p, modified_lookahead);
@ -593,6 +593,12 @@ void nvenc::update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* c
av_opt_set_int(context->priv_data, "b_adapt", adapt_b, AV_OPT_SEARCH_CHILDREN); av_opt_set_int(context->priv_data, "b_adapt", adapt_b, AV_OPT_SEARCH_CHILDREN);
} }
} }
} else {
// These two do not work if lookahead is set to 0 frames (disabled).
av_opt_set_int(context->priv_data, "no-scenecut", 0, AV_OPT_SEARCH_CHILDREN);
if (strcmp(codec->name, "h264_nvenc")) {
av_opt_set_int(context->priv_data, "b_adapt", 0, AV_OPT_SEARCH_CHILDREN);
}
} }
if (have_bitrate) { if (have_bitrate) {