0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 04:42:18 +02:00

Basic UI: Add "Use Constant Bitrate" advanced option.

It's better to use VBR for local recordings, so this option should be
nice for people who want to do that.
This commit is contained in:
jp9000 2014-09-24 20:23:42 -07:00
parent fd64fbb2f4
commit 4a06960188
4 changed files with 50 additions and 13 deletions

View File

@ -209,6 +209,7 @@ Basic.Settings.Output.MaxRetries="Maximum Retries"
Basic.Settings.Output.Advanced="Enable Advanced Encoder Settings"
Basic.Settings.Output.X264Preset="x264 Preset"
Basic.Settings.Output.CustomX264Settings="Custom x264 Settings"
Basic.Settings.Output.UseCBR="Use Constant Bitrate"
# basic mode 'video' settings
Basic.Settings.Video="Video"

View File

@ -524,17 +524,17 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QLineEdit" name="simpleOutCustomX264"/>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Basic.Settings.Output.CustomX264Settings</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_24">
<property name="enabled">
<bool>true</bool>
@ -544,7 +544,7 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QComboBox" name="simpleOutPreset">
<item>
<property name="text">
@ -588,6 +588,16 @@
</item>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="simpleOutUseCBR">
<property name="text">
<string>Basic.Settings.Output.UseCBR</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -1188,8 +1198,8 @@
<y>240</y>
</hint>
<hint type="destinationlabel">
<x>432</x>
<y>256</y>
<x>750</x>
<y>295</y>
</hint>
</hints>
</connection>
@ -1204,8 +1214,8 @@
<y>241</y>
</hint>
<hint type="destinationlabel">
<x>308</x>
<y>266</y>
<x>367</x>
<y>295</y>
</hint>
</hints>
</connection>
@ -1220,8 +1230,8 @@
<y>234</y>
</hint>
<hint type="destinationlabel">
<x>452</x>
<y>292</y>
<x>750</x>
<y>321</y>
</hint>
</hints>
</connection>
@ -1236,8 +1246,24 @@
<y>236</y>
</hint>
<hint type="destinationlabel">
<x>350</x>
<y>286</y>
<x>367</x>
<y>321</y>
</hint>
</hints>
</connection>
<connection>
<sender>simpleOutAdvanced</sender>
<signal>toggled(bool)</signal>
<receiver>simpleOutUseCBR</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>398</x>
<y>241</y>
</hint>
<hint type="destinationlabel">
<x>410</x>
<y>261</y>
</hint>
</hints>
</connection>

View File

@ -442,6 +442,7 @@ bool OBSBasic::InitBasicConfigDefaults()
20);
config_set_default_bool (basicConfig, "SimpleOutput", "UseAdvanced",
false);
config_set_default_bool (basicConfig, "SimpleOutput", "UseCBR", true);
config_set_default_string(basicConfig, "SimpleOutput", "Preset",
"veryfast");
@ -2025,6 +2026,8 @@ void OBSBasic::SetupEncoders()
"ABitrate");
bool advanced = config_get_bool(basicConfig, "SimpleOutput",
"UseAdvanced");
bool useCBR = config_get_bool(basicConfig, "SimpleOutput",
"UseCBR");
const char *preset = config_get_string(basicConfig,
"SimpleOutput", "Preset");
const char *custom = config_get_string(basicConfig,
@ -2032,11 +2035,13 @@ void OBSBasic::SetupEncoders()
obs_data_set_int(x264Settings, "bitrate", videoBitrate);
obs_data_set_int(x264Settings, "buffer_size", videoBitrate);
obs_data_set_bool(x264Settings, "cbr", true);
if (advanced) {
obs_data_set_string(x264Settings, "preset", preset);
obs_data_set_string(x264Settings, "x264opts", custom);
obs_data_set_bool(x264Settings, "cbr", useCBR);
} else {
obs_data_set_bool(x264Settings, "cbr", true);
}
obs_data_set_int(aacSettings, "bitrate", audioBitrate);

View File

@ -146,6 +146,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->simpleOutRetryDelay, SCROLL_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->simpleOutMaxRetries, SCROLL_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->simpleOutAdvanced, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->simpleOutUseCBR, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->simpleOutPreset, COMBO_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->simpleOutCustomX264, EDIT_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->channelSetup, COMBO_CHANGED, AUDIO_RESTART);
@ -437,6 +438,8 @@ void OBSBasicSettings::LoadSimpleOutputSettings()
"MaxRetries");
bool advanced = config_get_bool(main->Config(), "SimpleOutput",
"UseAdvanced");
bool useCBR = config_get_bool(main->Config(), "SimpleOutput",
"UseCBR");
const char *preset = config_get_string(main->Config(), "SimpleOutput",
"Preset");
const char *custom = config_get_string(main->Config(), "SimpleOutput",
@ -452,6 +455,7 @@ void OBSBasicSettings::LoadSimpleOutputSettings()
ui->simpleOutRetryDelay->setValue(retryDelay);
ui->simpleOutMaxRetries->setValue(maxRetries);
ui->simpleOutAdvanced->setChecked(advanced);
ui->simpleOutUseCBR->setChecked(useCBR);
ui->simpleOutPreset->setCurrentText(preset);
ui->simpleOutCustomX264->setText(custom);
}
@ -627,6 +631,7 @@ void OBSBasicSettings::SaveOutputSettings()
SaveSpinBox(ui->simpleOutRetryDelay, "SimpleOutput", "RetryDelay");
SaveSpinBox(ui->simpleOutMaxRetries, "SimpleOutput", "MaxRetries");
SaveCheckBox(ui->simpleOutAdvanced, "SimpleOutput", "UseAdvanced");
SaveCheckBox(ui->simpleOutUseCBR, "SimpleOutput", "UseCBR");
SaveCombo(ui->simpleOutPreset, "SimpleOutput", "Preset");
SaveEdit(ui->simpleOutCustomX264, "SimpleOutput", "x264Settings");
}