diff --git a/CHANGELOG.md b/CHANGELOG.md index ba7cac100..b0783440c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix many QSV pipeline bugs - Fix MPEG2 video format with QSV and VAAPI acceleration - Fix playback of content with undefined colorspace +- Fix NVIDIA color normalization with VP9 sources ## [0.7.3-beta] - 2023-01-25 ### Added diff --git a/ErsatzTV.FFmpeg/ColorParams.cs b/ErsatzTV.FFmpeg/ColorParams.cs index 92f58855e..ecb172f94 100644 --- a/ErsatzTV.FFmpeg/ColorParams.cs +++ b/ErsatzTV.FFmpeg/ColorParams.cs @@ -3,6 +3,7 @@ namespace ErsatzTV.FFmpeg; public record ColorParams(string ColorRange, string ColorSpace, string ColorTransfer, string ColorPrimaries) { public static readonly ColorParams Default = new("tv", "bt709", "bt709", "bt709"); + public static readonly ColorParams Unknown = new("tv", string.Empty, string.Empty, string.Empty); public bool IsHdr => ColorTransfer is "arib-std-b67" or "smpte2084"; diff --git a/ErsatzTV.FFmpeg/Pipeline/NvidiaPipelineBuilder.cs b/ErsatzTV.FFmpeg/Pipeline/NvidiaPipelineBuilder.cs index 51eb77d4d..37c15d8c2 100644 --- a/ErsatzTV.FFmpeg/Pipeline/NvidiaPipelineBuilder.cs +++ b/ErsatzTV.FFmpeg/Pipeline/NvidiaPipelineBuilder.cs @@ -266,6 +266,13 @@ public class NvidiaPipelineBuilder : SoftwarePipelineBuilder } } + // vp9 seems to lose color metadata through the ffmpeg pipeline + // clearing color params will force it to be re-added + if (videoStream.Codec == "vp9") + { + videoStream = videoStream with { ColorParams = ColorParams.Unknown }; + } + if (!videoStream.ColorParams.IsBt709) { _logger.LogDebug("Adding colorspace filter"); diff --git a/ErsatzTV.Scanner.Tests/Core/FFmpeg/TranscodingTests.cs b/ErsatzTV.Scanner.Tests/Core/FFmpeg/TranscodingTests.cs index 8ff296843..b082ec49c 100644 --- a/ErsatzTV.Scanner.Tests/Core/FFmpeg/TranscodingTests.cs +++ b/ErsatzTV.Scanner.Tests/Core/FFmpeg/TranscodingTests.cs @@ -125,27 +125,27 @@ public class TranscodingTests public static VideoScanKind[] VideoScanKinds = { VideoScanKind.Progressive, - VideoScanKind.Interlaced + // VideoScanKind.Interlaced }; public static InputFormat[] InputFormats = { - // // example format that requires colorspace filter - new("libx264", "yuv420p", "tv", "smpte170m", "bt709", "smpte170m"), - // - // // example format that requires setparams filter - new("libx264", "yuv420p", string.Empty, string.Empty, string.Empty, string.Empty), - // - // // new("libx264", "yuvj420p"), - new("libx264", "yuv420p10le"), - // // new("libx264", "yuv444p10le"), - // - // // new("mpeg1video", "yuv420p"), + // // // example format that requires colorspace filter + // new("libx264", "yuv420p", "tv", "smpte170m", "bt709", "smpte170m"), // // - // // new("mpeg2video", "yuv420p"), - // - new("libx265", "yuv420p"), - new("libx265", "yuv420p10le"), + // // // example format that requires setparams filter + // new("libx264", "yuv420p", string.Empty, string.Empty, string.Empty, string.Empty), + // // + // // // new("libx264", "yuvj420p"), + // new("libx264", "yuv420p10le"), + // // // new("libx264", "yuv444p10le"), + // // + // // // new("mpeg1video", "yuv420p"), + // // // + // // // new("mpeg2video", "yuv420p"), + // // + // new("libx265", "yuv420p"), + // new("libx265", "yuv420p10le"), // // // new("mpeg4", "yuv420p"), // // @@ -183,8 +183,8 @@ public class TranscodingTests public static HardwareAccelerationKind[] TestAccelerations = { // HardwareAccelerationKind.None, - // HardwareAccelerationKind.Nvenc, - HardwareAccelerationKind.Vaapi, + HardwareAccelerationKind.Nvenc, + // HardwareAccelerationKind.Vaapi, // HardwareAccelerationKind.Qsv, // HardwareAccelerationKind.VideoToolbox, // HardwareAccelerationKind.Amf