From a4d57f175eea7de82750907d7a8584c041fd3be7 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 17 Aug 2024 14:07:07 +0000 Subject: [PATCH] web/libav: try to guess type from filename if browser fails --- web/src/routes/remux/+page.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/src/routes/remux/+page.svelte b/web/src/routes/remux/+page.svelte index 6c619df5..88ce45d0 100644 --- a/web/src/routes/remux/+page.svelte +++ b/web/src/routes/remux/+page.svelte @@ -6,9 +6,10 @@ import DropReceiver from "$components/misc/DropReceiver.svelte"; import FileReceiver from "$components/misc/FileReceiver.svelte"; import { createDialog } from "$lib/dialogs"; + import mime from "mime"; let draggedOver = false; - let file: File | undefined; + let file: File | Blob | undefined; let totalDuration: number | undefined; let processedDuration: number | undefined; @@ -66,6 +67,12 @@ totalDuration = Number(file_info.format.duration); + if (file instanceof File && !file.type) { + file = new Blob([ file ], { + type: mime.getType(file.name) ?? undefined + }); + } + const render = await ff.render({ blob: file, args: ['-c', 'copy', '-map', '0']