[mediacapture-record] mimeType ambiguity: "video/webm;codecs=vp8" means? (#194)

jan-ivar has just created a new issue for https://github.com/w3c/mediacapture-record:

== mimeType ambiguity: "video/webm;codecs=vp8" means? ==
(Web compat [issue](https://wpt.fyi/results/mediacapture-record/MediaRecorder-peerconnection.https.html?label=master&label=experimental&aligned) from https://github.com/web-platform-tests/wpt/pull/20530). The [following](https://jsfiddle.net/jib1/ok12a8fq/) works in Chrome:
```js
const stream = await navigator.mediaDevices.getUserMedia({video: true, audio: true});
const rec = new MediaRecorder(stream, {mimeType: 'video/webm;codecs=vp8'});
rec.start();
```
...but fails in Firefox with `NotSupportedError: MediaRecorder.start: An audio track cannot be recorded: video/webm;codecs=vp8 indicates an unsupported codec`

If we add `opus` [then it works](https://jsfiddle.net/jib1/ok12a8fq/8/) in both:
```js
const stream = await navigator.mediaDevices.getUserMedia({video: true, audio: true});
const rec = new MediaRecorder(stream, {mimeType: 'video/webm;codecs=vp8,opus'}); //<--
rec.start();
```

Who's right? The spec isn't super clear. They should work the same. The type is valid:
```js
MediaRecorder.isTypeSupported('video/webm;codecs=vp8') // true
```
...so `video/webm;codecs=vp8` is a valid mimeType passed to MediaRecorder. But does it mean:
1. Don't record audio, or
2. Use default codec for any audio?

https://tools.ietf.org/html/rfc6381#section-3.1 says *"When the 'codecs' parameter is used, it MUST contain all codecs indicated by the content present in the body part"*, but also calls it *"informative"*.

Chrome fails to include `opus` in the resulting blob type, so that's a bug for sure I think.

But mimeType is historically a descriptor for a body, while in MediaRecorder, we're using it instead as a selector, which may be uncharted territory.

E.g. 'video/' in a mimeType descriptor may imply audio. Does it also imply audio as a selector?

Please view or discuss this issue at https://github.com/w3c/mediacapture-record/issues/194 using your GitHub account

Received on Friday, 7 February 2020 20:47:17 UTC