Skip to content

Commit

Permalink
Added handling of FFmpeg:probesize variable
Browse files Browse the repository at this point in the history
  • Loading branch information
0x25CBFC4F committed Aug 20, 2023
1 parent 4c7fb8f commit 8dc58e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 16 additions & 1 deletion MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5678,7 +5678,6 @@ public string GetInputModifier(EncodingJobInfo state, EncodingOptions encodingOp

// 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)
Expand All @@ -5697,6 +5696,22 @@ public string GetInputModifier(EncodingJobInfo state, EncodingOptions encodingOp

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))
Expand Down

0 comments on commit 8dc58e8

Please sign in to comment.