mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-15 00:05:06 +00:00
ffmpeg-encoder/nvenc: Invert "no-scenecut" option for "Adaptive I-Frames"
Our "Adaptive I-Frames" is the inverse of the expected parameter to "no-scenecut" in FFmpegs NVENC. Related #191
This commit is contained in:
parent
363bae9c78
commit
c2c31d1d70
3 changed files with 11 additions and 8 deletions
|
@ -587,7 +587,8 @@ void nvenc::update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* c
|
|||
// Adaptive I-Frames
|
||||
if (int64_t adapt_i = obs_data_get_int(settings, KEY_RATECONTROL_ADAPTIVEI);
|
||||
!util::is_tristate_default(adapt_i) && (la != 0)) {
|
||||
av_opt_set_int(context->priv_data, "no-scenecut", adapt_i, AV_OPT_SEARCH_CHILDREN);
|
||||
// no-scenecut is inverted compared to our UI.
|
||||
av_opt_set_int(context->priv_data, "no-scenecut", 1 - adapt_i, AV_OPT_SEARCH_CHILDREN);
|
||||
}
|
||||
|
||||
// Adaptive B-Frames
|
||||
|
@ -726,7 +727,7 @@ void nvenc::log_options(obs_data_t*, const AVCodec* codec, AVCodecContext* conte
|
|||
});
|
||||
tools::print_av_option_bool(context, "2pass", " Two Pass");
|
||||
tools::print_av_option_int(context, "rc-lookahead", " Look-Ahead", "Frames");
|
||||
tools::print_av_option_bool(context, "no-scenecut", " Adaptive I-Frames");
|
||||
tools::print_av_option_bool(context, "no-scenecut", " Adaptive I-Frames", true);
|
||||
if (strcmp(codec->name, "h264_nvenc") == 0)
|
||||
tools::print_av_option_bool(context, "b_adapt", " Adaptive B-Frames");
|
||||
|
||||
|
|
|
@ -311,20 +311,21 @@ const char* tools::get_thread_type_name(int thread_type)
|
|||
}
|
||||
}
|
||||
|
||||
void tools::print_av_option_bool(AVCodecContext* ctx_codec, const char* option, std::string text)
|
||||
void tools::print_av_option_bool(AVCodecContext* ctx_codec, const char* option, std::string text, bool inverse)
|
||||
{
|
||||
print_av_option_bool(ctx_codec, ctx_codec, option, text);
|
||||
print_av_option_bool(ctx_codec, ctx_codec, option, text, inverse);
|
||||
}
|
||||
|
||||
void ffmpeg::tools::print_av_option_bool(AVCodecContext* ctx_codec, void* ctx_option, const char* option,
|
||||
std::string text)
|
||||
std::string text, bool inverse)
|
||||
{
|
||||
int64_t v = 0;
|
||||
if (int err = av_opt_get_int(ctx_option, option, AV_OPT_SEARCH_CHILDREN, &v); err != 0) {
|
||||
LOG_INFO("[%s] %s: <Error: %s>", ctx_codec->codec->name, text.c_str(),
|
||||
ffmpeg::tools::get_error_description(err));
|
||||
} else {
|
||||
LOG_INFO("[%s] %s: %s%s", ctx_codec->codec->name, text.c_str(), v == 0 ? "Disabled" : "Enabled",
|
||||
LOG_INFO("[%s] %s: %s%s", ctx_codec->codec->name, text.c_str(),
|
||||
(inverse ? v != 0 : v == 0) ? "Disabled" : "Enabled",
|
||||
av_opt_is_set_to_default_by_name(ctx_option, option, AV_OPT_SEARCH_CHILDREN) > 0 ? " <Default>" : "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,8 +66,9 @@ namespace ffmpeg::tools {
|
|||
|
||||
const char* get_thread_type_name(int thread_type);
|
||||
|
||||
void print_av_option_bool(AVCodecContext* context, const char* option, std::string text);
|
||||
void print_av_option_bool(AVCodecContext* ctx_codec, void* ctx_option, const char* option, std::string text);
|
||||
void print_av_option_bool(AVCodecContext* context, const char* option, std::string text, bool inverse = false);
|
||||
void print_av_option_bool(AVCodecContext* ctx_codec, void* ctx_option, const char* option, std::string text,
|
||||
bool inverse = false);
|
||||
|
||||
void print_av_option_int(AVCodecContext* context, const char* option, std::string text, std::string suffix);
|
||||
void print_av_option_int(AVCodecContext* ctx_codec, void* ctx_option, const char* option, std::string text,
|
||||
|
|
Loading…
Reference in a new issue