From 94a1dbfc5ffcef17237cfa088bb2d2a82fb0c68e Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 17 Apr 2015 02:48:06 -0700 Subject: [PATCH] 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. --- obs/window-basic-main-outputs.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/obs/window-basic-main-outputs.cpp b/obs/window-basic-main-outputs.cpp index bfea92d66..993c9f74b 100644 --- a/obs/window-basic-main-outputs.cpp +++ b/obs/window-basic-main-outputs.cpp @@ -135,6 +135,12 @@ void SimpleOutput::Update() obs_service_apply_encoder_settings(main->GetService(), 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(aac, aacSettings); @@ -381,6 +387,13 @@ void AdvancedOutput::UpdateStreamSettings() obs_service_apply_encoder_settings(main->GetService(), 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); }