Selaa lähdekoodia

UI: Ensure NV12/I420 format for streaming encoder

Due to the fact that flash cannot decode formats such as YUV 4:4:4, do
not allow the streaming encoders to use formats other than NV12/I420.
jp9000 10 vuotta sitten
vanhempi
sitoutus
94a1dbfc5f
1 muutettua tiedostoa jossa 13 lisäystä ja 0 poistoa
  1. 13 0
      obs/window-basic-main-outputs.cpp

+ 13 - 0
obs/window-basic-main-outputs.cpp

@@ -135,6 +135,12 @@ void SimpleOutput::Update()
 	obs_service_apply_encoder_settings(main->GetService(),
 	obs_service_apply_encoder_settings(main->GetService(),
 			h264Settings, aacSettings);
 			h264Settings, aacSettings);
 
 
+	video_t *video = obs_get_video();
+	enum video_format format = video_output_get_format(video);
+
+	if (format != VIDEO_FORMAT_NV12 && format != VIDEO_FORMAT_I420)
+		obs_encoder_set_preferred_video_format(h264, VIDEO_FORMAT_NV12);
+
 	obs_encoder_update(h264, h264Settings);
 	obs_encoder_update(h264, h264Settings);
 	obs_encoder_update(aac,  aacSettings);
 	obs_encoder_update(aac,  aacSettings);
 
 
@@ -381,6 +387,13 @@ void AdvancedOutput::UpdateStreamSettings()
 		obs_service_apply_encoder_settings(main->GetService(),
 		obs_service_apply_encoder_settings(main->GetService(),
 				settings, nullptr);
 				settings, nullptr);
 
 
+	video_t *video = obs_get_video();
+	enum video_format format = video_output_get_format(video);
+
+	if (format != VIDEO_FORMAT_NV12 && format != VIDEO_FORMAT_I420)
+		obs_encoder_set_preferred_video_format(h264Streaming,
+				VIDEO_FORMAT_NV12);
+
 	obs_encoder_update(h264Streaming, settings);
 	obs_encoder_update(h264Streaming, settings);
 }
 }