Browse Source

fix colorspace filter for some files with invalid color metadata (#1254)

pull/1256/head
Jason Dove 3 years ago committed by GitHub
parent
commit
6bb1c4299f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 8
      ErsatzTV.Application/MediaItems/MediaItemInfoStream.cs
  3. 8
      ErsatzTV.Application/MediaItems/Queries/GetMediaItemInfoHandler.cs
  4. 9
      ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs

1
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 - Maintain watermark alpha channel (built-in transparency) using QSV acceleration
- Properly extract and burn in embedded text subtitles using Jellyfin, Emby and Plex libraries - 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 bug where deleting a channel would not remove its data from XMLTV
- Fix colorspace filter for some files with invalid color metadata
### Changed ### Changed
- Remove duplicate items from smart collections before scheduling - Remove duplicate items from smart collections before scheduling

8
ErsatzTV.Application/MediaItems/MediaItemInfoStream.cs

@ -10,14 +10,14 @@ public record MediaItemInfoStream(
string Profile, string Profile,
string Language, string Language,
int? Channels, int? Channels,
bool Default, bool? Default,
bool Forced, bool? Forced,
bool AttachedPic, bool? AttachedPic,
string PixelFormat, string PixelFormat,
string ColorRange, string ColorRange,
string ColorSpace, string ColorSpace,
string ColorTransfer, string ColorTransfer,
string ColorPrimaries, string ColorPrimaries,
int BitsPerRawSample, int? BitsPerRawSample,
string FileName, string FileName,
string MimeType); string MimeType);

8
ErsatzTV.Application/MediaItems/Queries/GetMediaItemInfoHandler.cs

@ -83,15 +83,15 @@ public class GetMediaItemInfoHandler : IRequestHandler<GetMediaItemInfo, Either<
mediaStream.Profile, mediaStream.Profile,
mediaStream.Language, mediaStream.Language,
mediaStream.Channels > 0 ? mediaStream.Channels : null, mediaStream.Channels > 0 ? mediaStream.Channels : null,
mediaStream.Default, mediaStream.Default ? true : null,
mediaStream.Forced, mediaStream.Forced ? true : null,
mediaStream.AttachedPic, mediaStream.AttachedPic ? true : null,
mediaStream.PixelFormat, mediaStream.PixelFormat,
mediaStream.ColorRange, mediaStream.ColorRange,
mediaStream.ColorSpace, mediaStream.ColorSpace,
mediaStream.ColorTransfer, mediaStream.ColorTransfer,
mediaStream.ColorPrimaries, mediaStream.ColorPrimaries,
mediaStream.BitsPerRawSample, mediaStream.BitsPerRawSample > 0 ? mediaStream.BitsPerRawSample : null,
mediaStream.FileName, mediaStream.FileName,
mediaStream.MimeType); mediaStream.MimeType);
} }

9
ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs

@ -82,13 +82,16 @@ public class ColorspaceFilter : BaseFilter
if (cp.IsMixed || _forceInputOverrides) if (cp.IsMixed || _forceInputOverrides)
{ {
string range = string.IsNullOrWhiteSpace(cp.ColorRange) ? "tv" : cp.ColorRange; 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" ? "bt709"
: cp.ColorTransfer; : cp.ColorTransfer;
string primaries = string.IsNullOrWhiteSpace(cp.ColorPrimaries)
string primaries = string.IsNullOrWhiteSpace(cp.ColorPrimaries) || string.Equals(cp.ColorPrimaries, "reserved", StringComparison.OrdinalIgnoreCase)
? "bt709" ? "bt709"
: cp.ColorPrimaries; : cp.ColorPrimaries;
string space = string.IsNullOrWhiteSpace(cp.ColorSpace)
string space = string.IsNullOrWhiteSpace(cp.ColorSpace) || string.Equals(cp.ColorSpace, "reserved", StringComparison.OrdinalIgnoreCase)
? "bt709" ? "bt709"
: cp.ColorSpace; : cp.ColorSpace;

Loading…
Cancel
Save