web/workers/ffmpeg: proper error code for missing audio channel error

This commit is contained in:
wukko
2025-06-14 17:24:47 +06:00
parent 5ea170a5ac
commit 507fab847b
2 changed files with 10 additions and 1 deletions

View File

@@ -64,6 +64,14 @@ const ffmpeg = async (variant: string, files: File[], args: string[], output: Fi
return error("queue.ffmpeg.no_input_format");
}
// handle the edge case when a video doesn't have an audio track
// but user still tries to extract it
if (files.length === 1 && file_info.streams?.length === 1) {
if (output.type?.startsWith("audio") && file_info.streams[0].codec_type !== "audio") {
return error("queue.ffmpeg.no_audio_channel");
}
}
self.postMessage({
cobaltFFmpegWorker: {
progress: {