mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-15 08:15:06 +00:00
ffmpeg-encoder/nvenc: Test for "h264_nvenc" in for "Adaptive B-Frames"
Fixes the bug where "Adaptive B-Frames" would not be applied in the way it was expected to be applied. Related: #191
This commit is contained in:
parent
ca54fb4d6a
commit
363bae9c78
1 changed files with 11 additions and 18 deletions
|
@ -584,25 +584,18 @@ void nvenc::update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* c
|
||||||
av_opt_set_int(context->priv_data, "rc-lookahead", la, AV_OPT_SEARCH_CHILDREN);
|
av_opt_set_int(context->priv_data, "rc-lookahead", la, AV_OPT_SEARCH_CHILDREN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (la > 0) {
|
// Adaptive I-Frames
|
||||||
// Adaptive I-Frames
|
if (int64_t adapt_i = obs_data_get_int(settings, KEY_RATECONTROL_ADAPTIVEI);
|
||||||
if (int64_t adapt_i = obs_data_get_int(settings, KEY_RATECONTROL_ADAPTIVEI);
|
!util::is_tristate_default(adapt_i) && (la != 0)) {
|
||||||
!util::is_tristate_default(adapt_i)) {
|
av_opt_set_int(context->priv_data, "no-scenecut", adapt_i, AV_OPT_SEARCH_CHILDREN);
|
||||||
av_opt_set_int(context->priv_data, "no-scenecut", adapt_i, AV_OPT_SEARCH_CHILDREN);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Adaptive B-Frames
|
// Adaptive B-Frames
|
||||||
if (strcmp(codec->name, "h264_nvenc")) {
|
constexpr std::string_view h264_encoder_name = "h264_nvenc";
|
||||||
if (int64_t adapt_b = obs_data_get_int(settings, KEY_RATECONTROL_ADAPTIVEB);
|
if (h264_encoder_name == codec->name) {
|
||||||
!util::is_tristate_default(adapt_b)) {
|
if (int64_t adapt_b = obs_data_get_int(settings, KEY_RATECONTROL_ADAPTIVEB);
|
||||||
av_opt_set_int(context->priv_data, "b_adapt", adapt_b, AV_OPT_SEARCH_CHILDREN);
|
!util::is_tristate_default(adapt_b) && (la != 0)) {
|
||||||
}
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue