diff --git a/web/src/lib/libav.ts b/web/src/lib/libav.ts index 40da0d2e..1dcee27c 100644 --- a/web/src/lib/libav.ts +++ b/web/src/lib/libav.ts @@ -56,9 +56,14 @@ export default class LibAVWrapper { } } - static getExtensionFromType(blob: Blob) { + static getExtensionFromType(blob: Blob | File) { + const canonicalExtension = blob instanceof File && blob.name.split('.').pop()?.toLowerCase(); const extensions = mime.getAllExtensions(blob.type); - const overrides = ['mp3', 'mov']; + + if (canonicalExtension && extensions?.has(canonicalExtension)) + return canonicalExtension; + + const overrides = ['mp3', 'mov', 'opus']; if (!extensions) return; diff --git a/web/src/lib/types/libav.ts b/web/src/lib/types/libav.ts index eed54edf..c0a19e1a 100644 --- a/web/src/lib/types/libav.ts +++ b/web/src/lib/types/libav.ts @@ -7,7 +7,7 @@ export type FileInfo = { } export type RenderParams = { - blob: Blob, + blob: Blob | File, output?: FileInfo, args: string[], }