MediaRecorder Chrome Codec/Container not playable on Mobile or Safari

Viewed 264

Goal: use MediaRecorder (or else) api to produce video files that are viewable cross platforms.

Fail: current api falls back to container/codec on google chrome which is only viewable on chrome and advanced desktop media players but not on Safari or mobile devices.

! Same code when running on safari generates a working video file on all platforms.

    const mimeType = 'video/webm;codecs=H264'
    rec = new MediaRecorder(stream.current, { mimeType })
    rec.ondataavailable = e => blobs.push(e.data)
    rec.onstop = async () => {
      saveToFile(new Blob(blobs, { type: mimeType }))
    }

Tried all different combinations of containers and codecs. also tried to override the mimeType of the Blob with MP4 file container. No success what so ever.

also tried:

https://github.com/streamproc/MediaStreamRecorder

https://github.com/muaz-khan/RecordRTC

Same issues. iI seems like chrome's container/codec combinations always fall back to a format that is only viewable out of the box on chrome or a powerful desktop video player like vlc.

enter image description here

The only cross platform working example for me is the one taken from safari browser and is the 5th from left in the picture above.

The Question:

Edit - (We don’t allow questions seeking recommendations for books, tools, software libraries, and more. Edit the question so it can be answered with facts and citations)

What is the correct container/codac to be used in MediaCapture api to make the output file playable cross platform.

1 Answers

We have the same issue. We have tried many different combinations but always it fallbacks to matroska

Related