Browse Source

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

pull/1256/head
Jason Dove 2 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/). @@ -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

8
ErsatzTV.Application/MediaItems/MediaItemInfoStream.cs

@ -10,14 +10,14 @@ public record MediaItemInfoStream( @@ -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);

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

@ -83,15 +83,15 @@ public class GetMediaItemInfoHandler : IRequestHandler<GetMediaItemInfo, Either< @@ -83,15 +83,15 @@ public class GetMediaItemInfoHandler : IRequestHandler<GetMediaItemInfo, Either<
mediaStream.Profile,
mediaStream.Language,
mediaStream.Channels > 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);
}

9
ErsatzTV.FFmpeg/Filter/ColorspaceFilter.cs

@ -82,13 +82,16 @@ public class ColorspaceFilter : BaseFilter @@ -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;

Loading…
Cancel
Save