more nvidia fixes (#661)

* dont use mpeg2_cuvid with interlaced content

* fix nvidia scaling when padding is not needed
This commit is contained in:
Jason Dove
2022-02-28 18:35:49 -06:00
committed by GitHub
parent 6b0ced6be9
commit f8412c4f5c
2 changed files with 11 additions and 1 deletions
@@ -23,6 +23,10 @@ public static class AvailableDecoders
(HardwareAccelerationMode.Nvenc, VideoFormat.H264, PixelFormat.YUV420P10LE or PixelFormat.YUV444P10LE)
=> new DecoderH264(),
// mpeg2_cuvid seems to have issues when yadif_cuda is used, so just use software decoding
(HardwareAccelerationMode.Nvenc, VideoFormat.Mpeg2Video, _) when desiredState.Deinterlaced =>
new DecoderMpeg2Video(),
(HardwareAccelerationMode.Nvenc, VideoFormat.H264, _) => new DecoderH264Cuvid(),
(HardwareAccelerationMode.Nvenc, VideoFormat.Mpeg2Video, _) => new DecoderMpeg2Cuvid(
desiredState.Deinterlaced),
@@ -37,7 +37,13 @@ public class ScaleCudaFilter : BaseFilter
format = $":format={pixelFormat.FFmpegName}";
}
scale = $"scale_cuda={targetSize}:force_original_aspect_ratio=1{format}";
string aspectRatio = string.Empty;
if (_scaledSize != _paddedSize)
{
aspectRatio = ":force_original_aspect_ratio=1";
}
scale = $"scale_cuda={targetSize}{aspectRatio}{format}";
}
// TODO: this might not always upload to hardware, so NextState could be inaccurate