UI: Add NVENC support to simple output
parent
8e1943065c
commit
e3fbdb9293
|
@ -390,6 +390,7 @@ Basic.Settings.Output.Simple.Warn.Lossless.Msg="Are you sure you want to use los
|
|||
Basic.Settings.Output.Simple.Warn.Lossless.Title="Lossless quality warning!"
|
||||
Basic.Settings.Output.Simple.Encoder.Software="Software (x264)"
|
||||
Basic.Settings.Output.Simple.Encoder.Hardware.QSV="Hardware (QSV)"
|
||||
Basic.Settings.Output.Simple.Encoder.Hardware.NVENC="Hardware (NVENC)"
|
||||
Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU="Software (x264 low CPU usage preset, increases file size)"
|
||||
Basic.Settings.Output.VideoBitrate="Video Bitrate"
|
||||
Basic.Settings.Output.AudioBitrate="Audio Bitrate"
|
||||
|
|
|
@ -154,6 +154,7 @@ struct SimpleOutput : BasicOutputHandler {
|
|||
|
||||
void UpdateRecordingSettings_x264_crf(int crf);
|
||||
void UpdateRecordingSettings_qsv11(int crf);
|
||||
void UpdateRecordingSettings_nvenc(int bitrate);
|
||||
void UpdateRecordingSettings();
|
||||
void UpdateRecordingAudioSettings();
|
||||
virtual void Update() override;
|
||||
|
@ -245,6 +246,8 @@ void SimpleOutput::LoadRecordingPreset()
|
|||
lowCPUx264 = true;
|
||||
} else if (strcmp(encoder, SIMPLE_ENCODER_QSV) == 0) {
|
||||
LoadRecordingPreset_h264("obs_qsv11");
|
||||
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0) {
|
||||
LoadRecordingPreset_h264("ffmpeg_nvenc");
|
||||
}
|
||||
usingRecordingPreset = true;
|
||||
|
||||
|
@ -267,6 +270,8 @@ SimpleOutput::SimpleOutput(OBSBasic *main_) : BasicOutputHandler(main_)
|
|||
"StreamEncoder");
|
||||
if (strcmp(encoder, SIMPLE_ENCODER_QSV) == 0)
|
||||
LoadStreamingPreset_h264("obs_qsv11");
|
||||
else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0)
|
||||
LoadStreamingPreset_h264("ffmpeg_nvenc");
|
||||
else
|
||||
LoadStreamingPreset_h264("obs_x264");
|
||||
|
||||
|
@ -330,6 +335,8 @@ void SimpleOutput::Update()
|
|||
|
||||
if (strcmp(encoder, SIMPLE_ENCODER_QSV) == 0)
|
||||
presetType = "QSVPreset";
|
||||
else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0)
|
||||
presetType = "NVENCPreset";
|
||||
else
|
||||
presetType = "Preset";
|
||||
|
||||
|
@ -456,15 +463,31 @@ void SimpleOutput::UpdateRecordingSettings_qsv11(int crf)
|
|||
obs_data_release(settings);
|
||||
}
|
||||
|
||||
void SimpleOutput::UpdateRecordingSettings_nvenc(int bitrate)
|
||||
{
|
||||
obs_data_t *settings = obs_data_create();
|
||||
obs_data_set_string(settings, "profile", "high");
|
||||
obs_data_set_string(settings, "preset", "hq");
|
||||
obs_data_set_int(settings, "bitrate", bitrate);
|
||||
|
||||
obs_encoder_update(h264Recording, settings);
|
||||
|
||||
obs_data_release(settings);
|
||||
}
|
||||
|
||||
void SimpleOutput::UpdateRecordingSettings()
|
||||
{
|
||||
int crf = CalcCRF((videoQuality == "HQ") ? 16 : 23);
|
||||
bool ultra_hq = (videoQuality == "HQ");
|
||||
int crf = CalcCRF(ultra_hq ? 16 : 23);
|
||||
|
||||
if (astrcmp_n(videoEncoder.c_str(), "x264", 4) == 0) {
|
||||
UpdateRecordingSettings_x264_crf(crf);
|
||||
|
||||
} else if (videoEncoder == SIMPLE_ENCODER_QSV) {
|
||||
UpdateRecordingSettings_qsv11(crf);
|
||||
|
||||
} else if (videoEncoder == SIMPLE_ENCODER_NVENC) {
|
||||
UpdateRecordingSettings_nvenc(ultra_hq ? 90000 : 50000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ class QNetworkReply;
|
|||
#define SIMPLE_ENCODER_X264 "x264"
|
||||
#define SIMPLE_ENCODER_X264_LOWCPU "x264_lowcpu"
|
||||
#define SIMPLE_ENCODER_QSV "qsv"
|
||||
#define SIMPLE_ENCODER_NVENC "nvenc"
|
||||
|
||||
#define PREVIEW_EDGE_SIZE 10
|
||||
|
||||
|
|
|
@ -1135,6 +1135,8 @@ void OBSBasicSettings::LoadSimpleOutputSettings()
|
|||
"Preset");
|
||||
const char *qsvPreset = config_get_string(main->Config(), "SimpleOutput",
|
||||
"QSVPreset");
|
||||
const char *nvPreset = config_get_string(main->Config(), "SimpleOutput",
|
||||
"NVENCPreset");
|
||||
const char *custom = config_get_string(main->Config(), "SimpleOutput",
|
||||
"x264Settings");
|
||||
const char *recQual = config_get_string(main->Config(), "SimpleOutput",
|
||||
|
@ -1146,6 +1148,7 @@ void OBSBasicSettings::LoadSimpleOutputSettings()
|
|||
|
||||
curPreset = preset;
|
||||
curQSVPreset = qsvPreset;
|
||||
curNVENCPreset = nvPreset;
|
||||
|
||||
audioBitrate = FindClosestAvailableAACBitrate(audioBitrate);
|
||||
|
||||
|
@ -2342,6 +2345,8 @@ void OBSBasicSettings::SaveOutputSettings()
|
|||
|
||||
if (encoder == SIMPLE_ENCODER_QSV)
|
||||
presetType = "QSVPreset";
|
||||
else if (encoder == SIMPLE_ENCODER_NVENC)
|
||||
presetType = "NVENCPreset";
|
||||
else
|
||||
presetType = "Preset";
|
||||
|
||||
|
@ -3104,6 +3109,10 @@ void OBSBasicSettings::FillSimpleRecordingValues()
|
|||
ui->simpleOutRecEncoder->addItem(
|
||||
ENCODER_STR("Hardware.QSV"),
|
||||
QString(SIMPLE_ENCODER_QSV));
|
||||
if (EncoderAvailable("ffmpeg_nvenc"))
|
||||
ui->simpleOutRecEncoder->addItem(
|
||||
ENCODER_STR("Hardware.NVENC"),
|
||||
QString(SIMPLE_ENCODER_NVENC));
|
||||
#undef ADD_QUALITY
|
||||
}
|
||||
|
||||
|
@ -3116,6 +3125,10 @@ void OBSBasicSettings::FillSimpleStreamingValues()
|
|||
ui->simpleOutStrEncoder->addItem(
|
||||
ENCODER_STR("Hardware.QSV"),
|
||||
QString(SIMPLE_ENCODER_QSV));
|
||||
if (EncoderAvailable("ffmpeg_nvenc"))
|
||||
ui->simpleOutStrEncoder->addItem(
|
||||
ENCODER_STR("Hardware.NVENC"),
|
||||
QString(SIMPLE_ENCODER_NVENC));
|
||||
#undef ENCODER_STR
|
||||
}
|
||||
|
||||
|
@ -3149,6 +3162,30 @@ void OBSBasicSettings::SimpleStreamingEncoderChanged()
|
|||
|
||||
defaultPreset = "balanced";
|
||||
preset = curQSVPreset;
|
||||
|
||||
} else if (encoder == SIMPLE_ENCODER_NVENC) {
|
||||
obs_properties_t *props =
|
||||
obs_get_encoder_properties("ffmpeg_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;
|
||||
|
||||
ui->simpleOutPreset->addItem(QT_UTF8(name), val);
|
||||
}
|
||||
|
||||
obs_properties_destroy(props);
|
||||
|
||||
defaultPreset = "default";
|
||||
preset = curNVENCPreset;
|
||||
|
||||
} else {
|
||||
ui->simpleOutPreset->addItem("ultrafast", "ultrafast");
|
||||
ui->simpleOutPreset->addItem("superfast", "superfast");
|
||||
|
|
|
@ -110,6 +110,7 @@ private:
|
|||
|
||||
QString curPreset;
|
||||
QString curQSVPreset;
|
||||
QString curNVENCPreset;
|
||||
|
||||
using AudioSource_t =
|
||||
std::tuple<OBSWeakSource,
|
||||
|
|
Loading…
Reference in New Issue