fix ffmpeg 4.4 compatibility
This commit is contained in:
@@ -106,7 +106,7 @@ namespace ErsatzTV.Core.Tests.FFmpeg
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_SetRealtime_ForHttpLiveStreaming()
|
||||
public void ShouldNot_SetRealtime_ForHttpLiveStreaming()
|
||||
{
|
||||
FFmpegProfile ffmpegProfile = TestProfile();
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace ErsatzTV.Core.Tests.FFmpeg
|
||||
DateTimeOffset.Now,
|
||||
DateTimeOffset.Now);
|
||||
|
||||
actual.RealtimeOutput.Should().BeTrue();
|
||||
actual.RealtimeOutput.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace ErsatzTV.Core.FFmpeg
|
||||
private string _inputCodec;
|
||||
private bool _normalizeLoudness;
|
||||
private Option<IDisplaySize> _padToSize = None;
|
||||
private bool _realtime;
|
||||
private Option<IDisplaySize> _scaleToSize = None;
|
||||
|
||||
public FFmpegComplexFilterBuilder WithHardwareAcceleration(HardwareAccelerationKind hardwareAccelerationKind)
|
||||
@@ -26,6 +27,12 @@ namespace ErsatzTV.Core.FFmpeg
|
||||
return this;
|
||||
}
|
||||
|
||||
public FFmpegComplexFilterBuilder WithRealtime(bool realtime)
|
||||
{
|
||||
_realtime = realtime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FFmpegComplexFilterBuilder WithScaling(IDisplaySize scaleToSize)
|
||||
{
|
||||
_scaleToSize = Some(scaleToSize);
|
||||
@@ -95,6 +102,11 @@ namespace ErsatzTV.Core.FFmpeg
|
||||
_audioDuration.IfSome(
|
||||
audioDuration => audioFilterQueue.Add($"apad=whole_dur={audioDuration.TotalMilliseconds}ms"));
|
||||
|
||||
if (_realtime)
|
||||
{
|
||||
videoFilterQueue.Add("realtime");
|
||||
}
|
||||
|
||||
bool usesHardwareFilters = acceleration != HardwareAccelerationKind.None && !isHardwareDecode &&
|
||||
(_deinterlace || _scaleToSize.IsSome);
|
||||
if (usesHardwareFilters)
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ErsatzTV.Core.FFmpeg
|
||||
public List<string> FormatFlags { get; set; }
|
||||
public HardwareAccelerationKind HardwareAcceleration { get; set; }
|
||||
public string VideoDecoder { get; set; }
|
||||
public bool RealtimeOutput => true;
|
||||
public bool RealtimeOutput { get; set; }
|
||||
public Option<TimeSpan> StreamSeek { get; set; }
|
||||
public Option<IDisplaySize> ScaledSize { get; set; }
|
||||
public bool PadToDesiredResolution { get; set; }
|
||||
|
||||
@@ -68,8 +68,10 @@ namespace ErsatzTV.Core.FFmpeg
|
||||
result.AudioCodec = "copy";
|
||||
result.VideoCodec = "copy";
|
||||
result.Deinterlace = false;
|
||||
result.RealtimeOutput = false;
|
||||
break;
|
||||
case StreamingMode.TransportStream:
|
||||
result.RealtimeOutput = true;
|
||||
result.HardwareAcceleration = ffmpegProfile.HardwareAcceleration;
|
||||
|
||||
if (NeedToScale(ffmpegProfile, version))
|
||||
|
||||
@@ -90,11 +90,7 @@ namespace ErsatzTV.Core.FFmpeg
|
||||
|
||||
public FFmpegProcessBuilder WithRealtimeOutput(bool realtimeOutput)
|
||||
{
|
||||
if (realtimeOutput)
|
||||
{
|
||||
_arguments.Add("-re");
|
||||
}
|
||||
|
||||
_complexFilterBuilder = _complexFilterBuilder.WithRealtime(realtimeOutput);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -393,7 +389,7 @@ namespace ErsatzTV.Core.FFmpeg
|
||||
{
|
||||
FileName = _ffmpegPath,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = false,
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
StandardOutputEncoding = Encoding.UTF8
|
||||
|
||||
Reference in New Issue
Block a user