Fix ffmpeg analyze duration env var taking priority over media source

pull/8280/head
Bill Thornton 2 years ago
parent b344771f8a
commit 80c68b8948

@ -4976,13 +4976,13 @@ namespace MediaBrowser.Controller.MediaEncoding
// The default value of -probesize is more than enough, so leave it as is. // The default value of -probesize is more than enough, so leave it as is.
var ffmpegAnalyzeDuration = _config.GetFFmpegAnalyzeDuration() ?? string.Empty; var ffmpegAnalyzeDuration = _config.GetFFmpegAnalyzeDuration() ?? string.Empty;
if (!string.IsNullOrEmpty(ffmpegAnalyzeDuration)) if (state.MediaSource.AnalyzeDurationMs > 0)
{ {
analyzeDurationArgument = "-analyzeduration " + ffmpegAnalyzeDuration; analyzeDurationArgument = "-analyzeduration " + (state.MediaSource.AnalyzeDurationMs.Value * 1000).ToString(CultureInfo.InvariantCulture);
} }
else if (state.MediaSource.AnalyzeDurationMs.HasValue) else if (!string.IsNullOrEmpty(ffmpegAnalyzeDuration))
{ {
analyzeDurationArgument = "-analyzeduration " + (state.MediaSource.AnalyzeDurationMs.Value * 1000).ToString(CultureInfo.InvariantCulture); analyzeDurationArgument = "-analyzeduration " + ffmpegAnalyzeDuration;
} }
if (!string.IsNullOrEmpty(analyzeDurationArgument)) if (!string.IsNullOrEmpty(analyzeDurationArgument))

@ -376,15 +376,15 @@ namespace MediaBrowser.MediaEncoding.Encoder
string analyzeDuration = string.Empty; string analyzeDuration = string.Empty;
string ffmpegAnalyzeDuration = _config.GetFFmpegAnalyzeDuration() ?? string.Empty; string ffmpegAnalyzeDuration = _config.GetFFmpegAnalyzeDuration() ?? string.Empty;
if (!string.IsNullOrEmpty(ffmpegAnalyzeDuration)) if (request.MediaSource.AnalyzeDurationMs > 0)
{
analyzeDuration = "-analyzeduration " + ffmpegAnalyzeDuration;
}
else if (request.MediaSource.AnalyzeDurationMs > 0)
{ {
analyzeDuration = "-analyzeduration " + analyzeDuration = "-analyzeduration " +
(request.MediaSource.AnalyzeDurationMs * 1000).ToString(); (request.MediaSource.AnalyzeDurationMs * 1000).ToString();
} }
else if (!string.IsNullOrEmpty(ffmpegAnalyzeDuration))
{
analyzeDuration = "-analyzeduration " + ffmpegAnalyzeDuration;
}
var forceEnableLogging = request.MediaSource.Protocol != MediaProtocol.File; var forceEnableLogging = request.MediaSource.Protocol != MediaProtocol.File;

Loading…
Cancel
Save