Add more logging

Trying to fix hls muxer plus ffmpeg 4.1+ combo

Try to fix waiting for segment being ready

This is needed because hls muxer in ffmpeg >= 4.1 creates the
playlist only when it finishes transcoding.

Also cleaned up logs a bit.

Lower log level for "StartFfmpeg finished" to debug
This commit is contained in:
Vasily
2019-10-03 18:50:39 +03:00
parent 6746f708f2
commit c1f9107b8b
3 changed files with 27 additions and 28 deletions

View File

@@ -289,16 +289,20 @@ namespace MediaBrowser.Api.Playback
throw;
}
Logger.LogDebug("Launched ffmpeg process");
state.TranscodingJob = transcodingJob;
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
_ = new JobLogger(Logger).StartStreamingLog(state, process.StandardError.BaseStream, logStream);
// Wait for the file to exist before proceeeding
while (!File.Exists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
var waitFor = state.WaitForPath ?? outputPath;
Logger.LogDebug("Waiting for the creation of '{0}'", waitFor);
while (!File.Exists(waitFor) && !transcodingJob.HasExited)
{
await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false);
}
Logger.LogDebug("File '{0}' created or transcoding has finished", waitFor);
if (state.IsInputVideo && transcodingJob.Type == TranscodingJobType.Progressive && !transcodingJob.HasExited)
{
@@ -314,6 +318,7 @@ namespace MediaBrowser.Api.Playback
{
StartThrottler(state, transcodingJob);
}
Logger.LogDebug("StartFfMpeg() finished successfully");
return transcodingJob;
}