ffmpegwasm / ffmpeg.wasm

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

FFmpeg.wasm not working for files bigger than 200MB in safari IOS #482

Open TheMrCorvy opened 1 year ago

TheMrCorvy commented 1 year ago

Describe the bug I'm building a react app with the intent of creating a smaller version of handbrake on the browser. The thing is, that so far FFmpeg.wasm is working perfectly fine for desktop browsers (I can throw files up to 2GB without any problem), but I tried doing the same on my Ipad, and found that for files bigger than 200MB FFmpeg throws this error: Unhandled Promise Rejection: Error: Oops, something went wrong in FS operation.

But the weird thing actually comes when the file is bigger than 500MB, because then it throws a different error: Unhandled Promise Rejection: Error: File could not be read! Code=0

I think it may be related to the maximum allocated memory for wasm in safari for IOS, but I honestly have no clue of whats going on, or how to solve it. If anyone could help, I'd appreciate it very much.


Steps to reproduce the behavior:

  1. Go to https://media-suite.netlify.app on an IOS device.
  2. wait for the loader to complete, and click on the "select file" input.
  3. If the selected file is bigger than 200MB, or 500MB the error should appear in the console.

Expected behavior There are two processes that should finish. Firstly the app will run FFmpeg to extract some basic metadata from the file and, when the process is complete, it will call ffmpeg.exit() (because I was having an error saying that FFmpeg wasn't able to execute more than 1 command at a time).

The second process comes automatically after the first one is finished. It runs an FFmpeg command to take a screenshot of a random frame in the provided video, and when its complete, it should appear in the image element at the top left corner.

Screenshots 200MB+

Captura de pantalla 2023-03-15 a la(s) 07 50 36 p  m

500MB+

Captura de pantalla 2023-03-15 a la(s) 07 51 04 p  m

Smartphone:

Additional context I'll leave the repo here if you want to check it. The process is executed in: src > pages > VideoSuite.tsx > readFileProps() & generatePreviewUrl()

https://github.com/TheMrCorvy/Media-Suite

Thanks in advance.