Kagami / ffmpeg.js

Port of FFmpeg with Emscripten
Other
3.29k stars 335 forks source link

Out of memory on -preset medium #83

Closed vasanthudhaya closed 4 years ago

vasanthudhaya commented 4 years ago

Hi @Kagami , Thanks for the ffmpeg.js, it is very useful.

Actually my issue is while am encoding the webm video to convert mp4, the memory allocate issue occurs. (Cannot enlarge memory arrays).

Ref issue : https://github.com/Kagami/ffmpeg.js/issues/9, In this issue you mentioned the values to enlarge the TOTAL_MEMORY , I tried on that way too.... But i fails for the below configuration. Now am using 1gb on my TOTAL_MEMORY value. And from myside i tried all the values which you are mentioned to the TOTAL_MEMORY.

My system configuration:

RAM: 4gb, BIT: 32 bit.

I am using threads value 4, and my command is -i input.webm -r 24 -c:v libx264 -crf 22 -pix_fmt yuv420p -threads 4 -rtbufsize 100M -b:a 128k -preset ultrafast output.mp4.

Kindly know me what i missed in my command else what i need to do to resolve the memory allocation issue. Thanks in advance

cc: @thijstriemstra @PaulKinlan

LucCADORET commented 4 years ago

Same issue here, with a .mkv file. My arguments are: ["-i", "ram.mkv", "-f", "mp4", "-codec", "copy", "out.mp4"] I have tried increasing the --max-old-space-size of node, and also the TOTAL_MEMORY (respectively to 8192, and 1024 1024 1024). I am getting FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory

I'm running node v12.13.0 (LTS), if that matters.

Kagami commented 4 years ago

@LucCADORET could you reproduce with the latest build? Please provide your source file if it still fails.

Kagami commented 4 years ago

I've reproduced the problem with -preset medium (default preset), but for -preset ultrafast (and probably other fast prests) it should work.

Need to find why changing TOTAL_MEMORY doesn't help. Maybe it should be fixed as part of #10 (enable memory grow).

Kagami commented 4 years ago

Closing in favor of #10.

BrunoQuaresma commented 2 years ago

I tried WASM, but it has some limitations like the ArraySharedBuffer where is not available on Safari, and the page needs to use some strict CORS headers. Is it possible to fix this memory issue without using the WASM version?