From 707eca6a65112fd4107462b29abb634186237fe4 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Mon, 8 Aug 2022 23:11:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96ffmpeg=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=90=8E=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs | 3 ++- src/N_m3u8DL-RE/Util/MergeUtil.cs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs index 80d6226..0306248 100644 --- a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs +++ b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs @@ -356,7 +356,8 @@ namespace N_m3u8DL_RE.DownloadManager { var files = FileDic.Values.Select(v => v!.ActualFilePath).OrderBy(s => s).ToArray(); Logger.InfoMarkUp(ResString.ffmpegMerge); - mergeSuccess = MergeUtil.MergeByFFmpeg(DownloaderConfig.FFmpegBinaryPath!, files, Path.ChangeExtension(output, null), "mp4"); + var ext = streamSpec.MediaType == MediaType.AUDIO ? "m4a" : "mp4"; + mergeSuccess = MergeUtil.MergeByFFmpeg(DownloaderConfig.FFmpegBinaryPath!, files, Path.ChangeExtension(output, null), ext); } } diff --git a/src/N_m3u8DL-RE/Util/MergeUtil.cs b/src/N_m3u8DL-RE/Util/MergeUtil.cs index 51b9504..558520b 100644 --- a/src/N_m3u8DL-RE/Util/MergeUtil.cs +++ b/src/N_m3u8DL-RE/Util/MergeUtil.cs @@ -85,6 +85,9 @@ namespace N_m3u8DL_RE.Util case ("FLV"): command.Append("\" -map 0 -c copy -y " + (useAACFilter ? "-bsf:a aac_adtstoasc" : "") + " \"" + outputPath + ".flv\""); break; + case ("M4A"): + command.Append("\" -map 0 -c copy -y " + (useAACFilter ? "-bsf:a aac_adtstoasc" : "") + " \"" + outputPath + ".m4a\""); + break; case ("TS"): command.Append("\" -map 0 -c copy -y -f mpegts -bsf:v h264_mp4toannexb \"" + outputPath + ".ts\""); break;