ffmpeg.wasm
ffmpeg.wasm copied to clipboard
How do I return/retrieve data such as supported fomats?
When the logger is on:
const ffmpeg = createFFmpeg({
log: true,
// corePath: 'https://unpkg.com/@ffmpeg/[email protected]/dist/ffmpeg-core.js'
logger: (msg) => {
//log msg if type == 'ffer'
if (msg.type === 'ffer') {
console.log(msg.message);
}
},
});
And I run:
let check = await ffmpeg.run("-formats")
console.log(check)
it does return the formats in the log so the command itself works.
But How do I retrieve the data. the check
variable returns undefined
Which makes sense since ffmpeg.run
does not return anything.
I would first store it in the FS:
await ffmpeg.run("-formats", ">", "formatList.txt")
And then read it:
let check = ffmpeg.FS('readFile', 'formatList.txt');