Problem
In src/lib/ffmpeg.ts, the exportVideo function calls:
await ffmpeg.writeFile(inputName, await fetchFile(file), { signal });
fetchFile(file) reads the entire File object into a Uint8Array in
JavaScript memory, which is then copied into the WASM heap. There is no
maximum file size check before this happens.
A user who selects a large video file (e.g. a 4K raw recording of several GB)
will trigger an allocation that exhausts the browser's WASM heap (typically
limited to 2-4GB), causing the browser tab to crash with an out-of-memory
error and no user-friendly message.
This is especially problematic on mobile devices with limited RAM, where even
files over 500MB can cause crashes.
Steps to Reproduce
- Select a video file larger than 1GB.
- Click Export.
- Observe: the browser tab crashes or hangs indefinitely with no error shown.
Suggested Fix
- Add a file size check before calling
fetchFile:
const MAX_FILE_SIZE_BYTES = 500 * 1024 * 1024; // 500 MB
if (file.size > MAX_FILE_SIZE_BYTES) {
throw new Error("File too large. Maximum supported size is 500 MB.");
}
- Display the limit in the file picker UI so users know before selecting.
- For files near the limit, show a warning with an estimate of required RAM.
- Document the supported size range in the README.
Problem
In
src/lib/ffmpeg.ts, theexportVideofunction calls:fetchFile(file)reads the entireFileobject into aUint8ArrayinJavaScript memory, which is then copied into the WASM heap. There is no
maximum file size check before this happens.
A user who selects a large video file (e.g. a 4K raw recording of several GB)
will trigger an allocation that exhausts the browser's WASM heap (typically
limited to 2-4GB), causing the browser tab to crash with an out-of-memory
error and no user-friendly message.
This is especially problematic on mobile devices with limited RAM, where even
files over 500MB can cause crashes.
Steps to Reproduce
Suggested Fix
fetchFile: