From 5531a1cf2fd9cc2bdf9714661df67c4bb26c60c0 Mon Sep 17 00:00:00 2001 From: iawia002 Date: Fri, 15 May 2020 15:57:45 +0800 Subject: [PATCH] downloader: fix youtube video merge issue --- downloader/downloader.go | 6 +++--- utils/ffmpeg.go | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/downloader/downloader.go b/downloader/downloader.go index 71f914426..9a44c55f2 100644 --- a/downloader/downloader.go +++ b/downloader/downloader.go @@ -630,8 +630,8 @@ func (downloader *Downloader) Download(data *types.Data) error { } fmt.Printf("Merging video parts into %s\n", mergedFilePath) - if stream.Ext == "mp4" { - return utils.MergeToMP4(parts, mergedFilePath, title) + if stream.Ext != "mp4" || data.Site == "YouTube youtube.com" { + return utils.MergeFilesWithSameExtension(parts, mergedFilePath) } - return utils.MergeFilesWithSameExtension(parts, mergedFilePath) + return utils.MergeToMP4(parts, mergedFilePath, title) } diff --git a/utils/ffmpeg.go b/utils/ffmpeg.go index 6d4fdfc2c..730d186e3 100644 --- a/utils/ffmpeg.go +++ b/utils/ffmpeg.go @@ -26,6 +26,7 @@ func runMergeCmd(cmd *exec.Cmd, paths []string, mergeFilePath string) error { } // MergeFilesWithSameExtension merges files that have the same extension into one. +// Can also handle merging audio and video. func MergeFilesWithSameExtension(paths []string, mergedFilePath string) error { cmds := []string{ "-y",