w3c / mediacapture-record

MediaStream Recording
https://w3c.github.io/mediacapture-record/
Other
104 stars 21 forks source link

Ability to specify constant bit rate encoding in MediaRecorder options. #183

Closed ghost closed 3 years ago

ghost commented 4 years ago

I'm working on a project where we use the MediaRecorder to compress audio to Opus. I need a constant bitrate (CBR) file and while it is possible to specify the audio bitrate to the MediaRecorder, it isn't possible to disable the VBR mode of the Opus encoder, which causes it to use the bitrate as an average bitrate (ABR mode).

I'd like to add an option to MediaRecorder to specify that I'd like a CBR audio file to be encoded, for example:

const mediaRecorder = new MediaRecorder(stream, {
  mimeType: 'audio/webm; codecs=opus',
  audioBitsPerSecond: 128000,
  audioConstantBitRate: true
});