aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Config.cpp3
-rw-r--r--src/Overlay.cpp11
-rw-r--r--src/gui/SettingsPage.cpp51
3 files changed, 54 insertions, 11 deletions
diff --git a/src/Config.cpp b/src/Config.cpp
index 8f28c89..2f99625 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -30,6 +30,7 @@ namespace gsr {
{"streaming.record_options.record_area_width", &config.streaming_config.record_options.record_area_width},
{"streaming.record_options.record_area_height", &config.streaming_config.record_options.record_area_height},
{"streaming.record_options.fps", &config.streaming_config.record_options.fps},
+ {"streaming.record_options.video_bitrate", &config.streaming_config.record_options.video_bitrate},
{"streaming.record_options.merge_audio_tracks", &config.streaming_config.record_options.merge_audio_tracks},
{"streaming.record_options.audio_track", &config.streaming_config.record_options.audio_tracks},
{"streaming.record_options.color_range", &config.streaming_config.record_options.color_range},
@@ -54,6 +55,7 @@ namespace gsr {
{"record.record_options.record_area_width", &config.record_config.record_options.record_area_width},
{"record.record_options.record_area_height", &config.record_config.record_options.record_area_height},
{"record.record_options.fps", &config.record_config.record_options.fps},
+ {"record.record_options.video_bitrate", &config.record_config.record_options.video_bitrate},
{"record.record_options.merge_audio_tracks", &config.record_config.record_options.merge_audio_tracks},
{"record.record_options.audio_track", &config.record_config.record_options.audio_tracks},
{"record.record_options.color_range", &config.record_config.record_options.color_range},
@@ -76,6 +78,7 @@ namespace gsr {
{"replay.record_options.record_area_width", &config.replay_config.record_options.record_area_width},
{"replay.record_options.record_area_height", &config.replay_config.record_options.record_area_height},
{"replay.record_options.fps", &config.replay_config.record_options.fps},
+ {"replay.record_options.video_bitrate", &config.replay_config.record_options.video_bitrate},
{"replay.record_options.merge_audio_tracks", &config.replay_config.record_options.merge_audio_tracks},
{"replay.record_options.audio_track", &config.replay_config.record_options.audio_tracks},
{"replay.record_options.color_range", &config.replay_config.record_options.color_range},
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index dcd18cf..34988f1 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -717,6 +717,7 @@ namespace gsr {
// TODO: Validate input, fallback to valid values
const std::string fps = std::to_string(config->record_config.record_options.fps);
+ const std::string video_bitrate = std::to_string(config->record_config.record_options.video_bitrate);
const std::string output_file = config->record_config.save_directory + "/Video_" + get_date_str() + "." + container_to_file_extension(config->record_config.container.c_str());
const std::string audio_tracks_merged = merge_audio_tracks(config->record_config.record_options.audio_tracks);
const std::string framerate_mode = config->record_config.record_options.framerate_mode == "auto" ? "vfr" : config->record_config.record_options.framerate_mode;
@@ -736,6 +737,16 @@ namespace gsr {
"-o", output_file.c_str()
};
+ if(config->record_config.record_options.video_quality == "custom") {
+ args.push_back("-bm");
+ args.push_back("cbr");
+ args.push_back("-q");
+ args.push_back(video_bitrate.c_str());
+ } else {
+ args.push_back("-q");
+ args.push_back(config->record_config.record_options.video_quality.c_str());
+ }
+
if(config->record_config.record_options.record_area_option == "window" || config->record_config.record_options.record_area_option == "focused") {
args.push_back("-s");
args.push_back(region);
diff --git a/src/gui/SettingsPage.cpp b/src/gui/SettingsPage.cpp
index 751102c..2e7035b 100644
--- a/src/gui/SettingsPage.cpp
+++ b/src/gui/SettingsPage.cpp
@@ -190,22 +190,36 @@ namespace gsr {
return std::make_unique<Subsection>("Audio", std::move(audio_device_section_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f));
}
- std::unique_ptr<ComboBox> SettingsPage::create_video_quality_box() {
+ std::unique_ptr<List> SettingsPage::create_video_quality_box() {
+ auto list = std::make_unique<List>(List::Orientation::VERTICAL);
+ list->add_widget(std::make_unique<Label>(&get_theme().body_font, "Video quality:", get_theme().text_color));
+
auto video_quality_box = std::make_unique<ComboBox>(&get_theme().body_font);
+ video_quality_box->add_item("Custom (Constant bitrate)", "custom");
video_quality_box->add_item("Medium", "medium");
video_quality_box->add_item("High (Recommended for live streaming)", "high");
video_quality_box->add_item("Very high (Recommended)", "very_high");
video_quality_box->add_item("Ultra", "ultra");
video_quality_box->set_selected_item("very_high");
video_quality_box_ptr = video_quality_box.get();
- return video_quality_box;
+ list->add_widget(std::move(video_quality_box));
+
+ return list;
+ }
+
+ std::unique_ptr<Entry> SettingsPage::create_video_bitrate_entry() {
+ auto video_bitrate_entry = std::make_unique<Entry>(&get_theme().body_font, "5000", (int)(get_theme().body_font.get_character_size() * 4.0f));
+ video_bitrate_entry->validate_handler = create_entry_validator_integer_in_range(1, 100000);
+ video_bitrate_entry_ptr = video_bitrate_entry.get();
+ return video_bitrate_entry;
}
- std::unique_ptr<List> SettingsPage::create_video_quality() {
- auto video_quality_list = std::make_unique<List>(List::Orientation::VERTICAL);
- video_quality_list->add_widget(std::make_unique<Label>(&get_theme().body_font, "Video quality:", get_theme().text_color));
- video_quality_list->add_widget(create_video_quality_box());
- return video_quality_list;
+ std::unique_ptr<List> SettingsPage::create_video_bitrate() {
+ auto video_bitrate_list = std::make_unique<List>(List::Orientation::VERTICAL);
+ video_bitrate_list->add_widget(std::make_unique<Label>(&get_theme().body_font, "Video bitrate (kbps):", get_theme().text_color));
+ video_bitrate_list->add_widget(create_video_bitrate_entry());
+ video_bitrate_list_ptr = video_bitrate_list.get();
+ return video_bitrate_list;
}
std::unique_ptr<ComboBox> SettingsPage::create_color_range_box() {
@@ -226,7 +240,8 @@ namespace gsr {
std::unique_ptr<List> SettingsPage::create_video_quality_section() {
auto quality_list = std::make_unique<List>(List::Orientation::HORIZONTAL);
- quality_list->add_widget(create_video_quality());
+ quality_list->add_widget(create_video_quality_box());
+ quality_list->add_widget(create_video_bitrate());
quality_list->add_widget(create_color_range());
return quality_list;
}
@@ -370,6 +385,13 @@ namespace gsr {
restore_portal_session_list_ptr->set_visible(portal_selected);
};
+ video_quality_box_ptr->on_selection_changed = [this](const std::string &text, const std::string &id) {
+ (void)text;
+ const bool custom_selected = id == "custom";
+ video_bitrate_list_ptr->set_visible(custom_selected);
+ };
+ video_quality_box_ptr->on_selection_changed("Very high", "very_high");
+
if(!gsr_info.supported_capture_options.monitors.empty())
record_area_box_ptr->set_selected_item(gsr_info.supported_capture_options.monitors.front().name);
else if(gsr_info.supported_capture_options.portal)
@@ -690,9 +712,6 @@ namespace gsr {
void SettingsPage::load_common(RecordOptions &record_options) {
record_area_box_ptr->set_selected_item(record_options.record_area_option);
- area_width_entry_ptr->set_text(std::to_string(record_options.record_area_width));
- area_height_entry_ptr->set_text(std::to_string(record_options.record_area_height));
- framerate_entry_ptr->set_text(std::to_string(record_options.fps));
merge_audio_tracks_checkbox_ptr->set_checked(record_options.merge_audio_tracks);
load_audio_tracks(record_options);
@@ -718,6 +737,10 @@ namespace gsr {
if(record_options.fps < 1)
record_options.fps = 1;
framerate_entry_ptr->set_text(std::to_string(record_options.fps));
+
+ if(record_options.video_bitrate < 1)
+ record_options.video_bitrate = 1;
+ video_bitrate_entry_ptr->set_text(std::to_string(record_options.video_bitrate));
}
void SettingsPage::load_replay() {
@@ -767,6 +790,7 @@ namespace gsr {
record_options.record_area_width = atoi(area_width_entry_ptr->get_text().c_str());
record_options.record_area_height = atoi(area_height_entry_ptr->get_text().c_str());
record_options.fps = atoi(framerate_entry_ptr->get_text().c_str());
+ record_options.video_bitrate = atoi(video_bitrate_entry_ptr->get_text().c_str());
record_options.merge_audio_tracks = merge_audio_tracks_checkbox_ptr->is_checked();
save_audio_tracks(record_options.audio_tracks, audio_devices_list_ptr);
record_options.color_range = color_range_box_ptr->get_selected_id();
@@ -794,6 +818,11 @@ namespace gsr {
record_options.fps = 1;
framerate_entry_ptr->set_text("1");
}
+
+ if(record_options.video_bitrate < 1) {
+ record_options.video_bitrate = 1;
+ video_bitrate_entry_ptr->set_text("1");
+ }
}
void SettingsPage::save_replay() {