mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
UI: Simple Output Mode for NVENC HEVC
This commit is contained in:
parent
29782cd594
commit
84e7db5059
@ -897,6 +897,7 @@ Basic.Settings.Output.Simple.Encoder.Software="Software (x264)"
|
||||
Basic.Settings.Output.Simple.Encoder.Hardware.QSV.H264="Hardware (QSV, H.264)"
|
||||
Basic.Settings.Output.Simple.Encoder.Hardware.AMD.H264="Hardware (AMD, H.264)"
|
||||
Basic.Settings.Output.Simple.Encoder.Hardware.NVENC.H264="Hardware (NVENC, H.264)"
|
||||
Basic.Settings.Output.Simple.Encoder.Hardware.NVENC.HEVC="Hardware (NVENC, HEVC)"
|
||||
Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU="Software (x264 low CPU usage preset, increases file size)"
|
||||
Basic.Settings.Output.Simple.TwitchVodTrack="Twitch VOD Track (Uses Track 2)"
|
||||
Basic.Settings.Output.Warn.EnforceResolutionFPS.Title="Incompatible Resolution/Framerate"
|
||||
|
@ -285,6 +285,9 @@ struct SimpleOutput : BasicOutputHandler {
|
||||
void UpdateRecordingSettings_x264_crf(int crf);
|
||||
void UpdateRecordingSettings_qsv11(int crf);
|
||||
void UpdateRecordingSettings_nvenc(int cqp);
|
||||
#ifdef ENABLE_HEVC
|
||||
void UpdateRecordingSettings_nvenc_hevc(int cqp);
|
||||
#endif
|
||||
void UpdateRecordingSettings_amd_cqp(int cqp);
|
||||
void UpdateRecordingSettings();
|
||||
void UpdateRecordingAudioSettings();
|
||||
@ -392,6 +395,13 @@ void SimpleOutput::LoadRecordingPreset()
|
||||
? "jim_nvenc"
|
||||
: "ffmpeg_nvenc";
|
||||
LoadRecordingPreset_Lossy(id);
|
||||
#ifdef ENABLE_HEVC
|
||||
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC_HEVC) == 0) {
|
||||
const char *id = EncoderAvailable("jim_hevc_nvenc")
|
||||
? "jim_hevc_nvenc"
|
||||
: "ffmpeg_hevc_nvenc";
|
||||
LoadRecordingPreset_Lossy(id);
|
||||
#endif
|
||||
}
|
||||
usingRecordingPreset = true;
|
||||
|
||||
@ -420,6 +430,14 @@ SimpleOutput::SimpleOutput(OBSBasic *main_) : BasicOutputHandler(main_)
|
||||
: "ffmpeg_nvenc";
|
||||
LoadStreamingPreset_Lossy(id);
|
||||
|
||||
#ifdef ENABLE_HEVC
|
||||
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC_HEVC) == 0) {
|
||||
const char *id = EncoderAvailable("jim_hevc_nvenc")
|
||||
? "jim_hevc_nvenc"
|
||||
: "ffmpeg_hevc_nvenc";
|
||||
LoadStreamingPreset_Lossy(id);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
LoadStreamingPreset_Lossy("obs_x264");
|
||||
}
|
||||
@ -519,6 +537,11 @@ void SimpleOutput::Update()
|
||||
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0) {
|
||||
presetType = "NVENCPreset";
|
||||
|
||||
#ifdef ENABLE_HEVC
|
||||
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC_HEVC) == 0) {
|
||||
presetType = "NVENCPreset";
|
||||
#endif
|
||||
|
||||
} else {
|
||||
presetType = "Preset";
|
||||
}
|
||||
@ -655,6 +678,19 @@ void SimpleOutput::UpdateRecordingSettings_nvenc(int cqp)
|
||||
obs_encoder_update(videoRecording, settings);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HEVC
|
||||
void SimpleOutput::UpdateRecordingSettings_nvenc_hevc(int cqp)
|
||||
{
|
||||
OBSDataAutoRelease settings = obs_data_create();
|
||||
obs_data_set_string(settings, "rate_control", "CQP");
|
||||
obs_data_set_string(settings, "profile", "main");
|
||||
obs_data_set_string(settings, "preset", "hq");
|
||||
obs_data_set_int(settings, "cqp", cqp);
|
||||
|
||||
obs_encoder_update(videoRecording, settings);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SimpleOutput::UpdateStreamingSettings_amd(obs_data_t *settings,
|
||||
int bitrate)
|
||||
{
|
||||
@ -714,6 +750,11 @@ void SimpleOutput::UpdateRecordingSettings()
|
||||
|
||||
} else if (videoEncoder == SIMPLE_ENCODER_NVENC) {
|
||||
UpdateRecordingSettings_nvenc(crf);
|
||||
|
||||
#ifdef ENABLE_HEVC
|
||||
} else if (videoEncoder == SIMPLE_ENCODER_NVENC_HEVC) {
|
||||
UpdateRecordingSettings_nvenc_hevc(crf);
|
||||
#endif
|
||||
}
|
||||
UpdateRecordingAudioSettings();
|
||||
}
|
||||
|
@ -818,6 +818,9 @@ void OBSBasic::CheckForSimpleModeX264Fallback()
|
||||
bool qsv_supported = false;
|
||||
bool amd_supported = false;
|
||||
bool nve_supported = false;
|
||||
#ifdef ENABLE_HEVC
|
||||
bool nve_hevc_supported = false;
|
||||
#endif
|
||||
bool changed = false;
|
||||
size_t idx = 0;
|
||||
const char *id;
|
||||
@ -829,6 +832,10 @@ void OBSBasic::CheckForSimpleModeX264Fallback()
|
||||
qsv_supported = true;
|
||||
else if (strcmp(id, "ffmpeg_nvenc") == 0)
|
||||
nve_supported = true;
|
||||
#ifdef ENABLE_HEVC
|
||||
else if (strcmp(id, "ffmpeg_hevc_nvenc") == 0)
|
||||
nve_hevc_supported = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
auto CheckEncoder = [&](const char *&name) {
|
||||
@ -844,6 +851,14 @@ void OBSBasic::CheckForSimpleModeX264Fallback()
|
||||
name = SIMPLE_ENCODER_X264;
|
||||
return false;
|
||||
}
|
||||
#ifdef ENABLE_HEVC
|
||||
} else if (strcmp(name, SIMPLE_ENCODER_NVENC_HEVC) == 0) {
|
||||
if (!nve_hevc_supported) {
|
||||
changed = true;
|
||||
name = SIMPLE_ENCODER_X264;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
} else if (strcmp(name, SIMPLE_ENCODER_AMD) == 0) {
|
||||
if (!amd_supported) {
|
||||
changed = true;
|
||||
|
@ -66,6 +66,9 @@ class OBSBasicStats;
|
||||
#define SIMPLE_ENCODER_X264_LOWCPU "x264_lowcpu"
|
||||
#define SIMPLE_ENCODER_QSV "qsv"
|
||||
#define SIMPLE_ENCODER_NVENC "nvenc"
|
||||
#ifdef ENABLE_HEVC
|
||||
#define SIMPLE_ENCODER_NVENC_HEVC "nvenc_hevc"
|
||||
#endif
|
||||
#define SIMPLE_ENCODER_AMD "amd"
|
||||
|
||||
#define PREVIEW_EDGE_SIZE 10
|
||||
|
@ -3551,6 +3551,10 @@ void OBSBasicSettings::SaveOutputSettings()
|
||||
presetType = "QSVPreset";
|
||||
else if (encoder == SIMPLE_ENCODER_NVENC)
|
||||
presetType = "NVENCPreset";
|
||||
#ifdef ENABLE_HEVC
|
||||
else if (encoder == SIMPLE_ENCODER_NVENC_HEVC)
|
||||
presetType = "NVENCPreset";
|
||||
#endif
|
||||
else if (encoder == SIMPLE_ENCODER_AMD)
|
||||
presetType = "AMDPreset";
|
||||
else
|
||||
@ -4769,6 +4773,12 @@ void OBSBasicSettings::FillSimpleRecordingValues()
|
||||
ui->simpleOutRecEncoder->addItem(
|
||||
ENCODER_STR("Hardware.NVENC.H264"),
|
||||
QString(SIMPLE_ENCODER_NVENC));
|
||||
#ifdef ENABLE_HEVC
|
||||
if (EncoderAvailable("ffmpeg_hevc_nvenc"))
|
||||
ui->simpleOutRecEncoder->addItem(
|
||||
ENCODER_STR("Hardware.NVENC.HEVC"),
|
||||
QString(SIMPLE_ENCODER_NVENC_HEVC));
|
||||
#endif
|
||||
if (EncoderAvailable("amd_amf_h264"))
|
||||
ui->simpleOutRecEncoder->addItem(
|
||||
ENCODER_STR("Hardware.AMD.H264"),
|
||||
@ -4788,6 +4798,12 @@ void OBSBasicSettings::FillSimpleStreamingValues()
|
||||
ui->simpleOutStrEncoder->addItem(
|
||||
ENCODER_STR("Hardware.NVENC.H264"),
|
||||
QString(SIMPLE_ENCODER_NVENC));
|
||||
#ifdef ENABLE_HEVC
|
||||
if (EncoderAvailable("ffmpeg_hevc_nvenc"))
|
||||
ui->simpleOutStrEncoder->addItem(
|
||||
ENCODER_STR("Hardware.NVENC.HEVC"),
|
||||
QString(SIMPLE_ENCODER_NVENC_HEVC));
|
||||
#endif
|
||||
if (EncoderAvailable("amd_amf_h264"))
|
||||
ui->simpleOutStrEncoder->addItem(
|
||||
ENCODER_STR("Hardware.AMD.H264"),
|
||||
@ -4870,6 +4886,34 @@ void OBSBasicSettings::SimpleStreamingEncoderChanged()
|
||||
defaultPreset = "default";
|
||||
preset = curNVENCPreset;
|
||||
|
||||
#ifdef ENABLE_HEVC
|
||||
} else if (encoder == SIMPLE_ENCODER_NVENC_HEVC) {
|
||||
obs_properties_t *props =
|
||||
obs_get_encoder_properties("ffmpeg_hevc_nvenc");
|
||||
|
||||
obs_property_t *p = obs_properties_get(props, "preset");
|
||||
size_t num = obs_property_list_item_count(p);
|
||||
for (size_t i = 0; i < num; i++) {
|
||||
const char *name = obs_property_list_item_name(p, i);
|
||||
const char *val = obs_property_list_item_string(p, i);
|
||||
|
||||
/* bluray is for ideal bluray disc recording settings,
|
||||
* not streaming */
|
||||
if (strcmp(val, "bd") == 0)
|
||||
continue;
|
||||
/* lossless should of course not be used to stream */
|
||||
if (astrcmp_n(val, "lossless", 8) == 0)
|
||||
continue;
|
||||
|
||||
ui->simpleOutPreset->addItem(QT_UTF8(name), val);
|
||||
}
|
||||
|
||||
obs_properties_destroy(props);
|
||||
|
||||
defaultPreset = "default";
|
||||
preset = curNVENCPreset;
|
||||
#endif
|
||||
|
||||
} else if (encoder == SIMPLE_ENCODER_AMD) {
|
||||
ui->simpleOutPreset->addItem("Speed", "speed");
|
||||
ui->simpleOutPreset->addItem("Balanced", "balanced");
|
||||
|
Loading…
Reference in New Issue
Block a user