From 21d9358a17af9df5d197630c09d35648a1974a30 Mon Sep 17 00:00:00 2001 From: JovannMC Date: Wed, 28 May 2025 18:30:53 +0300 Subject: [PATCH] fix: catch no audio streams --- src/lib/converters/ffmpeg.svelte.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/converters/ffmpeg.svelte.ts b/src/lib/converters/ffmpeg.svelte.ts index 1fd4a81..b866f6d 100644 --- a/src/lib/converters/ffmpeg.svelte.ts +++ b/src/lib/converters/ffmpeg.svelte.ts @@ -19,7 +19,6 @@ export class FFmpegConverter extends Converter { new FormatInfo("ogg"), new FormatInfo("aac"), new FormatInfo("m4a"), - // TODO: audio to video where it uses the album cover ...videoFormats.map((f) => new FormatInfo(f, true, true, false)), new FormatInfo("wma"), new FormatInfo("amr"), @@ -63,6 +62,14 @@ export class FFmpegConverter extends Converter { }); ffmpeg.on("log", (l) => { log(["converters", this.name], l.message); + + if (l.message.includes("Stream map '0:a:0' matches no streams.")) { + error( + ["converters", this.name], + `No audio stream found in ${input.name}.`, + ); + addToast("error", `No audio stream found in ${input.name}.`); + } }); const baseURL = "https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.6/dist/esm";