ffmpegwasm / ffmpeg.wasm

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

help building for mobile #267

Open MostafaRabia opened 3 years ago

MostafaRabia commented 3 years ago

HI!

I'm new here, I loved this work, an amazing work, very thanks to produce this. But I'm facing some problems and I need some help, I tried my best. I'm trying to run this for mobile, latest chrome, I got the next error: Uncaught (in promise) RangeError: WebAssembly.Memory(): could not allocate memory I searched here, I must build the ffmpeg with 0.5 GB or less. I did, after facing problems and hours.

Then I got this error: Uncaught (in promise) RuntimeError: abort(Assertion failed: Cannot call unknown function proxy_main, make sure it is exported). Build with -s ASSERTIONS=1 for more info Searched, I must replace proxy_main with main, I did

And finally worked! But what? After selecting the audio, the browser freeze! I opened console, got this: [fferr] Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread

Now... what? The build process takes 2 hours to end, this happens with -s INITIAL_MEMORY=268435456 ~= 256MB of ram. Is 256MB is the reason? Or what can i do?

And if anyone built this for mobile and worked, can I get the built?

Thanks, and thanks for reading

arpu commented 3 years ago

interested in this too

steady-join commented 3 years ago

me too.

JuanGuerreroUP commented 2 years ago

First of all, I think this issue should be moved to ffmpeg.wasm-core.

I know this issue is a bit old. But I presented the same problem @MostafaRabia described. However, I was able to solve it. To solve that I cloned the repository (ffmpeg.wasm-core) using git and ran: git checkout b59fb55619. I found out that the build script do not work well in versions after b59fb55. Then I configured build-ffmpeg.sh with these flags:

  -s INITIAL_MEMORY=536608768
  -s ALLOW_MEMORY_GROWTH=1
  -s ASSERTIONS=1

And after a while... it worked. (I did not change anything else in the repository, I did not even replaced proxy_main with main).

I am running Ubuntu 20 and used docker with a fresh image of emscripten/emsdk to make the build. I hope that helps!

steady-join commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

MostafaRabia commented 2 years ago

@JuanGuerreroUP Thanks for your comment, I will try soon.

MostafaRabia commented 2 years ago

@JuanGuerreroUP I got this error:

/emsdk/upstream/bin/llvm-ar: error: libvpx_g.a: Bad relocation type: make[1]: *** [Makefile:391: libvpx_g.a] Error 1 make: *** [Makefile:17: .DEFAULT] Error 2 make: Leaving directory '/src/third_party/libvpx' make: make -C third_party/libvpx install -j

using docker, What now?

JuanGuerreroUP commented 2 years ago

using docker, What now?

@MostafaRabia, verify that your image of emscripten/emsdk is at version 2.0.8? And what OS are you using? I had similar problems with Windows.

My only suggestion is to start from scratch. Download the repository and checkout to b59fb55619. Then check your docker images, and delete all your emscripten/emsdk images. And once everything is clean run build-with-docker.sh. It should redownload the docker image and then start building.

MostafaRabia commented 2 years ago

@JuanGuerreroUP image

It's 2.0.8 I'm using macOS Monterey And yes I did what you said to do.