From c60fe9af188c4d10071f20410cf035b639598459 Mon Sep 17 00:00:00 2001 From: aandrew-me Date: Thu, 20 Nov 2025 11:53:15 +0300 Subject: [PATCH] Fix file extension when combining av01 and opus --- src/renderer.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/renderer.js b/src/renderer.js index 1d13a6b..70ba689 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -982,7 +982,8 @@ class YtDownloaderApp { let format_id, ext, audioForVideoFormat_id, audioFormat; if (type === "video") { - const [videoFid, videoExt] = uiSnapshot.videoFormat.split("|"); + const [videoFid, videoExt, _, videoCodec] = + uiSnapshot.videoFormat.split("|"); const [audioFid, audioExt] = uiSnapshot.audioForVideoFormat.split("|"); @@ -990,12 +991,18 @@ class YtDownloaderApp { audioForVideoFormat_id = audioFid; const finalAudioExt = audioExt === "webm" ? "opus" : audioExt; - ext = - (videoExt === "mp4" && finalAudioExt === "opus") || - (videoExt === "webm" && - (finalAudioExt === "m4a" || finalAudioExt === "mp4")) - ? "mkv" - : videoExt; + + ext = videoExt; + + if (videoExt === "mp4" && finalAudioExt === "opus") { + if (videoCodec.includes("avc")) ext = "mkv"; + else if (videoCodec.includes("av01")) ext = "webm"; + } else if ( + videoExt === "webm" && + ["m4a", "mp4"].includes(finalAudioExt) + ) { + ext = "mkv"; + } audioFormat = audioForVideoFormat_id === "none" @@ -1323,7 +1330,7 @@ class YtDownloaderApp { const option = ``;