Browse Source

UI: Allow overriding keyframe interval if smaller

Allows the ability to override the default keyframe interval via
advanced output mode as long as that interval is smaller than the
recommended keyframe interval.

Fixes an issue where it was impossible to set a lower keyframe interval
than the recommended keyframe interval.
jp9000 4 years ago
parent
commit
8f97e32227
1 changed files with 6 additions and 0 deletions
  1. 6 0
      UI/window-basic-main-outputs.cpp

+ 6 - 0
UI/window-basic-main-outputs.cpp

@@ -1343,10 +1343,16 @@ void AdvancedOutput::UpdateStreamSettings()
 
 	if (applyServiceSettings) {
 		int bitrate = (int)obs_data_get_int(settings, "bitrate");
+		int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec");
 		obs_service_apply_encoder_settings(main->GetService(), settings,
 						   nullptr);
 		if (!enforceBitrate)
 			obs_data_set_int(settings, "bitrate", bitrate);
+
+		int enforced_keyint_sec =
+			(int)obs_data_get_int(settings, "keyint_sec");
+		if (keyint_sec != 0 && keyint_sec < enforced_keyint_sec)
+			obs_data_set_int(settings, "keyint_sec", keyint_sec);
 	}
 
 	if (dynBitrate && astrcmpi(streamEncoder, "jim_nvenc") == 0)