mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-24 10:14:13 -05:00
obs-ffmpeg: Split NVENC preset migrations by codec
This commit also modifies UI.
This commit is contained in:
+69
-3
@@ -2819,9 +2819,7 @@ static void convert_28_1_encoder_setting(const char *encoder, const char *file)
|
||||
bool modified = false;
|
||||
|
||||
if (astrcmpi(encoder, "jim_nvenc") == 0 ||
|
||||
astrcmpi(encoder, "jim_hevc_nvenc") == 0 ||
|
||||
astrcmpi(encoder, "ffmpeg_nvenc") == 0 ||
|
||||
astrcmpi(encoder, "ffmpeg_hevc_nvenc") == 0) {
|
||||
astrcmpi(encoder, "ffmpeg_nvenc") == 0) {
|
||||
|
||||
if (obs_data_has_user_value(data, "preset") &&
|
||||
!obs_data_has_user_value(data, "preset2")) {
|
||||
@@ -2886,6 +2884,74 @@ static void convert_28_1_encoder_setting(const char *encoder, const char *file)
|
||||
"disabled");
|
||||
}
|
||||
|
||||
modified = true;
|
||||
}
|
||||
} else if (astrcmpi(encoder, "jim_hevc_nvenc") == 0 ||
|
||||
astrcmpi(encoder, "ffmpeg_hevc_nvenc") == 0) {
|
||||
|
||||
if (obs_data_has_user_value(data, "preset") &&
|
||||
!obs_data_has_user_value(data, "preset2")) {
|
||||
const char *preset =
|
||||
obs_data_get_string(data, "preset");
|
||||
const char *rc =
|
||||
obs_data_get_string(data, "rate_control");
|
||||
|
||||
if (astrcmpi(rc, "lossless") == 0 &&
|
||||
astrcmpi(preset, "mq")) {
|
||||
obs_data_set_string(data, "preset2", "p5");
|
||||
obs_data_set_string(data, "tune", "lossless");
|
||||
obs_data_set_string(data, "multipass",
|
||||
"disabled");
|
||||
|
||||
} else if (astrcmpi(rc, "lossless") == 0 &&
|
||||
astrcmpi(preset, "hp")) {
|
||||
obs_data_set_string(data, "preset2", "p3");
|
||||
obs_data_set_string(data, "tune", "lossless");
|
||||
obs_data_set_string(data, "multipass",
|
||||
"disabled");
|
||||
|
||||
} else if (astrcmpi(preset, "mq") == 0) {
|
||||
obs_data_set_string(data, "preset2", "p6");
|
||||
obs_data_set_string(data, "tune", "hq");
|
||||
obs_data_set_string(data, "multipass", "qres");
|
||||
|
||||
} else if (astrcmpi(preset, "hq") == 0) {
|
||||
obs_data_set_string(data, "preset2", "p6");
|
||||
obs_data_set_string(data, "tune", "hq");
|
||||
obs_data_set_string(data, "multipass",
|
||||
"disabled");
|
||||
|
||||
} else if (astrcmpi(preset, "default") == 0) {
|
||||
obs_data_set_string(data, "preset2", "p5");
|
||||
obs_data_set_string(data, "tune", "hq");
|
||||
obs_data_set_string(data, "multipass",
|
||||
"disabled");
|
||||
|
||||
} else if (astrcmpi(preset, "hp") == 0) {
|
||||
obs_data_set_string(data, "preset2", "p1");
|
||||
obs_data_set_string(data, "tune", "hq");
|
||||
obs_data_set_string(data, "multipass",
|
||||
"disabled");
|
||||
|
||||
} else if (astrcmpi(preset, "ll") == 0) {
|
||||
obs_data_set_string(data, "preset2", "p3");
|
||||
obs_data_set_string(data, "tune", "ll");
|
||||
obs_data_set_string(data, "multipass",
|
||||
"disabled");
|
||||
|
||||
} else if (astrcmpi(preset, "llhq") == 0) {
|
||||
obs_data_set_string(data, "preset2", "p4");
|
||||
obs_data_set_string(data, "tune", "ll");
|
||||
obs_data_set_string(data, "multipass",
|
||||
"disabled");
|
||||
|
||||
} else if (astrcmpi(preset, "llhp") == 0) {
|
||||
obs_data_set_string(data, "preset2", "p2");
|
||||
obs_data_set_string(data, "tune", "ll");
|
||||
obs_data_set_string(data, "multipass",
|
||||
"disabled");
|
||||
}
|
||||
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +461,8 @@ static bool init_encoder_base(struct nvenc_data *enc, obs_data_t *settings,
|
||||
NV_ENC_MULTI_PASS nv_multipass = get_nv_multipass(multipass);
|
||||
|
||||
if (obs_data_has_user_value(settings, "preset") &&
|
||||
!obs_data_has_user_value(settings, "preset2")) {
|
||||
!obs_data_has_user_value(settings, "preset2") &&
|
||||
enc->codec == CODEC_H264) {
|
||||
if (astrcmpi(preset, "mq") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P5_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_HIGH_QUALITY;
|
||||
@@ -492,6 +493,44 @@ static bool init_encoder_base(struct nvenc_data *enc, obs_data_t *settings,
|
||||
nv_tuning = NV_ENC_TUNING_INFO_LOW_LATENCY;
|
||||
nv_multipass = NV_ENC_MULTI_PASS_DISABLED;
|
||||
|
||||
} else if (astrcmpi(preset, "llhp") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P2_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_LOW_LATENCY;
|
||||
nv_multipass = NV_ENC_MULTI_PASS_DISABLED;
|
||||
}
|
||||
} else if (obs_data_has_user_value(settings, "preset") &&
|
||||
!obs_data_has_user_value(settings, "preset2") &&
|
||||
enc->codec == CODEC_HEVC) {
|
||||
if (astrcmpi(preset, "mq") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P6_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_HIGH_QUALITY;
|
||||
nv_multipass = NV_ENC_TWO_PASS_QUARTER_RESOLUTION;
|
||||
|
||||
} else if (astrcmpi(preset, "hq") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P6_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_HIGH_QUALITY;
|
||||
nv_multipass = NV_ENC_MULTI_PASS_DISABLED;
|
||||
|
||||
} else if (astrcmpi(preset, "default") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P5_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_HIGH_QUALITY;
|
||||
nv_multipass = NV_ENC_MULTI_PASS_DISABLED;
|
||||
|
||||
} else if (astrcmpi(preset, "hp") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P1_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_HIGH_QUALITY;
|
||||
nv_multipass = NV_ENC_MULTI_PASS_DISABLED;
|
||||
|
||||
} else if (astrcmpi(preset, "ll") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P3_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_LOW_LATENCY;
|
||||
nv_multipass = NV_ENC_MULTI_PASS_DISABLED;
|
||||
|
||||
} else if (astrcmpi(preset, "llhq") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P4_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_LOW_LATENCY;
|
||||
nv_multipass = NV_ENC_MULTI_PASS_DISABLED;
|
||||
|
||||
} else if (astrcmpi(preset, "llhp") == 0) {
|
||||
nv_preset = NV_ENC_PRESET_P2_GUID;
|
||||
nv_tuning = NV_ENC_TUNING_INFO_LOW_LATENCY;
|
||||
|
||||
Reference in New Issue
Block a user