Convert webm data streams containing h.264 video to fragmented mp4
npm install webm2mp4-jsvideo/webm; codecs="avc1.42C01E",
sh
$ npm install --save webm2mp4-js
`
Installation with other package managers works similarly.
Writing Fragmented MP4 streams from your web app
Start by including the module in your program.
`js
const webm2mp4 = require('webm2mp4-js')
`
You then can use webm2m4.TransboxingMediaRecorder exactly as if it were native MediaRecorder.
For example
`js
async function go () {
const stream = await navigator.getUserMedia ({video:true, audio: false})
const options = {
videoBitsPerSecond: 500_000,
mimeType: 'video/mp4;codecs="avc1.42C01E"'
}
const mediaRecorder = new webm2m4.TransboxingMediaRecorder(stream, options)
mediaRecorder.ondataavailable = function (event){
/ here's your mp4 payload /
const blob = event.data
}
mediaRecorder.start(10)
}
``