diff --git a/CHANGELOG.md b/CHANGELOG.md index fb7206303..d4c30495f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Maintain watermark alpha channel (built-in transparency) using QSV acceleration - Properly extract and burn in embedded text subtitles using Jellyfin, Emby and Plex libraries - Fix bug where deleting a channel would not remove its data from XMLTV +- Fix colorspace filter for some files with invalid color metadata ### Changed - Remove duplicate items from smart collections before scheduling diff --git a/ErsatzTV.Application/MediaItems/MediaItemInfoStream.cs b/ErsatzTV.Application/MediaItems/MediaItemInfoStream.cs index 819700dbd..f48daa005 100644 --- a/ErsatzTV.Application/MediaItems/MediaItemInfoStream.cs +++ b/ErsatzTV.Application/MediaItems/MediaItemInfoStream.cs @@ -10,14 +10,14 @@ public record MediaItemInfoStream( string Profile, string Language, int? Channels, - bool Default, - bool Forced, - bool AttachedPic, + bool? Default, + bool? Forced, + bool? AttachedPic, string PixelFormat, string ColorRange, string ColorSpace, string ColorTransfer, string ColorPrimaries, - int BitsPerRawSample, + int? BitsPerRawSample, string FileName, string MimeType); diff --git a/ErsatzTV.Application/MediaItems/Queries/GetMediaItemInfoHandler.cs b/ErsatzTV.Application/MediaItems/Queries/GetMediaItemInfoHandler.cs index 98b95089e..27d2a2abc 100644 --- a/ErsatzTV.Application/MediaItems/Queries/GetMediaItemInfoHandler.cs +++ b/ErsatzTV.Application/MediaItems/Queries/GetMediaItemInfoHandler.cs @@ -83,15 +83,15 @@ public class GetMediaItemInfoHandler : IRequestHandler 0 ? mediaStream.Channels : null, - mediaStream.Default, - mediaStream.Forced, - mediaStream.AttachedPic, + mediaStream.Default ? true : null, + mediaStream.Forced ? true : null, + mediaStream.AttachedPic ? true : null, mediaStream.PixelFormat, mediaStream.ColorRange, mediaStream.ColorSpace, mediaStream.ColorTransfer, mediaStream.ColorPrimaries, - mediaStream.BitsPerRawSample, + mediaStream.BitsPerRawSample > 0 ? mediaStream.BitsPerRawSample : null, mediaStream.FileName, mediaStream.MimeType); } diff --git a/ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs b/ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs index ea0a1cb6f..8ef290f0e 100644 --- a/ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs +++ b/ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs @@ -82,13 +82,16 @@ public class ColorspaceFilter : BaseFilter if (cp.IsMixed || _forceInputOverrides) { string range = string.IsNullOrWhiteSpace(cp.ColorRange) ? "tv" : cp.ColorRange; - string transfer = string.IsNullOrWhiteSpace(cp.ColorTransfer) + + string transfer = string.IsNullOrWhiteSpace(cp.ColorTransfer) || string.Equals(cp.ColorTransfer, "reserved", StringComparison.OrdinalIgnoreCase) ? "bt709" : cp.ColorTransfer; - string primaries = string.IsNullOrWhiteSpace(cp.ColorPrimaries) + + string primaries = string.IsNullOrWhiteSpace(cp.ColorPrimaries) || string.Equals(cp.ColorPrimaries, "reserved", StringComparison.OrdinalIgnoreCase) ? "bt709" : cp.ColorPrimaries; - string space = string.IsNullOrWhiteSpace(cp.ColorSpace) + + string space = string.IsNullOrWhiteSpace(cp.ColorSpace) || string.Equals(cp.ColorSpace, "reserved", StringComparison.OrdinalIgnoreCase) ? "bt709" : cp.ColorSpace;