Browse Source

fix color normalization from bt470bg to bt709 (#1217)

pull/1218/head
Jason Dove 2 years ago committed by GitHub
parent
commit
80d89a2530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 1
      ErsatzTV.FFmpeg/ColorParams.cs
  3. 14
      ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs

1
CHANGELOG.md

@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Tail mode filler will properly include filler duration in XMLTV
- Duration that wraps across midnight will no longer have overlapping items in XMLTV
- Maintain collection progress across all alternate schedules on a playout
- Fix color normalization from `bt470bg` to `bt709`
### Changed
- Ignore case of video and audio file extensions in local folder scanner

1
ErsatzTV.FFmpeg/ColorParams.cs

@ -3,6 +3,7 @@ namespace ErsatzTV.FFmpeg; @@ -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 Bt470Bg = new("tv", "bt470bg", "bt470bg", "bt470bg");
public static readonly ColorParams Unknown = new("tv", string.Empty, string.Empty, string.Empty);
public bool IsHdr => ColorTransfer is "arib-std-b67" or "smpte2084";

14
ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs

@ -54,8 +54,20 @@ public class ColorspaceFilter : BaseFilter @@ -54,8 +54,20 @@ public class ColorspaceFilter : BaseFilter
}
}
string inputOverrides = string.Empty;
ColorParams cp = _videoStream.ColorParams;
// bt470bg => bt709 seems to work correctly with `colormatrix` and NOT with `colorspace`
if (cp == ColorParams.Bt470Bg)
{
return _desiredPixelFormat.BitDepth switch
{
10 => $"{hwdownload}colormatrix=dst=bt709,format=yuv420p10",
8 => $"{hwdownload}colormatrix=dst=bt709,format=yuv420p",
_ => string.Empty
};
}
string inputOverrides = string.Empty;
if (cp.IsMixed || _forceInputOverrides)
{
string range = string.IsNullOrWhiteSpace(cp.ColorRange) ? "tv" : cp.ColorRange;

Loading…
Cancel
Save