JamesHeinrich / getID3

http://www.getid3.org/
Other
1.15k stars 245 forks source link

memory error analyzing chrome generated webm #285

Open millzee01 opened 3 years ago

millzee01 commented 3 years ago

Hi,

I use mediarecorder and capturestream to record canvas animations to webm,

The video output works fine in the browser, however when I upload the generated webm to php and analyze it using:

$ThisFileInfo = $getID3->analyze($file);

If the file is created with any chromium browsers, my server errors out with a memory error: PHP Fatal error: Out of memory (allocated 2097152) (tried to allocate 72057594037927968 bytes) in /var/www/html/objects/getid3/getid3.php on line 2063

the webm file is actually only 2mb.

If i use firefox to create the webm and upload, i have no problems at all.

any ideas why a chromium generated webm causes this issue?

The video contains no audio, just video.

JamesHeinrich commented 3 years ago

Can you supply both a working (Firefox) and broken (Chrome) sample file for me to look at?

millzee01 commented 3 years ago

sure

These were created without ts-ebml intervention: https://lnk-mi.app/uploads/chrome.webm https://lnk-mi.app/uploads/firefox.webm

These were created using ts-ebml: https://lnk-mi.app/uploads/chrome-ts-ebm.webm https://lnk-mi.app/uploads/firefox-ts-ebml.webm

both were created exactly the same way using ts-ebml.js to write the meta-data recorder.addEventListener("dataavailable", async(e) => { try { const makeMediaRecorderBlobSeekable = await injectMetadata(e.data); data.push(await new Response(makeMediaRecorderBlobSeekable).arrayBuffer()); blobData = await new Blob(data, { type: supportedType }); } catch (e) { console.error(e); console.trace(); } });

both firefox files are noticeably bigger, however chrome video play fine in firefox and firefox videos play fine in chrome.

both firefox videos analyze fine with getid3, however the chrome ones cause a memory problem.

JamesHeinrich commented 3 years ago

Presumably its due to an incomplete EBML implementation in getID3, but since it's a detected abnormality and not an actual crashing error I'm going to defer this for now. If someone more familiar with Matroska structure than I would like to submit a patch I would be interested. I'll leave this issue open, but I don't expect to apply a fix anytime soon.

millzee01 commented 3 years ago

Ok, thanks. i've switched to decoding the video with whammy on chrome which resolved my initial issue.

But like you said, its worth keeping open so anyone else with the same kind of problem has somewhere to potentially go.