Browse Source

fix nvidia vp9 color normalization (#1140)

pull/1141/head
Jason Dove 4 years ago committed by GitHub
parent
commit
e497dc4e36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 1
      ErsatzTV.FFmpeg/ColorParams.cs
  3. 7
      ErsatzTV.FFmpeg/Pipeline/NvidiaPipelineBuilder.cs
  4. 36
      ErsatzTV.Scanner.Tests/Core/FFmpeg/TranscodingTests.cs

1
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 many QSV pipeline bugs
- Fix MPEG2 video format with QSV and VAAPI acceleration - Fix MPEG2 video format with QSV and VAAPI acceleration
- Fix playback of content with undefined colorspace - Fix playback of content with undefined colorspace
- Fix NVIDIA color normalization with VP9 sources
## [0.7.3-beta] - 2023-01-25 ## [0.7.3-beta] - 2023-01-25
### Added ### Added

1
ErsatzTV.FFmpeg/ColorParams.cs

@ -3,6 +3,7 @@ namespace ErsatzTV.FFmpeg;
public record ColorParams(string ColorRange, string ColorSpace, string ColorTransfer, string ColorPrimaries) 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 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"; public bool IsHdr => ColorTransfer is "arib-std-b67" or "smpte2084";

7
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) if (!videoStream.ColorParams.IsBt709)
{ {
_logger.LogDebug("Adding colorspace filter"); _logger.LogDebug("Adding colorspace filter");

36
ErsatzTV.Scanner.Tests/Core/FFmpeg/TranscodingTests.cs

@ -125,27 +125,27 @@ public class TranscodingTests
public static VideoScanKind[] VideoScanKinds = public static VideoScanKind[] VideoScanKinds =
{ {
VideoScanKind.Progressive, VideoScanKind.Progressive,
VideoScanKind.Interlaced // VideoScanKind.Interlaced
}; };
public static InputFormat[] InputFormats = public static InputFormat[] InputFormats =
{ {
// // example format that requires colorspace filter // // // example format that requires colorspace filter
new("libx264", "yuv420p", "tv", "smpte170m", "bt709", "smpte170m"), // 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"),
// // // //
// // new("mpeg2video", "yuv420p"), // // // example format that requires setparams filter
// // new("libx264", "yuv420p", string.Empty, string.Empty, string.Empty, string.Empty),
new("libx265", "yuv420p"), // //
new("libx265", "yuv420p10le"), // // // new("libx264", "yuvj420p"),
// new("libx264", "yuv420p10le"),
// // // new("libx264", "yuv444p10le"),
// //
// // // new("mpeg1video", "yuv420p"),
// // //
// // // new("mpeg2video", "yuv420p"),
// //
// new("libx265", "yuv420p"),
// new("libx265", "yuv420p10le"),
// //
// // new("mpeg4", "yuv420p"), // // new("mpeg4", "yuv420p"),
// // // //
@ -183,8 +183,8 @@ public class TranscodingTests
public static HardwareAccelerationKind[] TestAccelerations = public static HardwareAccelerationKind[] TestAccelerations =
{ {
// HardwareAccelerationKind.None, // HardwareAccelerationKind.None,
// HardwareAccelerationKind.Nvenc, HardwareAccelerationKind.Nvenc,
HardwareAccelerationKind.Vaapi, // HardwareAccelerationKind.Vaapi,
// HardwareAccelerationKind.Qsv, // HardwareAccelerationKind.Qsv,
// HardwareAccelerationKind.VideoToolbox, // HardwareAccelerationKind.VideoToolbox,
// HardwareAccelerationKind.Amf // HardwareAccelerationKind.Amf

Loading…
Cancel
Save