Jack Asa
Jack Asa

Reputation: 21

MediaRecorder on Chrome produces a truncated mp4 with the 'avc1' mediaType

When using MediaRecorder on Chrome (Javascript on windows) with the avc1 option on chrome the generated blob is truncated as opposed to the vp9 option,

Here are the 2 options as explained in Recording video from webcam in MP4 format with MediaRecorder,

//const recorder = new MediaRecorder(stream, { mimeType: "video/mp4;codecs=avc1,mp4a.40.2" });
//const recorder = new MediaRecorder(stream, { mimeType: "video/mp4;codecs=vp9,opus" }

When using

var blob=new Blob(cF.chunks,typeOption);

This one is truncated:

Blob {size: 581270, type: 'video/mp4;codecs=avc1,mp4a.40.2'}

This one is fine:

Blob {size: 1028223, type: 'video/mp4;codecs=vp9,opus'}

Any idea why the file is truncated in the first option?

Upvotes: 1

Views: 95

Answers (2)

Felix Turner
Felix Turner

Reputation: 1473

"video/mp4;codecs=avc1,opus" works on Chrome/MacOS but often fails on Chrome/Android/Pixel7a creating a bogus truncated file. I wasn't able to find an MP4 codec that works consistently on Chrome/Android, went with webM export instead.

Upvotes: 0

vrobbi
vrobbi

Reputation: 76

Second my opinion mp4 format does not support mp4a.40.2 codecs, instead it works with opus audio codec. For me this follow row works fine (I tested it on chrome 126): 'video/mp4;codecs="avc1,opus"'

Upvotes: 0

Related Questions