normalize video track timescale (#123)

This commit is contained in:
Jason Dove
2021-03-31 23:36:20 +00:00
committed by GitHub
parent 9e6de7e2eb
commit da3e05b231
4 changed files with 15 additions and 1 deletions
@@ -27,5 +27,6 @@ namespace ErsatzTV.Core.FFmpeg
public string AudioCodec { get; set; } public string AudioCodec { get; set; }
public bool Deinterlace { get; set; } public bool Deinterlace { get; set; }
public Option<string> FrameRate { get; set; } public Option<string> FrameRate { get; set; }
public Option<int> VideoTrackTimeScale { get; set; }
} }
} }
@@ -91,6 +91,8 @@ namespace ErsatzTV.Core.FFmpeg
result.FrameRate = string.IsNullOrWhiteSpace(ffmpegProfile.FrameRate) result.FrameRate = string.IsNullOrWhiteSpace(ffmpegProfile.FrameRate)
? None ? None
: Some(ffmpegProfile.FrameRate); : Some(ffmpegProfile.FrameRate);
result.VideoTrackTimeScale = 90000;
} }
if (result.ScaledSize.IsSome || result.PadToDesiredResolution || if (result.ScaledSize.IsSome || result.PadToDesiredResolution ||
@@ -330,6 +330,16 @@ namespace ErsatzTV.Core.FFmpeg
return this; return this;
} }
public FFmpegProcessBuilder WithVideoTrackTimeScale(Option<int> videoTrackTimeScale)
{
videoTrackTimeScale.IfSome(timeScale =>
{
_arguments.Add("-video_track_timescale");
_arguments.Add($"{timeScale}");
});
return this;
}
public FFmpegProcessBuilder WithDeinterlace(bool deinterlace) public FFmpegProcessBuilder WithDeinterlace(bool deinterlace)
{ {
_complexFilterBuilder = _complexFilterBuilder.WithDeinterlace(deinterlace); _complexFilterBuilder = _complexFilterBuilder.WithDeinterlace(deinterlace);
+2 -1
View File
@@ -49,7 +49,8 @@ namespace ErsatzTV.Core.FFmpeg
.WithRealtimeOutput(playbackSettings.RealtimeOutput) .WithRealtimeOutput(playbackSettings.RealtimeOutput)
.WithSeek(playbackSettings.StreamSeek) .WithSeek(playbackSettings.StreamSeek)
.WithInputCodec(path, playbackSettings.HardwareAcceleration, videoStream.Codec) .WithInputCodec(path, playbackSettings.HardwareAcceleration, videoStream.Codec)
.WithFrameRate(playbackSettings.FrameRate); .WithFrameRate(playbackSettings.FrameRate)
.WithVideoTrackTimeScale(playbackSettings.VideoTrackTimeScale);
playbackSettings.ScaledSize.Match( playbackSettings.ScaledSize.Match(
scaledSize => scaledSize =>