-
-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request for appendFile method #797
Comments
slammed for time now but - if you get a patch up i'm happy to review / build / include! |
Use ffmpeg.mount('WORKERFS' ... It will work with the file directly on your machine without copying it to memory Check my example app: https://github.com/pavloshargan/quicksplit |
I would love to have this as well. emscripten supports appendFile correctly, it will be great if the ffmpeg api supports it directly |
WORKERFS is the best way right now to use large files for input. The file is not read into memory all at once and is not copied before use. const transcodePicker = async () => {
let fileHandle;
const pickerOpts = {
types: [
{
description: "Videos",
accept: {
"video/*": [".mp4", ".m4v", ".webm", ".avi", ".mkv", ".mov", ".wmv"],
},
},
],
excludeAcceptAllOption: true,
multiple: false,
};
[fileHandle] = await window.showOpenFilePicker(pickerOpts);
let file = await fileHandle.getFile();
const inputDir = '/input';
const inputFile = `${inputDir}/${file.name}`;
await ffmpeg.createDir(inputDir);
await ffmpeg.mount('WORKERFS', {
files: [ file ],
}, inputDir);
await ffmpeg.exec(['-i', inputFile, 'output.mp4']);
const output = await ffmpeg.readFile('output.mp4');
videoEl.src = URL.createObjectURL(new Blob([output.buffer], { type: 'video/mp4' }));
await ffmpeg.unmount(inputDir);
await ffmpeg.deleteDir(inputDir);
}; |
Hi,
I try to optimize the time to load big files. For the moment, I follow a 2 step approach 👍
However I think it would be faster reading the source file into chunks with File Stream Reader and then writes directly these chunks in append mode to the FS object.
Unfortunately ffmpeg.FS does not expose the appendFile method, or even better it would be great to have a File Stream Writer.
Thanks,
Stéphane
The text was updated successfully, but these errors were encountered: