web/workers/ffmpeg: proper error code for missing audio channel error
This commit is contained in:
@@ -15,5 +15,6 @@
|
|||||||
"ffmpeg.no_input_type": "the file's type isn't supported",
|
"ffmpeg.no_input_type": "the file's type isn't supported",
|
||||||
"ffmpeg.crashed": "ffmpeg worker crashed, see console for details",
|
"ffmpeg.crashed": "ffmpeg worker crashed, see console for details",
|
||||||
"ffmpeg.no_render": "ffmpeg render is empty, something very odd happened",
|
"ffmpeg.no_render": "ffmpeg render is empty, something very odd happened",
|
||||||
"ffmpeg.no_args": "ffmpeg worker didn't get required arguments"
|
"ffmpeg.no_args": "ffmpeg worker didn't get required arguments",
|
||||||
|
"ffmpeg.no_audio_channel": "this video has no audio track, nothing to do"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ const ffmpeg = async (variant: string, files: File[], args: string[], output: Fi
|
|||||||
return error("queue.ffmpeg.no_input_format");
|
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({
|
self.postMessage({
|
||||||
cobaltFFmpegWorker: {
|
cobaltFFmpegWorker: {
|
||||||
progress: {
|
progress: {
|
||||||
|
|||||||
Reference in New Issue
Block a user