fix nvidia vp9 color normalization (#1140)

This commit is contained in:
Jason Dove
2023-01-29 16:02:29 -06:00
committed by GitHub
parent 2689a67eb8
commit e497dc4e36
4 changed files with 27 additions and 18 deletions
+1
View File
@@ -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
+1
View File
@@ -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";
@@ -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");
@@ -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