How to figure out supported MediaRecorder audio mimetypes?


#1

I’ve been doing trial & error but it’s quite annoying:

19:38:26.407 MediaRecorder.isTypeSupported(‘audio/webm’)
19:38:26.369 false
19:38:39.670 MediaRecorder.isTypeSupported(‘audio/webm;codecs=opus’)
19:38:39.623 false
19:39:09.886 MediaRecorder.isTypeSupported(‘audio/webm;codecs=opus’)
19:39:09.848 false
19:39:28.301 MediaRecorder.isTypeSupported(‘audio/webm;codecs=pcm’)
19:39:28.260 false
19:40:26.589 MediaRecorder.isTypeSupported(‘audio/ogg’)
19:40:26.549 true
19:42:13.451 MediaRecorder.isTypeSupported(‘audio/pcm’)
19:42:13.405 false

Right now, I’m checking out the full firefox repo in the hopes that
I’ll be able to find references to these container/codec
specifications in the source somewhere. (But I guess you immediately
split that string, so I will be out of luck when searching something
like “audio/webm”…)


#2

Did find it in the repo after all:
https://dxr.mozilla.org/mozilla-central/source/dom/media/MediaRecorder.cpp#1527
(gOggAudioEncoderCodecs)

So, apparently at least as of right now, MediaRecorder only supports vp8 for video and opus for audio.
Which I’m not necessarily writing in a judgmental manner because ~264 kbit for recording crappy webcam audio is probably plenty for reencoding by Youtube.
But I guess you might hear from audiophiles sooner or later if you haven’t already…