From aecd294fd733089e2406be1eb24fdbf3407e5190 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Thu, 5 Sep 2024 22:27:58 +0800 Subject: [PATCH] Enable the new BWDIF CUDA deint filter when available this requires jellyfin-ffmpeg7 Signed-off-by: nyanmisaka --- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 8 ++++++-- MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index a459ce8b6..27bf86edc 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -3234,14 +3234,18 @@ namespace MediaBrowser.Controller.MediaEncoding doubleRateDeint ? "1" : "0"); } - public static string GetHwDeinterlaceFilter(EncodingJobInfo state, EncodingOptions options, string hwDeintSuffix) + public string GetHwDeinterlaceFilter(EncodingJobInfo state, EncodingOptions options, string hwDeintSuffix) { var doubleRateDeint = options.DeinterlaceDoubleRate && (state.VideoStream?.AverageFrameRate ?? 60) <= 30; if (hwDeintSuffix.Contains("cuda", StringComparison.OrdinalIgnoreCase)) { + var useBwdif = string.Equals(options.DeinterlaceMethod, "bwdif", StringComparison.OrdinalIgnoreCase) + && _mediaEncoder.SupportsFilter("bwdif_cuda"); + return string.Format( CultureInfo.InvariantCulture, - "yadif_cuda={0}:-1:0", + "{0}_cuda={1}:-1:0", + useBwdif ? "bwdif" : "yadif", doubleRateDeint ? "1" : "0"); } diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 6c43be3ab..2b6ed8fa0 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -110,6 +110,7 @@ namespace MediaBrowser.MediaEncoding.Encoder // cuda "scale_cuda", "yadif_cuda", + "bwdif_cuda", "tonemap_cuda", "overlay_cuda", "transpose_cuda",