ffmpegwasm / ffmpegwasm/ffmpeg.wasm
ffmpeg.mount - ErrnoError: FS error
- Dominant language
- C
- Stars
- 17.8k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Getting the following error when trying to mount a file -
**ErrnoError: FS error**
```
try {
// Mount the file using WORKERFS
await ffmpeg.mount('WORKERFS', { files: [videoFile] }, '/mounted');
} catch (error) {
console.error('Error mounting file system:', error);
return;
}
```
**To Reproduce**
Please provide a GitHub link or code snippet.
```
let videoBuffer = new Uint8Array();
// Process frames in chunks
const chunkSize = 10; // Adjust chunk size based on memory constraints
for (let i = 0; i < frames.length; i += chunkSize) {
const chunkFrames = frames.slice(i, i + chunkSize);
for (const frame of chunkFrames) {
const planeData = new Uint8Array(config.width * config.height * 4); // Assuming RGBA format
await frame.copyTo(planeData);
videoBuffer = appendBuffer(videoBuffer, planeData);
frame.close();
}
}
// Create a Blob from the video buffer and a File object
const videoBlob = new Blob([videoBuffer], { type: 'application/octet-stream' });
const videoFile = new File([videoBlob], 'input.raw');
// Mount the file using WORKERFS
try {
// Mount the file using WORKERFS
await ffmpeg.mount('WORKERFS', { files: [videoFile] }, '/mounted');
} catch (error) {
console.error('Error mounting file system:', error);
return;
}
const inputFileName = '/mounted/input.raw';
const outputFileName = '/mounted/output.mp4';
// const inputFileName = 'input.raw';
// const outputFileName = 'output.mp4';
//await ffmpeg.writeFile(inputFileName, videoBuffer);
const args = [
'-f', 'rawvideo',
'-pix_fmt', 'rgba',
'-s', `${config.width}x${config.height}`,
'-r', `${config.framerate}`,
'-i', `${inputFileName}`,
'-c:v', 'libvpx-vp9',
'-preset', 'ultrafast',
'-profile:v', '0', // Profile 0 (vp09.00.10.08 corresponds to profile 0)
'-b:v', '30M', // Reduced bitrate
outputFileName
];
console.log(...args);
await ffmpeg.exec(args);
```
**Expected behavior**
I run out of memory using await ffmpeg.writeFile(inputFileName, videoBuffer); so wanted to use the mount to process the videoframe buffer but I can't get it to work on the latest core-mt@0.12.6
**Screenshots**
n/a
**Desktop (please complete the following information):**
- win 10
- Browser chrome
- Version 127.0.6526.0
Contributor guide
Assessment
This issue has not been assessed yet.