From c610d3e0b9ae513138eb73a25803777c98bfdffb Mon Sep 17 00:00:00 2001 From: Scrub <72096833+ScrubN@users.noreply.github.com> Date: Sat, 9 Nov 2024 22:00:53 -0500 Subject: [PATCH] Revert "Add FFmpeg command verbose log (#1248)" This reverts commit 08b596d9b16846110155bbc93b52d250745985d8. --- TwitchDownloaderCore/ChatRenderer.cs | 2 -- TwitchDownloaderCore/VideoDownloader.cs | 34 ++----------------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/TwitchDownloaderCore/ChatRenderer.cs b/TwitchDownloaderCore/ChatRenderer.cs index 2851ccd3..5241de47 100644 --- a/TwitchDownloaderCore/ChatRenderer.cs +++ b/TwitchDownloaderCore/ChatRenderer.cs @@ -390,8 +390,6 @@ private FfmpegProcess GetFfmpegProcess(FileInfo fileInfo) } }; - _progress.LogVerbose($"Running \"{renderOptions.FfmpegPath}\" in \"{process.StartInfo.WorkingDirectory}\" with args: {process.StartInfo.Arguments}"); - process.Start(); process.BeginErrorReadLine(); process.BeginOutputReadLine(); diff --git a/TwitchDownloaderCore/VideoDownloader.cs b/TwitchDownloaderCore/VideoDownloader.cs index 3e1841d6..b32d10f6 100644 --- a/TwitchDownloaderCore/VideoDownloader.cs +++ b/TwitchDownloaderCore/VideoDownloader.cs @@ -90,8 +90,6 @@ private async Task DownloadAsyncImpl(FileInfo outputFileInfo, FileStream outputF CheckAvailableStorageSpace(qualityPlaylist.StreamInfo.Bandwidth, videoLength); - var streamIds = GetStreamIds(playlist); - if (Directory.Exists(downloadFolder)) Directory.Delete(downloadFolder, true); TwitchHelper.CreateDirectory(downloadFolder); @@ -111,7 +109,7 @@ await FfmpegMetadata.SerializeAsync(metadataPath, downloadOptions.Id.ToString(), videoChapterResponse.data.video.moments.edges); var concatListPath = Path.Combine(downloadFolder, "concat.txt"); - await FfmpegConcatList.SerializeAsync(concatListPath, playlist, videoListCrop, streamIds, cancellationToken); + await FfmpegConcatList.SerializeAsync(concatListPath, playlist, videoListCrop, cancellationToken); outputFs.Close(); @@ -147,20 +145,6 @@ await FfmpegMetadata.SerializeAsync(metadataPath, downloadOptions.Id.ToString(), } } - private FfmpegConcatList.StreamIds GetStreamIds(M3U8 playlist) - { - var path = DownloadTools.RemoveQueryString(playlist.Streams.FirstOrDefault()?.Path ?? ""); - var extension = Path.GetExtension(path); - if (extension is ".mp4") - return FfmpegConcatList.StreamIds.Mp4; - - if (extension is ".ts") - return FfmpegConcatList.StreamIds.TransportStream; - - _progress.LogWarning("No file extension was found! Assuming TS."); - return FfmpegConcatList.StreamIds.TransportStream; - } - private void CheckAvailableStorageSpace(int bandwidth, TimeSpan videoLength) { var videoSizeInBytes = VideoSizeEstimator.EstimateVideoSize(bandwidth, @@ -334,8 +318,7 @@ private async Task VerifyDownloadedParts(ICollection playlist, Rang } } - private async Task RunFfmpegVideoCopy(string tempFolder, FileInfo outputFile, string concatListPath, string metadataPath, decimal startOffset, decimal endDuration, TimeSpan videoLength, bool disableAudioCopy, - CancellationToken cancellationToken) + private async Task RunFfmpegVideoCopy(string tempFolder, FileInfo outputFile, string concatListPath, string metadataPath, decimal startOffset, decimal endDuration, TimeSpan videoLength, bool disableAudioCopy, CancellationToken cancellationToken) { using var process = new Process { @@ -403,8 +386,6 @@ private async Task RunFfmpegVideoCopy(string tempFolder, FileInfo outputFil HandleFfmpegOutput(e.Data, encodingTimeRegex, videoLength); }; - _progress.LogVerbose($"Running \"{downloadOptions.FfmpegPath}\" in \"{process.StartInfo.WorkingDirectory}\" with args: {CombineArguments(process.StartInfo.ArgumentList)}"); - process.Start(); process.BeginErrorReadLine(); @@ -420,17 +401,6 @@ private async Task RunFfmpegVideoCopy(string tempFolder, FileInfo outputFil } while (!process.HasExited || !logQueue.IsEmpty); return process.ExitCode; - - static string CombineArguments(IEnumerable args) - { - return string.Join(' ', args.Select(x => - { - if (!x.StartsWith('"') && !x.StartsWith('\'') && x.Contains(' ')) - return $"\"{x}\""; - - return x; - })); - } } private void HandleFfmpegOutput(string output, Regex encodingTimeRegex, TimeSpan videoLength)