From 2c54390c38e6ecd061645713c5f690e3f9b3ccf2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 10 Jun 2017 14:24:53 -0400 Subject: [PATCH] enable h264_cuvid decoder --- .../MediaEncoding/EncodingHelper.cs | 14 ++++++++++++++ .../Encoder/EncoderValidator.cs | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index f790bb1a17..c348ffda72 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1806,6 +1806,20 @@ namespace MediaBrowser.Controller.MediaEncoding break; } } + + else if (string.Equals(encodingOptions.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase)) + { + switch (state.MediaSource.VideoStream.Codec.ToLower()) + { + case "avc": + case "h264": + if (_mediaEncoder.SupportsDecoder("h264_cuvid")) + { + return "-c:v h264_cuvid "; + } + break; + } + } } // leave blank so ffmpeg will decide diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 27f66835f5..43e463902d 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -90,7 +90,8 @@ namespace MediaBrowser.MediaEncoding.Encoder "h264_qsv", "hevc_qsv", "mpeg2_qsv", - "vc1_qsv" + "vc1_qsv", + "h264_cuvid" }; foreach (var codec in required)