diff --git a/TwitchDownloaderCore/TwitchDownloaderCore.csproj b/TwitchDownloaderCore/TwitchDownloaderCore.csproj index 8ed82fd2..3a7a98fa 100644 --- a/TwitchDownloaderCore/TwitchDownloaderCore.csproj +++ b/TwitchDownloaderCore/TwitchDownloaderCore.csproj @@ -6,7 +6,7 @@ false MIT Lewis Pardo - 1.0.7 + 1.0.8 diff --git a/TwitchDownloaderCore/VideoDownloader.cs b/TwitchDownloaderCore/VideoDownloader.cs index 0c2a5645..b2112701 100644 --- a/TwitchDownloaderCore/VideoDownloader.cs +++ b/TwitchDownloaderCore/VideoDownloader.cs @@ -207,26 +207,28 @@ await Task.Run(() => await Task.Run(() => { - try + progress.Report(new ProgressReport() { reportType = ReportType.Log, data = "Ffmpeg Path: " + downloadOptions.FfmpegPath }); + progress.Report(new ProgressReport() { reportType = ReportType.Log, data = "Input File: " + Path.Combine(downloadFolder, "output.ts") }); + progress.Report(new ProgressReport() { reportType = ReportType.Log, data = "Output File: " + Path.GetFullPath(downloadOptions.Filename) }); + var process = new Process { - var process = new Process - { - StartInfo = + StartInfo = { FileName = downloadOptions.FfmpegPath, - Arguments = String.Format("-y -avoid_negative_ts make_zero " + (downloadOptions.CropBeginning ? "-ss {1} " : "") + "-i \"{0}\" -analyzeduration {2} -probesize {2} " + (downloadOptions.CropEnding ? "-t {3} " : "") + "-c:v copy \"{4}\"", Path.Combine(downloadFolder, "output.ts"), (seekTime - startOffset).ToString(), Int32.MaxValue, seekDuration.ToString(), Path.GetFullPath(downloadOptions.Filename)), + Arguments = String.Format("-y -avoid_negative_ts make_zero " + (downloadOptions.CropBeginning ? "-ss {1} " : "") + "-i \"{0}\" -analyzeduration {2} -probesize {2} " + (downloadOptions.CropEnding ? "-t {3} " : "") + "-c:v copy \"{4}\"", Path.Combine(downloadFolder, "output.ts"), (seekTime - startOffset).ToString(CultureInfo.InvariantCulture), Int32.MaxValue, seekDuration.ToString(CultureInfo.InvariantCulture), Path.GetFullPath(downloadOptions.Filename)), UseShellExecute = false, CreateNoWindow = true, - RedirectStandardInput = false, - RedirectStandardOutput = false, - RedirectStandardError = false + RedirectStandardInput = true, + RedirectStandardOutput = true, + RedirectStandardError = true } - }; - process.Start(); - process.WaitForExit(); - } - catch (TaskCanceledException) { } - Cleanup(downloadFolder); + }; + process.ErrorDataReceived += ((object sender, DataReceivedEventArgs e) => { progress.Report(new ProgressReport() { reportType = ReportType.Log, data = e.Data }); }); + + process.Start(); + process.BeginErrorReadLine(); + process.BeginOutputReadLine(); + process.WaitForExit(); }); } catch