Skip to content

After processing 2/3 frames I am always getting an error with corrupted output #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Smithangshu opened this issue Apr 24, 2020 · 7 comments

Comments

@Smithangshu
Copy link

Hi @Kagami

I am trying to use like following in order to convert webm to mp4.

const worker = new Worker("js/ffmpeg-worker-mp4.js"); worker.onmessage = function (e) { const msg = e.data; switch (msg.type) { case "ready": var testData = new Uint8Array(d); worker.postMessage({ type: "run", TOTAL_MEMORY: 256 * 1024 * 1024, MEMFS: [{ name: "test.webm", data: testData }], arguments: ["-i", "test.webm", "-c:v", "libx264", "-vf", "scale='bitand(oh*dar,65534)':'min(720,ih)'", "out.mp4"] }); break; case "stdout": console.log(msg.data); break; case "stderr": console.log(msg.data); break; case "done": console.log(msg.data); var data = msg.data.MEMFS[0].data; var url = URL.createObjectURL(new Blob([data.buffer], { type: 'video/mp4' })); var video = $('#video')[0]; video.src = url; video.oncanplaythrough = function () { video.play(); }; break; case "exit": break; } };

But ending up with following error

frame= 2 fps=1.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x frame= 3 fps=1.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x frame= 3 fps=0.8 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x OOM OOM exception thrown: Error: abort(OOM). Build with -s ASSERTIONS=1 for more info.,Error: abort(OOM). Build with -s ASSERTIONS=1 for more info. at C (http://localhost:27963/js/ffmpeg-worker-mp4.js:7:215) at C (http://localhost:27963/js/ffmpeg-worker-mp4.js:16:97) at emscripten_resize_heap (http://localhost:27963/js/ffmpeg-worker-mp4.js:219:528) at esa (http://localhost:27963/js/ffmpeg-worker-mp4.js:119:149230) at Xra (http://localhost:27963/js/ffmpeg-worker-mp4.js:43:527368) at bsa (http://localhost:27963/js/ffmpeg-worker-mp4.js:99:197847) at asa (http://localhost:27963/js/ffmpeg-worker-mp4.js:123:12975) at Zfa (http://localhost:27963/js/ffmpeg-worker-mp4.js:115:1623) at nka (http://localhost:27963/js/ffmpeg-worker-mp4.js:47:292472) at Array.kpa (http://localhost:27963/js/ffmpeg-worker-mp4.js:27:1162)

I am trying with Chrome for Android.
Please help me to solve the issue.

@Kagami
Copy link
Owner

Kagami commented Apr 24, 2020

Try -preset ultrafast option (add to arguments).

@tpetry
Copy link
Contributor

tpetry commented Apr 24, 2020

Encoding for the baseline profile may help too as much less optimizations are done so less memory consumed.

@Smithangshu
Copy link
Author

Smithangshu commented Apr 24, 2020

Thanks! It worked but its too slow..It took 20 mins to convert 5 seconds video. Is there any solution for that? Basically my scenario is to record video with MediaRecorder API then convert it to MP4. Can you please provide me with any solution for that?

@Smithangshu
Copy link
Author

Smithangshu commented Apr 24, 2020

Encoding for the baseline profile may help too as much less optimizations are done so less memory consumed.

Are you suggesting me to add this -profile:v baseline?

@Kagami
Copy link
Owner

Kagami commented Apr 24, 2020

Is there any solution for that

#10 #65 #95

@Kagami Kagami closed this as completed Apr 24, 2020
@tpetry
Copy link
Contributor

tpetry commented Apr 24, 2020

I would also guess your scale filter is too memory intensive. I dont know what it does, but its not a normale scale filter.

@Kagami
Copy link
Owner

Kagami commented Apr 25, 2020

Issue for OOM is here: #83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants