diff --git a/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs b/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs index 5dd64c43d..f4d7e6bd2 100644 --- a/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs +++ b/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs @@ -589,15 +589,18 @@ public abstract class PipelineBuilderBase : IPipelineBuilder ? None : SetDecoder(videoInputFile, videoStream, ffmpegState, context); + Option videoStreamPixelFormat = videoStream.PixelFormat; + + // bt.2020 needs to immediately change to bt709 and a new format if (videoStream.ColorParams.IsBt2020Ten) { - videoInputFile.FilterSteps.Add( - new ColorspaceFilter( - desiredState, - videoStream, - desiredState.PixelFormat.IfNone(new PixelFormatYuv420P()))); + IPixelFormat targetFormat = desiredState.PixelFormat.IfNone(new PixelFormatYuv420P()); + + videoInputFile.FilterSteps.Add(new ColorspaceFilter(desiredState, videoStream, targetFormat)); + // update pipeline to have accurate color params and pixel format videoStream.ResetColorParams(ColorParams.Default); + videoStreamPixelFormat = Some(targetFormat); } //SetStillImageInfiniteLoop(videoInputFile, videoStream, ffmpegState); @@ -614,7 +617,7 @@ public abstract class PipelineBuilderBase : IPipelineBuilder FilterChain filterChain = SetVideoFilters( videoInputFile, - videoStream, + videoStream with { PixelFormat = videoStreamPixelFormat }, _watermarkInputFile, _subtitleInputFile, _graphicsEngineInput,