From 347689e4e23e159ba0c2310cc799dc0a572dcc1d Mon Sep 17 00:00:00 2001 From: artiume Date: Fri, 29 May 2020 09:49:15 -0400 Subject: [PATCH] Split VP9 HEVC 10bit button. MacOS Decoder fixed to opencl --- .../MediaEncoding/EncodingHelper.cs | 51 +++++++++++-------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 4406c17a8..b7a78552d 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -2579,7 +2579,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (_mediaEncoder.SupportsDecoder("hevc_qsv") && encodingOptions.HardwareDecodingCodecs.Contains("hevc", StringComparer.OrdinalIgnoreCase)) { return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : "-c:v hevc_qsv"; + !encodingOptions.EnableDecodingColorDepth10Hevc) ? null : "-c:v hevc_qsv"; } break; case "mpeg2video": @@ -2604,7 +2604,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (_mediaEncoder.SupportsDecoder("vp9_qsv") && encodingOptions.HardwareDecodingCodecs.Contains("vp9", StringComparer.OrdinalIgnoreCase)) { return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : "-c:v vp9_qsv"; + !encodingOptions.EnableDecodingColorDepth10Vp9) ? null : "-c:v vp9_qsv"; } break; } @@ -2617,8 +2617,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "h264": if (_mediaEncoder.SupportsDecoder("h264_cuvid") && encodingOptions.HardwareDecodingCodecs.Contains("h264", StringComparer.OrdinalIgnoreCase)) { - return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : "-c:v h264_cuvid"; + return "-c:v h264_cuvid"; } break; case "hevc": @@ -2626,7 +2625,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (_mediaEncoder.SupportsDecoder("hevc_cuvid") && encodingOptions.HardwareDecodingCodecs.Contains("hevc", StringComparer.OrdinalIgnoreCase)) { return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : "-c:v hevc_cuvid"; + !encodingOptions.EnableDecodingColorDepth10Hevc) ? null : "-c:v hevc_cuvid"; } break; case "mpeg2video": @@ -2657,7 +2656,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (_mediaEncoder.SupportsDecoder("vp9_cuvid") && encodingOptions.HardwareDecodingCodecs.Contains("vp9", StringComparer.OrdinalIgnoreCase)) { return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : "-c:v vp9_cuvid"; + !encodingOptions.EnableDecodingColorDepth10Vp9) ? null : "-c:v vp9_cuvid"; } break; } @@ -2678,7 +2677,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (_mediaEncoder.SupportsDecoder("hevc_mediacodec") && encodingOptions.HardwareDecodingCodecs.Contains("hevc", StringComparer.OrdinalIgnoreCase)) { return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : "-c:v hevc_mediacodec"; + !encodingOptions.EnableDecodingColorDepth10Hevc) ? null : "-c:v hevc_mediacodec"; } break; case "mpeg2video": @@ -2703,7 +2702,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (_mediaEncoder.SupportsDecoder("vp9_mediacodec") && encodingOptions.HardwareDecodingCodecs.Contains("vp9", StringComparer.OrdinalIgnoreCase)) { return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : "-c:v vp9_mediacodec"; + !encodingOptions.EnableDecodingColorDepth10Vp9) ? null : "-c:v vp9_mediacodec"; } break; } @@ -2749,7 +2748,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "hevc": case "h265": return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : GetHwaccelType(state, encodingOptions, "hevc"); + !encodingOptions.EnableDecodingColorDepth10Hevc) ? null : GetHwaccelType(state, encodingOptions, "hevc"); case "mpeg2video": return GetHwaccelType(state, encodingOptions, "mpeg2video"); case "vc1": @@ -2758,7 +2757,7 @@ namespace MediaBrowser.Controller.MediaEncoding return GetHwaccelType(state, encodingOptions, "mpeg4"); case "vp9": return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : GetHwaccelType(state, encodingOptions, "vp9"); + !encodingOptions.EnableDecodingColorDepth10Vp9) ? null : GetHwaccelType(state, encodingOptions, "vp9"); } } else if (string.Equals(encodingOptions.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase)) @@ -2771,7 +2770,7 @@ namespace MediaBrowser.Controller.MediaEncoding case "hevc": case "h265": return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : GetHwaccelType(state, encodingOptions, "hevc"); + !encodingOptions.EnableDecodingColorDepth10Hevc) ? null : GetHwaccelType(state, encodingOptions, "hevc"); case "mpeg2video": return GetHwaccelType(state, encodingOptions, "mpeg2video"); case "vc1": @@ -2780,7 +2779,7 @@ namespace MediaBrowser.Controller.MediaEncoding return GetHwaccelType(state, encodingOptions, "vp8"); case "vp9": return (isColorDepth10 && - !encodingOptions.EnableDecodingColorDepth10) ? null : GetHwaccelType(state, encodingOptions, "vp9"); + !encodingOptions.EnableDecodingColorDepth10Vp9) ? null : GetHwaccelType(state, encodingOptions, "vp9"); } } else if (string.Equals(encodingOptions.HardwareAccelerationType, "videotoolbox", StringComparison.OrdinalIgnoreCase)) @@ -2789,27 +2788,39 @@ namespace MediaBrowser.Controller.MediaEncoding { case "avc": case "h264": - if (_mediaEncoder.SupportsDecoder("h264_videotoolbox") && encodingOptions.HardwareDecodingCodecs.Contains("h264", StringComparer.OrdinalIgnoreCase)) + if (_mediaEncoder.SupportsDecoder("h264_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("h264", StringComparer.OrdinalIgnoreCase)) { - return "-c:v h264_videotoolbox"; + return "-c:v h264_opencl"; } break; case "mpeg2video": - if (_mediaEncoder.SupportsDecoder("mpeg2_videotoolbox") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg2video", StringComparer.OrdinalIgnoreCase)) + if (_mediaEncoder.SupportsDecoder("mpeg2_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg2video", StringComparer.OrdinalIgnoreCase)) { - return "-c:v mpeg2_videotoolbox"; + return "-c:v mpeg2_opencl"; } break; case "mpeg4": - if (_mediaEncoder.SupportsDecoder("mpeg4_videotoolbox") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg4", StringComparer.OrdinalIgnoreCase)) + if (_mediaEncoder.SupportsDecoder("mpeg4_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg4", StringComparer.OrdinalIgnoreCase)) { - return "-c:v mpeg4_videotoolbox"; + return "-c:v mpeg4_opencl"; } break; case "vc1": - if (_mediaEncoder.SupportsDecoder("vc1_videotoolbox") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase)) + if (_mediaEncoder.SupportsDecoder("vc1_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase)) { - return "-c:v vc1_videotoolbox"; + return "-c:v vc1_opencl"; + } + break; + case "vp8": + if (_mediaEncoder.SupportsDecoder("vp8_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase)) + { + return "-c:v vp8_opencl"; + } + break; + case "vp9": + if (_mediaEncoder.SupportsDecoder("vp9_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase)) + { + return "-c:v vp9_opencl; } break; }