ffmpeg.wasm icon indicating copy to clipboard operation
ffmpeg.wasm copied to clipboard

How do I return/retrieve data such as supported fomats?

Open Fanna1119 opened this issue 3 years ago • 4 comments

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.

Fanna1119 avatar Nov 10 '21 05:11 Fanna1119

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');

julienbeisel avatar Nov 14 '21 09:11 julienbeisel