Browse Source

ffmpeg 4.4 llvm nvidia fixes (#415)

pull/416/head
Jason Dove 5 years ago committed by GitHub
parent
commit
2a5edf8214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ErsatzTV.Core.Tests/FFmpeg/TranscodingTests.cs
  2. 18
      ErsatzTV.Core/FFmpeg/FFmpegPlaybackSettingsCalculator.cs
  3. 13
      ErsatzTV.Core/FFmpeg/FFmpegProcessBuilder.cs
  4. 2
      ErsatzTV.Core/FFmpeg/FFmpegProcessService.cs

6
ErsatzTV.Core.Tests/FFmpeg/TranscodingTests.cs

@ -128,6 +128,8 @@ namespace ErsatzTV.Core.Tests.FFmpeg @@ -128,6 +128,8 @@ namespace ErsatzTV.Core.Tests.FFmpeg
p1.Start();
await p1.WaitForExitAsync();
// ReSharper disable once MethodHasAsyncOverload
p1.WaitForExit();
p1.ExitCode.Should().Be(0);
}
@ -192,9 +194,11 @@ namespace ErsatzTV.Core.Tests.FFmpeg @@ -192,9 +194,11 @@ namespace ErsatzTV.Core.Tests.FFmpeg
process.Start().Should().BeTrue();
await process.StandardOutput.ReadToEndAsync();
process.BeginOutputReadLine();
string error = await process.StandardError.ReadToEndAsync();
await process.WaitForExitAsync();
// ReSharper disable once MethodHasAsyncOverload
process.WaitForExit();
string[] unsupportedMessages =
{

18
ErsatzTV.Core/FFmpeg/FFmpegPlaybackSettingsCalculator.cs

@ -102,6 +102,24 @@ namespace ErsatzTV.Core.FFmpeg @@ -102,6 +102,24 @@ namespace ErsatzTV.Core.FFmpeg
result.VideoCodec = ffmpegProfile.VideoCodec;
result.VideoBitrate = ffmpegProfile.VideoBitrate;
result.VideoBufferSize = ffmpegProfile.VideoBufferSize;
result.VideoDecoder =
(result.HardwareAcceleration, videoStream.Codec, videoStream.PixelFormat) switch
{
(HardwareAccelerationKind.Nvenc, "h264", "yuv420p10le" or "yuv444p10le") => "h264",
(HardwareAccelerationKind.Nvenc, "hevc", "yuv420p10le" or "yuv444p10le") => "hevc",
(HardwareAccelerationKind.Nvenc, "mpeg2video", "yuv420p10le" or "yuv444p10le") =>
"mpeg2",
(HardwareAccelerationKind.Nvenc, "mpeg4", "yuv420p10le" or "yuv444p10le") => "mpeg4",
(HardwareAccelerationKind.Nvenc, "h264", _) => "h264_cuvid",
(HardwareAccelerationKind.Nvenc, "hevc", _) => "hevc_cuvid",
(HardwareAccelerationKind.Nvenc, "mpeg2video", _) => "mpeg2_cuvid",
(HardwareAccelerationKind.Nvenc, "mpeg4", _) => "mpeg4_cuvid",
(HardwareAccelerationKind.Qsv, "h264", _) => "h264_qsv",
(HardwareAccelerationKind.Qsv, "hevc", _) => "hevc_qsv",
(HardwareAccelerationKind.Qsv, "mpeg2video", _) => "mpeg2_qsv",
_ => null
};
}
else
{

13
ErsatzTV.Core/FFmpeg/FFmpegProcessBuilder.cs

@ -32,13 +32,6 @@ namespace ErsatzTV.Core.FFmpeg @@ -32,13 +32,6 @@ namespace ErsatzTV.Core.FFmpeg
{
internal class FFmpegProcessBuilder
{
private static readonly Dictionary<string, string> QsvMap = new()
{
{ "h264", "h264_qsv" },
{ "hevc", "hevc_qsv" },
{ "mpeg2video", "mpeg2_qsv" }
};
private readonly List<string> _arguments = new();
private readonly string _ffmpegPath;
private readonly bool _saveReports;
@ -208,12 +201,12 @@ namespace ErsatzTV.Core.FFmpeg @@ -208,12 +201,12 @@ namespace ErsatzTV.Core.FFmpeg
return this;
}
public FFmpegProcessBuilder WithInputCodec(string input, HardwareAccelerationKind hwAccel, string codec, string pixelFormat)
public FFmpegProcessBuilder WithInputCodec(string input, string decoder, string codec, string pixelFormat)
{
if (hwAccel == HardwareAccelerationKind.Qsv && QsvMap.TryGetValue(codec, out string qsvCodec))
if (!string.IsNullOrWhiteSpace(decoder))
{
_arguments.Add("-c:v");
_arguments.Add(qsvCodec);
_arguments.Add(decoder);
}
_complexFilterBuilder = _complexFilterBuilder

2
ErsatzTV.Core/FFmpeg/FFmpegProcessService.cs

@ -70,7 +70,7 @@ namespace ErsatzTV.Core.FFmpeg @@ -70,7 +70,7 @@ namespace ErsatzTV.Core.FFmpeg
.WithFormatFlags(playbackSettings.FormatFlags)
.WithRealtimeOutput(playbackSettings.RealtimeOutput)
.WithSeek(playbackSettings.StreamSeek)
.WithInputCodec(path, playbackSettings.HardwareAcceleration, videoStream.Codec, videoStream.PixelFormat)
.WithInputCodec(path, playbackSettings.VideoDecoder, videoStream.Codec, videoStream.PixelFormat)
.WithWatermark(maybeWatermark, maybeWatermarkPath, channel.FFmpegProfile.Resolution, isAnimated)
.WithVideoTrackTimeScale(playbackSettings.VideoTrackTimeScale)
.WithAlignedAudio(playbackSettings.AudioDuration)

Loading…
Cancel
Save