Open TheSecondAkari opened 2 years ago
@TheSecondAkari have you tried after running
await ffmpeg.run(....)
var buffer = ffmpeg.FS('readFile','filename');
// Code to clear buffer
//Execute 2nd command
@EABangalore It error,too
@EABangalore
@yeliulee @Willy-JL Do you have time to help me? Thanks
@yeliulee @Willy-JL Do you have time to help me? Thanks
i just set EXIT_RUNTIME=0
before compiling the library.
i fixed it by removing the process.exit(0);
A good approach for now would be to implement a promise queue. Something along the lines:
let lastEnqued = Promise.resolve();
let queWrapper = async (fn) => {
lastEnqued = lastEnqued.then(async()=>{
let result = await ffmpeg.load().then((res) => {
return fn(res)
})
if(ffmpeg.isLoaded()) {
ffmpeg.exit();
}
return result
})
return await lastEnqued;
}
Then wrap each ffmpeg operation in this wrapper function
return await queWrapper(async () => {
ffmpeg.FS(........)
await ffmpeg.run(.........)
})
Sadly without calling .load() before and .exit() after each time a command is run, I couldn't get it to behave nicely.
But generally this should get you at least to operational level.
EDIT: Keep in mind that if multiple ffmpeg.run(...)
are required (e.g. for loop) there has to be an internal promise queue as well.
I used the single threaded version。 It will work。 However, if I execute the run command twice, it will report an error [Program terminated with exit(0)], and once is normal
Screenshots