Merge pull request #8866 from Bond-009/mediaencoder

Always log when starting ffprobe
pull/8884/head
Claus Vium 2 years ago committed by GitHub
commit 7195223dd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -415,8 +415,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
analyzeDuration = "-analyzeduration " + ffmpegAnalyzeDuration; analyzeDuration = "-analyzeduration " + ffmpegAnalyzeDuration;
} }
var forceEnableLogging = request.MediaSource.Protocol != MediaProtocol.File;
return GetMediaInfoInternal( return GetMediaInfoInternal(
GetInputArgument(inputFile, request.MediaSource), GetInputArgument(inputFile, request.MediaSource),
request.MediaSource.Path, request.MediaSource.Path,
@ -425,7 +423,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
analyzeDuration, analyzeDuration,
request.MediaType == DlnaProfileType.Audio, request.MediaType == DlnaProfileType.Audio,
request.MediaSource.VideoType, request.MediaSource.VideoType,
forceEnableLogging,
cancellationToken); cancellationToken);
} }
@ -473,7 +470,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
string probeSizeArgument, string probeSizeArgument,
bool isAudio, bool isAudio,
VideoType? videoType, VideoType? videoType,
bool forceEnableLogging,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var args = extractChapters var args = extractChapters
@ -488,7 +484,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
CreateNoWindow = true, CreateNoWindow = true,
UseShellExecute = false, UseShellExecute = false,
// Must consume both or ffmpeg may hang due to deadlocks. See comments below. // Must consume both or ffmpeg may hang due to deadlocks.
RedirectStandardOutput = true, RedirectStandardOutput = true,
FileName = _ffprobePath, FileName = _ffprobePath,
@ -500,21 +496,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
EnableRaisingEvents = true EnableRaisingEvents = true
}; };
if (forceEnableLogging) _logger.LogInformation("Starting {ProcessFileName} with args {ProcessArgs}", _ffprobePath, args);
{
_logger.LogInformation("{ProcessFileName} {ProcessArgs}", process.StartInfo.FileName, process.StartInfo.Arguments);
}
else
{
_logger.LogDebug("{ProcessFileName} {ProcessArgs}", process.StartInfo.FileName, process.StartInfo.Arguments);
}
using (var processWrapper = new ProcessWrapper(process, this)) using (var processWrapper = new ProcessWrapper(process, this))
{ {
await using var memoryStream = new MemoryStream(); await using var memoryStream = new MemoryStream();
_logger.LogDebug("Starting ffprobe with args {Args}", args);
StartProcess(processWrapper); StartProcess(processWrapper);
await process.StandardOutput.BaseStream.CopyToAsync(memoryStream, cancellationToken: cancellationToken); await process.StandardOutput.BaseStream.CopyToAsync(memoryStream, cancellationToken);
memoryStream.Seek(0, SeekOrigin.Begin); memoryStream.Seek(0, SeekOrigin.Begin);
InternalMediaInfoResult result; InternalMediaInfoResult result;
try try
@ -522,7 +510,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
result = await JsonSerializer.DeserializeAsync<InternalMediaInfoResult>( result = await JsonSerializer.DeserializeAsync<InternalMediaInfoResult>(
memoryStream, memoryStream,
_jsonSerializerOptions, _jsonSerializerOptions,
cancellationToken: cancellationToken).ConfigureAwait(false); cancellationToken).ConfigureAwait(false);
} }
catch catch
{ {

Loading…
Cancel
Save