提交 b9e4ff1f 编写于 作者: J jp9000

UI: Warn if streaming audio/video bitrate is too high

Allows the user to know that the maximum bitrate limit for a streaming
service is being enforced.
上级 d54bf1b8
......@@ -382,6 +382,8 @@ Basic.Settings.Output.Simple.RecordingQuality.Stream="Same as stream"
Basic.Settings.Output.Simple.RecordingQuality.Small="High Quality, Medium File Size"
Basic.Settings.Output.Simple.RecordingQuality.HQ="Indistinguishable Quality, Large File Size"
Basic.Settings.Output.Simple.RecordingQuality.Lossless="Lossless Quality, Tremendously Large File Size"
Basic.Settings.Output.Simple.Warn.VideoBitrate="Warning: The video bitrate will be set to %1, which is the upper limit for the current streaming service. If you're sure you want to go above %1, enable advanced encoder options and uncheck \"Enforce streaming service bitrate limits\"."
Basic.Settings.Output.Simple.Warn.AudioBitrate="Warning: The audio bitrate will be set to %1, which is the upper limit for the current streaming service. If you're sure you want to go above %1, enable advanced encoder options and uncheck \"Enforce streaming service bitrate limits\"."
Basic.Settings.Output.Simple.Warn.Encoder="Warning: Recording with a software encoder at a different quality than the stream will require extra CPU usage if you stream and record at the same time."
Basic.Settings.Output.Simple.Warn.Lossless="Warning: Lossless quality generates tremendously large file sizes! Lossless quality can use upward of 7 gigabytes of disk space per minute at high resolutions and framerates. Lossless is not recommended for long recordings unless you have a very large amount of disk space available."
Basic.Settings.Output.Simple.Warn.Lossless.Msg="Are you sure you want to use lossless quality?"
......
......@@ -472,6 +472,14 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
this, SLOT(SimpleRecordingQualityLosslessWarning(int)));
connect(ui->simpleOutRecEncoder, SIGNAL(currentIndexChanged(int)),
this, SLOT(SimpleRecordingEncoderChanged()));
connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)),
this, SLOT(SimpleRecordingEncoderChanged()));
connect(ui->simpleOutputABitrate, SIGNAL(currentIndexChanged(int)),
this, SLOT(SimpleRecordingEncoderChanged()));
connect(ui->simpleOutAdvanced, SIGNAL(toggled(bool)),
this, SLOT(SimpleRecordingEncoderChanged()));
connect(ui->simpleOutEnforce, SIGNAL(toggled(bool)),
this, SLOT(SimpleRecordingEncoderChanged()));
LoadSettings(false);
......@@ -3053,26 +3061,60 @@ void OBSBasicSettings::SimpleRecordingEncoderChanged()
{
QString qual = ui->simpleOutRecQuality->currentData().toString();
QString warning;
bool advanced = ui->simpleOutAdvanced->isChecked();
bool enforceBitrate = ui->simpleOutEnforce->isChecked() || !advanced;
obs_service_t *service = main->GetService();
delete simpleOutRecWarning;
if (qual == "Stream") {
return;
if (enforceBitrate && service) {
obs_data_t *videoSettings = obs_data_create();
obs_data_t *audioSettings = obs_data_create();
int oldVBitrate = ui->simpleOutputVBitrate->value();
int oldABitrate = ui->simpleOutputABitrate->currentText().toInt();
obs_data_set_int(videoSettings, "bitrate", oldVBitrate);
obs_data_set_int(audioSettings, "bitrate", oldABitrate);
obs_service_apply_encoder_settings(service, videoSettings,
audioSettings);
int newVBitrate = obs_data_get_int(videoSettings, "bitrate");
int newABitrate = obs_data_get_int(audioSettings, "bitrate");
if (newVBitrate < oldVBitrate)
warning = SIMPLE_OUTPUT_WARNING("VideoBitrate")
.arg(newVBitrate);
if (newABitrate < oldABitrate) {
if (!warning.isEmpty())
warning += "\n\n";
warning += SIMPLE_OUTPUT_WARNING("AudioBitrate")
.arg(newABitrate);
}
} else if (qual == "Lossless") {
warning = SIMPLE_OUTPUT_WARNING("Lossless");
obs_data_release(videoSettings);
obs_data_release(audioSettings);
}
if (qual == "Lossless") {
if (!warning.isEmpty())
warning += "\n\n";
warning += SIMPLE_OUTPUT_WARNING("Lossless");
warning += "\n\n";
warning += SIMPLE_OUTPUT_WARNING("Encoder");
} else {
} else if (qual != "Stream") {
QString enc = ui->simpleOutRecEncoder->currentData().toString();
if (enc != SIMPLE_ENCODER_X264 &&
enc != SIMPLE_ENCODER_X264_LOWCPU)
return;
warning = SIMPLE_OUTPUT_WARNING("Encoder");
if (enc == SIMPLE_ENCODER_X264 ||
enc == SIMPLE_ENCODER_X264_LOWCPU) {
if (!warning.isEmpty())
warning += "\n\n";
warning += SIMPLE_OUTPUT_WARNING("Encoder");
}
}
if (warning.isEmpty())
return;
simpleOutRecWarning = new QLabel(warning, this);
simpleOutRecWarning->setObjectName("warningLabel");
simpleOutRecWarning->setWordWrap(true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册