ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
13.45k stars 772 forks source link

FFmpeg-mt can't convert PNG images to a video, hangs with no callback #714

Open ArsenicBismuth opened 3 months ago

ArsenicBismuth commented 3 months ago

I tried to do a simple images-to-video conversion using this library. I already ensured the FFmpeg is loaded and working just fine by transcoding the bunny video.

The command I run is below, but somehow there's no feedback at all (no error, no log, no progress), and the command after it aren't executed (so it's stuck).

And yes I already confirmed the images exist and can be loaded by FFmpeg (by writing => loading => preview on browser). The file is stored inside images/ in FS and with format 000.png, 001.png, etc.

await this.ffmpeg.exec([
    '-framerate', '1',
    '-i', 'images/%03d.png',
    '-r', '30',
    'output.mp4'
  ]);

The FFmpeg command is also properly detecting the images, there will be FS error otherwise. So something is "stuck" during the execution, I also receive no progress callback. I tried using 1 hardcoded image instead of pattern and got the same result.

ArsenicBismuth commented 3 months ago

Solved it thanks to this guy (step-1): https://stackoverflow.com/a/70325534/15858248

I got the images from a canvas, and turns out only image/jpeg are supported (note, image/jpg is NOT working, and image/png is somehow unsupported). Immediately I got the video and even the progress callback is properly called.

But this pretty much leave 2 major issues unresolved:

If anyone can clarify why is this behavior, I will close this issue.

ArsenicBismuth commented 2 months ago

Decided to revisit this issue, turns out this is due to using the mt version. Using the single-threaded version and it works flawlessly.

Thanks to this guy: https://github.com/ffmpegwasm/ffmpeg.wasm/issues/542