Browse Source

fix interlaced check (#2621)

* fix interlaced check

* reset any incorrect interlaced probe results
pull/2622/head
Jason Dove 2 months ago committed by GitHub
parent
commit
b9a73226a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs
  2. 3
      ErsatzTV.Core/FFmpeg/FFmpegPlaybackSettingsCalculator.cs
  3. 2
      ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs
  4. 6870
      ErsatzTV.Infrastructure.MySql/Migrations/20251110143443_Reset_InterlacedRatio.Designer.cs
  5. 21
      ErsatzTV.Infrastructure.MySql/Migrations/20251110143443_Reset_InterlacedRatio.cs
  6. 6697
      ErsatzTV.Infrastructure.Sqlite/Migrations/20251110143601_Reset_InterlacedRatio.Designer.cs
  7. 21
      ErsatzTV.Infrastructure.Sqlite/Migrations/20251110143601_Reset_InterlacedRatio.cs
  8. 16
      ErsatzTV.Infrastructure/Metadata/LocalStatisticsProvider.cs

6
ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs

@ -222,7 +222,11 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService @@ -222,7 +222,11 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
};
});
ScanKind scanKind = await ProbeScanKind(ffmpegPath, videoVersion.MediaItem, cancellationToken);
ScanKind scanKind = ScanKind.Progressive;
if (playbackSettings.Deinterlace)
{
scanKind = await ProbeScanKind(ffmpegPath, videoVersion.MediaItem, cancellationToken);
}
var ffmpegVideoStream = new VideoStream(
videoStream.Index,

3
ErsatzTV.Core/FFmpeg/FFmpegPlaybackSettingsCalculator.cs

@ -165,8 +165,7 @@ public static class FFmpegPlaybackSettingsCalculator @@ -165,8 +165,7 @@ public static class FFmpegPlaybackSettingsCalculator
result.PadAudio = true;
result.NormalizeLoudnessMode = ffmpegProfile.NormalizeLoudnessMode;
result.Deinterlace = ffmpegProfile.DeinterlaceVideo == true &&
videoVersion.VideoScanKind == VideoScanKind.Interlaced;
result.Deinterlace = ffmpegProfile.DeinterlaceVideo == true;
break;
}

2
ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs

@ -250,7 +250,7 @@ public abstract class PipelineBuilderBase : IPipelineBuilder @@ -250,7 +250,7 @@ public abstract class PipelineBuilderBase : IPipelineBuilder
_watermarkInputFile.IsSome,
_subtitleInputFile.Map(s => s is { IsImageBased: true, Method: SubtitleMethod.Burn }).IfNone(false),
_subtitleInputFile.Map(s => s is { IsImageBased: false, Method: SubtitleMethod.Burn }).IfNone(false),
desiredState.Deinterlaced,
desiredState.Deinterlaced && videoStream.ScanKind is ScanKind.Interlaced,
desiredState.BitDepth == 10,
false,
videoStream.ColorParams.IsHdr);

6870
ErsatzTV.Infrastructure.MySql/Migrations/20251110143443_Reset_InterlacedRatio.Designer.cs generated

File diff suppressed because it is too large Load Diff

21
ErsatzTV.Infrastructure.MySql/Migrations/20251110143443_Reset_InterlacedRatio.cs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.MySql.Migrations
{
/// <inheritdoc />
public partial class Reset_InterlacedRatio : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("UPDATE MediaVersion SET InterlacedRatio = null;");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

6697
ErsatzTV.Infrastructure.Sqlite/Migrations/20251110143601_Reset_InterlacedRatio.Designer.cs generated

File diff suppressed because it is too large Load Diff

21
ErsatzTV.Infrastructure.Sqlite/Migrations/20251110143601_Reset_InterlacedRatio.cs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.Sqlite.Migrations
{
/// <inheritdoc />
public partial class Reset_InterlacedRatio : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("UPDATE MediaVersion SET InterlacedRatio = null;");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

16
ErsatzTV.Infrastructure/Metadata/LocalStatisticsProvider.cs

@ -309,17 +309,21 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider @@ -309,17 +309,21 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider
var stats = new IdetStatistics();
var singleMatch = SingleFrameRegex().Match(idet.StandardOutput);
if (singleMatch.Success)
//_logger.LogDebug("StdErr: {Match}", idet.StandardError);
var singleMatch = SingleFrameRegex().Matches(idet.StandardError).LastOrDefault();
if (singleMatch?.Success == true)
{
_logger.LogDebug("Matched single frame: {Match}", singleMatch.Value);
stats.SingleTff = int.Parse(singleMatch.Groups[1].Value, NumberFormatInfo.InvariantInfo);
stats.SingleBff = int.Parse(singleMatch.Groups[2].Value, NumberFormatInfo.InvariantInfo);
stats.SingleProgressive = int.Parse(singleMatch.Groups[3].Value, NumberFormatInfo.InvariantInfo);
}
var multiMatch = MultiFrameRegex().Match(idet.StandardOutput);
if (multiMatch.Success)
var multiMatch = MultiFrameRegex().Matches(idet.StandardError).LastOrDefault();
if (multiMatch?.Success == true)
{
_logger.LogDebug("Matched multi frame: {Match}", multiMatch.Value);
stats.MultiTff = int.Parse(multiMatch.Groups[1].Value, NumberFormatInfo.InvariantInfo);
stats.MultiBff = int.Parse(multiMatch.Groups[2].Value, NumberFormatInfo.InvariantInfo);
stats.MultiProgressive = int.Parse(multiMatch.Groups[3].Value, NumberFormatInfo.InvariantInfo);
@ -699,10 +703,10 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider @@ -699,10 +703,10 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider
[GeneratedRegex(@"\[SAR\s+([0-9]+:[0-9]+)\s+DAR\s+([0-9]+:[0-9]+)\]")]
private static partial Regex SarDarRegex();
[GeneratedRegex(@"Single frame detection: TFF: (\d+) BFF: (\d+) Progressive: (\d+)")]
[GeneratedRegex(@"Single frame detection: TFF:\s+(\d+) BFF:\s+(\d+) Progressive:\s+(\d+)")]
private static partial Regex SingleFrameRegex();
[GeneratedRegex(@"Multi frame detection: TFF: (\d+) BFF: (\d+) Progressive: (\d+)")]
[GeneratedRegex(@"Multi frame detection: TFF:\s+(\d+) BFF:\s+(\d+) Progressive:\s+(\d+)")]
private static partial Regex MultiFrameRegex();
private class IdetStatistics

Loading…
Cancel
Save