From 981a6eedd7806c12d35ce41b47420295156f57f3 Mon Sep 17 00:00:00 2001 From: jouls0217 Date: Tue, 12 May 2026 16:10:51 +0800 Subject: [PATCH] Prefer m4a audio when merging to mp4 YouTube's bestaudio is typically Opus, which gets muxed into the mp4 container but cannot be decoded by Windows Media Player and some other players. Prefer the AAC/m4a audio stream during merge so the output is playable across all major OSes and players, with a fallback to any bestaudio if m4a is not available. --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 703f435..bf3ff32 100644 --- a/app.py +++ b/app.py @@ -22,7 +22,7 @@ def run_download(job_id, url, format_choice, format_id): if format_choice == "audio": cmd += ["-x", "--audio-format", "mp3"] elif format_id: - cmd += ["-f", f"{format_id}+bestaudio/best", "--merge-output-format", "mp4"] + cmd += ["-f", f"{format_id}+bestaudio[ext=m4a]/bestaudio/best", "--merge-output-format", "mp4"] else: cmd += ["-f", "bestvideo+bestaudio/best", "--merge-output-format", "mp4"]