diff options
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 18 |
2 files changed, 27 insertions, 16 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index fdca28390..5f0779dc7 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -69,6 +69,7 @@ namespace MediaBrowser.MediaEncoding.Encoder "aac_at", "libfdk_aac", "ac3", + "alac", "dca", "libmp3lame", "libopus", @@ -128,6 +129,9 @@ namespace MediaBrowser.MediaEncoding.Encoder "overlay_vulkan", // videotoolbox "yadif_videotoolbox", + "scale_vt", + "overlay_videotoolbox", + "tonemap_videotoolbox", // rkrga "scale_rkrga", "vpp_rkrga", @@ -144,17 +148,18 @@ namespace MediaBrowser.MediaEncoding.Encoder { 5, new string[] { "overlay_vulkan", "Action to take when encountering EOF from secondary input" } } }; - // These are the library versions that corresponds to our minimum ffmpeg version 4.x according to the version table below + // These are the library versions that corresponds to our minimum ffmpeg version 4.4 according to the version table below + // Refers to the versions in https://ffmpeg.org/download.html private static readonly Dictionary<string, Version> _ffmpegMinimumLibraryVersions = new Dictionary<string, Version> { - { "libavutil", new Version(56, 14) }, - { "libavcodec", new Version(58, 18) }, - { "libavformat", new Version(58, 12) }, - { "libavdevice", new Version(58, 3) }, - { "libavfilter", new Version(7, 16) }, - { "libswscale", new Version(5, 1) }, - { "libswresample", new Version(3, 1) }, - { "libpostproc", new Version(55, 1) } + { "libavutil", new Version(56, 70) }, + { "libavcodec", new Version(58, 134) }, + { "libavformat", new Version(58, 76) }, + { "libavdevice", new Version(58, 13) }, + { "libavfilter", new Version(7, 110) }, + { "libswscale", new Version(5, 9) }, + { "libswresample", new Version(3, 9) }, + { "libpostproc", new Version(55, 9) } }; private readonly ILogger _logger; @@ -174,7 +179,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } // When changing this, also change the minimum library versions in _ffmpegMinimumLibraryVersions - public static Version MinVersion { get; } = new Version(4, 0); + public static Version MinVersion { get; } = new Version(4, 4); public static Version? MaxVersion { get; } = null; diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index cc6971c1b..807678025 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -154,12 +154,12 @@ namespace MediaBrowser.MediaEncoding.Encoder /// </summary> public void SetFFmpegPath() { - // 1) Custom path stored in config/encoding xml file under tag <EncoderAppPath> takes precedence - var ffmpegPath = _configurationManager.GetEncodingOptions().EncoderAppPath; + // 1) Check if the --ffmpeg CLI switch has been given + var ffmpegPath = _startupOptionFFmpegPath; if (string.IsNullOrEmpty(ffmpegPath)) { - // 2) Check if the --ffmpeg CLI switch has been given - ffmpegPath = _startupOptionFFmpegPath; + // 2) Custom path stored in config/encoding xml file under tag <EncoderAppPath> should be used as a fallback + ffmpegPath = _configurationManager.GetEncodingOptions().EncoderAppPath; if (string.IsNullOrEmpty(ffmpegPath)) { // 3) Check "ffmpeg" @@ -463,6 +463,11 @@ namespace MediaBrowser.MediaEncoding.Encoder extraArgs += " -user_agent " + userAgent; } + if (request.MediaSource.Protocol == MediaProtocol.Rtsp) + { + extraArgs += " -rtsp_transport tcp+udp -rtsp_flags prefer_tcp"; + } + return extraArgs; } @@ -691,7 +696,7 @@ namespace MediaBrowser.MediaEncoding.Encoder Video3DFormat.HalfTopAndBottom => @"crop=iw:ih/2:0:0,scale=(iw*2):ih),setdar=dar=a,crop=min(iw\,ih*dar):min(ih\,iw/dar):(iw-min(iw\,iw*sar))/2:(ih - min (ih\,ih/sar))/2,setsar=sar=1", // ftab crop height in half, set the display aspect,crop out any black bars we may have made Video3DFormat.FullTopAndBottom => @"crop=iw:ih/2:0:0,setdar=dar=a,crop=min(iw\,ih*dar):min(ih\,iw/dar):(iw-min(iw\,iw*sar))/2:(ih - min (ih\,ih/sar))/2,setsar=sar=1", - _ => "scale=trunc(iw*sar):ih" + _ => "scale=round(iw*sar/2)*2:round(ih/2)*2" }; filters.Add(scaler); @@ -800,6 +805,7 @@ namespace MediaBrowser.MediaEncoding.Encoder int maxWidth, TimeSpan interval, bool allowHwAccel, + bool enableHwEncoding, int? threads, int? qualityScale, ProcessPriorityClass? priority, @@ -828,7 +834,7 @@ namespace MediaBrowser.MediaEncoding.Encoder MediaPath = inputFile, OutputVideoCodec = "mjpeg" }; - var vidEncoder = options.AllowMjpegEncoding ? encodingHelper.GetVideoEncoder(jobState, options) : jobState.OutputVideoCodec; + var vidEncoder = enableHwEncoding ? encodingHelper.GetVideoEncoder(jobState, options) : jobState.OutputVideoCodec; // Get input and filter arguments var inputArg = encodingHelper.GetInputArgument(jobState, options, container).Trim(); |
