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

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

Open ArsenicBismuth opened this issue 10 months ago • 2 comments

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 avatar Apr 01 '24 14:04 ArsenicBismuth

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:

  • Why is image/png unsupported.
  • Why is there no error nor progress callbacks.

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

ArsenicBismuth avatar Apr 01 '24 15:04 ArsenicBismuth

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

ArsenicBismuth avatar Apr 23 '24 03:04 ArsenicBismuth