MediaRecorder: Add support for video/webm;codecs=h264, video/webm;codecs=avc1, video/x-matroska;codecs=h264, video/x-matroska;codecs=avc1
Categories
(Core :: Audio/Video: Recording, enhancement)
Tracking
()
People
(Reporter: guest271314, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
|
586 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (X11; Linux i686; rv:69.0) Gecko/20100101 Firefox/69.0
Steps to reproduce:
- console.log(
MediaRecorder.isTypeSupported("video/webm;codecs=h264")
, MediaRecorder.isTypeSupported("video/webm;codecs=avc1")
, MediaRecorder.isTypeSupported("video/x-matroska;codecs=h264")
, MediaRecorder.isTypeSupported("video/x-matroska;codecs=h264")
);
Actual results:
- false false false false
Expected results:
- true true true true
The WebM container guidelines https://www.webmproject.org/docs/container/ does not state that the codecs used MUST be VP8, VP9, Vorbis, Opus, or Ogg
Demuxer and Muxer Guidelines
- Video codec SHOULD be VP8 or VP9.
- Audio codec SHOULD be Vorbis or Opus
Chromium 77 returns true for each of MediaRecorder.isTypeSupported("video/webm;codecs=h264") , MediaRecorder.isTypeSupported("video/webm;codecs=avc1"), MediaRecorder.isTypeSupported("video/x-matroska;codecs=h264"), MediaRecorder.isTypeSupported("video/x-matroska;codecs=h264").
Re
https://bugzilla.mozilla.org/show_bug.cgi?id=1422891#c11
"There are no technical reasons here. We just hope the internet can be as simple as possible and hesitate to support more formats. But if it is really popular, we will consider supporting it. Bug 1429986 is to check how many attempts to play mkv on Firefox and we will check if we should support it or not."
and
https://bugzilla.mozilla.org/show_bug.cgi?id=1562862#c3
"Google are the ones who set the spec on what is allowed in a webm. So that they could generate something against their own spec is really baffling."
The purported original intent of simplcity and the evident decision to support "video/webm;codecs=h264" and "video/webm;codecs=avc1" even if actually encoded as a Matroska file may be baffling to some, though the fact is that "all the cool kids are doing it" already.
Related:
Comment 1•6 years ago
|
||
| Reporter | ||
Comment 2•1 month ago
|
||
This works on Chromium 142 Devloper Build
if (MediaRecorder.isTypeSupported("video/x-matroska;codecs=opus")) {
var stream = await navigator.mediaDevices.getUserMedia({
audio: true
});
var recorder = new MediaRecorder(stream, {
mimeType: "video/x-matroska;codecs=opus"
});
recorder.start();
var p = Promise.withResolvers();
recorder.ondataavailable = (e) => {
console.log(e.data);
p.resolve(e.data);
}
var blob = await new Promise((r) => setTimeout(r, 1000))
.then(() => recorder.stream.getAudioTracks()[0].stop())
.then(() => p.promise);
console.log(blob.type);
await new Audio(URL.createObjectURL(blob)).play();
}
| Reporter | ||
Comment 3•1 month ago
|
||
var handle = await showSaveFilePicker({suggestedName: "media-recorder-matroska-opus.mkv", startIn: "downloads"});
await blob.stream().pipeTo(await handle.createWritable());
mkvmerge -J media-recorder-matroska-opus.mkv
{
"attachments": [],
"chapters": [],
"container": {
"properties": {
"container_type": 17,
"duration": 2939450928,
"is_providing_timestamps": true,
"muxing_application": "Chrome",
"writing_application": "Chrome"
},
"recognized": true,
"supported": true,
"type": "Matroska"
},
"errors": [],
"file_name": "media-recorder-matroska-opus.mkv",
"global_tags": [],
"identification_format_version": 17,
"track_tags": [],
"tracks": [
{
"codec": "Opus",
"id": 0,
"properties": {
"audio_bits_per_sample": 32,
"audio_channels": 1,
"audio_sampling_frequency": 48000,
"codec_id": "A_OPUS",
"codec_private_data": "4f707573486561640101000080bb0000000000",
"codec_private_length": 19,
"default_track": true,
"enabled_track": true,
"forced_track": false,
"language": "eng",
"minimum_timestamp": 0,
"number": 1,
"uid": 54964071908856704
},
"type": "audio"
}
],
"warnings": []
}
Input #0, matroska,webm, from 'media-recorder-matroska-opus.mkv':
Metadata:
encoder : Chrome
Duration: 00:00:02.94, start: 0.000000, bitrate: 132 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
| Reporter | ||
Comment 4•1 month ago
|
||
Don't do whatever Chromium is doing for recording (probably still not including duration) though. ffplay just keep going after the 1 second audio recording, necessaitating CTRL+C.
Description
•