From 8dc58e8f04ca891aa8e515c369f14ecbb21d2191 Mon Sep 17 00:00:00 2001 From: null <9310d27e@gmail.com> Date: Sun, 20 Aug 2023 21:18:55 +0400 Subject: [PATCH 1/2] Added handling of FFmpeg:probesize variable --- CONTRIBUTORS.md | 1 + .../MediaEncoding/EncodingHelper.cs | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index b7e7778176..e3af12a497 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -238,3 +238,4 @@ - [Jakob Kukla](https://github.com/jakobkukla) - [Utku Ă–zdemir](https://github.com/utkuozdemir) - [JPUC1143](https://github.com/Jpuc1143/) + - [0x25CBFC4F](https://github.com/0x25CBFC4F) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index d61430b0bc..f8d2dd40fd 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -5678,7 +5678,6 @@ namespace MediaBrowser.Controller.MediaEncoding // Apply -analyzeduration as per the environment variable, // otherwise ffmpeg will break on certain files due to default value is 0. - // The default value of -probesize is more than enough, so leave it as is. var ffmpegAnalyzeDuration = _config.GetFFmpegAnalyzeDuration() ?? string.Empty; if (state.MediaSource.AnalyzeDurationMs > 0) @@ -5697,6 +5696,22 @@ namespace MediaBrowser.Controller.MediaEncoding inputModifier = inputModifier.Trim(); + // Apply -probesize if configured + var probeSizeArgument = string.Empty; + var ffmpegProbeSize = _config.GetFFmpegProbeSize(); + + if (!string.IsNullOrEmpty(ffmpegProbeSize)) + { + probeSizeArgument = $"-probesize {probeSizeArgument}"; + } + + if (!string.IsNullOrEmpty(probeSizeArgument)) + { + inputModifier += $" {probeSizeArgument}"; + } + + inputModifier = inputModifier.Trim(); + var userAgentParam = GetUserAgentParam(state); if (!string.IsNullOrEmpty(userAgentParam)) From a18b3fbe70429f55852f0aebeda4e02e2abdef77 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Fri, 6 Oct 2023 10:49:20 +0200 Subject: [PATCH 2/2] simplify the if --- .../MediaEncoding/EncodingHelper.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index f8d2dd40fd..449ea64899 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -5697,21 +5697,13 @@ namespace MediaBrowser.Controller.MediaEncoding inputModifier = inputModifier.Trim(); // Apply -probesize if configured - var probeSizeArgument = string.Empty; var ffmpegProbeSize = _config.GetFFmpegProbeSize(); if (!string.IsNullOrEmpty(ffmpegProbeSize)) { - probeSizeArgument = $"-probesize {probeSizeArgument}"; + inputModifier += $" -probesize {ffmpegProbeSize}"; } - if (!string.IsNullOrEmpty(probeSizeArgument)) - { - inputModifier += $" {probeSizeArgument}"; - } - - inputModifier = inputModifier.Trim(); - var userAgentParam = GetUserAgentParam(state); if (!string.IsNullOrEmpty(userAgentParam))