ffmpeg plugin: Increase TOTAL_MEMORY
See original GitHub issueDescription
I’m trying to convert my videos to mp4 using the ffmpeg.js plugin. I had to downgrade ffmpeg.js to an earlier version, 3.1.9001 otherwise I would get a OOM error in chrome (as documented in: https://github.com/collab-project/videojs-record/issues/481). After downgrade during the conversion I started getting a “Cannot enlarge memory arrays.” error. I found the solution on (https://github.com/Kagami/ffmpeg.js/issues/9), which requires the TOTAL_MEMORY to be increased and passed in. Is there a way to do this?
Steps to reproduce
Record a video with the following conversion settings:
convertEngine: 'ffmpeg.js',
convertOptions: [
'-f',
'mp4',
'-codec:a',
'aac',
'-codec:v',
'libx264',
],
pluginLibraryOptions: {
outputType: 'video/mp4',
},
convertWorkerURL: '/ffmpeg-worker-mp4.js',`
Results
Expected
Should be able to convert video if memory is increased.
Actual
Failed to convert due to lack of memory.
Error output
Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 67108864, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
ffmpeg-worker-mp4.js:25 Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 67108864, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
Ua.e.printErr.e.printErr @ ffmpeg-worker-mp4.js:25
A @ ffmpeg-worker-mp4.js:19
qa @ ffmpeg-worker-mp4.js:30
Ba @ ffmpeg-worker-mp4.js:15
B_a @ ffmpeg-worker-mp4.js:3503
I_a @ ffmpeg-worker-mp4.js:3503
H_a @ ffmpeg-worker-mp4.js:3503
cRa @ ffmpeg-worker-mp4.js:3492
KRa @ ffmpeg-worker-mp4.js:3501
HWa @ ffmpeg-worker-mp4.js:3503
GY @ ffmpeg-worker-mp4.js:3495
Q2 @ ffmpeg-worker-mp4.js:3479
lf @ ffmpeg-worker-mp4.js:3487
bf @ ffmpeg-worker-mp4.js:3487
Oi @ ffmpeg-worker-mp4.js:3487
Ye @ ffmpeg-worker-mp4.js:3487
Ve @ ffmpeg-worker-mp4.js:3487
Ua.e.callMain.e.sf @ ffmpeg-worker-mp4.js:3514
b @ ffmpeg-worker-mp4.js:17
Oa @ ffmpeg-worker-mp4.js:18
Ua @ ffmpeg-worker-mp4.js:3515
self.onmessage @ ffmpeg-worker-mp4.js:3517
ffmpeg-worker-mp4.js:3515 Uncaught abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 67108864, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ") at Error
at ya (http://localhost:3000/ffmpeg-worker-mp4.js:9:262)
at A (http://localhost:3000/ffmpeg-worker-mp4.js:19:80)
at Function.qa [as Bc] (http://localhost:3000/ffmpeg-worker-mp4.js:30:54)
at Ba (http://localhost:3000/ffmpeg-worker-mp4.js:15:216)
at B_a (http://localhost:3000/ffmpeg-worker-mp4.js:3502:211366)
at I_a (http://localhost:3000/ffmpeg-worker-mp4.js:3502:229696)
at H_a (http://localhost:3000/ffmpeg-worker-mp4.js:3502:229450)
at cRa (http://localhost:3000/ffmpeg-worker-mp4.js:3491:359067)
at KRa (http://localhost:3000/ffmpeg-worker-mp4.js:3500:27449)
at HWa (http://localhost:3000/ffmpeg-worker-mp4.js:3502:40819)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
Additional Information
Please include any additional information necessary here. Including the following:
versions
videojs
4.1.1
ffmpeg.js
3.1.9001
browsers
Chrome
OSes
Mac
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
It’s not released yet (at time of this writing) but you can install master branch using:
npm install https://github.com/collab-project/videojs-record.git
How do i get videojs.record 4.2.0?