Stereo Audio Recordings in Firefox 55 and 56įirefox 55 added support for stereo recordings so I was able to record a video with dual channel (stereo) audio with: Here’s an example using the newer promise based getUserMedia(): var constraints = Using Audio Constraints With getUserMedia()Īll constraints can be sent to getUserMedia() as a property of the audio object inside the constraints object. Use this code pen to check future browser support (does not work in Safari because Safari does not allow getUserMedia() in cross origin iframes). I also tested the latest versions of Chrome, Firefox and Safari to make sure changing the constraints has an effect. I’ve used MediaStreamTrack.getSettings() to log to console the settings supported by each browser as MediaDevices.getSupportedConstraints() returns too many false positives. Adding support for these constraints would open up Opus’ flexibility to developers. Understandably some of them are new (autoGainControl and noiseSuppression) but others (sampleRate, sampleSize, and echoCancellation) were added to the spec as early as February 2014. It works with some webcams and laptops with dual mics.Ī surprisingly comprehensive list – at least when comparing with the options Flash gave us – but just as surprising most of them are not widely supported by browsers. channelCount: specifies the number of channels to use with 1 being mono, 2 being stereo.latency: specified in seconds, controls the time between the start of the sound processing and the data being made available to the next step, not so sure why you’d want higher latency but audio codecs do differ in latency.noiseSuppression: whether or not to try and remove the background noise from the audio signal.autoGainControl: whether or not to modify the volume of the input from the mic.echoCancellation: whether or not to use echo cancellation to try and remove the audio that went to the speakers from the input that comes through the mic.volume: it takes values between 0.0 (silence) and 1.0 (max volume), it’s used as a multiplier for each sample’s value.sampleSize: each sample’s size in bits, higher is better (Audio CDs have a sample size of 16 bits/sample ).sampleRate: specifies a desired sample rate, not sure if it should be used as an encoding setting or as a hardware requirement, higher is better (Audio CDs for example have 44000 samples/s or 44kHz).Here’s the full list with explanations from both the spec and from my knowledge around how digital sound works: The Media Capture and Streams spec governs the cross browser audio options that should be implemented by all browsers and, in it’s latest Candidate Recommendation incarnation, it defines quite a few audio constraints. Tsahi Levent Levi has a great blog post on why Opus is so great. It’s open, royalty free and so flexible it can encode (fullband) music better than the AAC encoder in iTunes but also encode narrowband voice with a latency that’s lower than any other codec’s. Opus is now the default codec for encoding sound in Chrome, Firefox and Safari 11. We were not so sure about HTML5’s audio recording capabilities in Chrome & Firefox when using getUserMedia() and the Media Recorder API as we only saw Opus audio at 48kHz (and Vorbis 44.1 kHz in Firefox 47 and older) while developing both our 1st (WebRTC based) and 2nd generation HTML5 video recorder (Media Recorder API based). Ever since doing our first video recorder back in the 2010s we were able to record single channel audio using NellyMoser’s ASAO codec at up to 44kHz and with Speex at 16kHz using various bitrates. We were well aware of the audio recording capabilities in our legacy Flash based recorder. We started by researching just what kind of audio options are available with HTML5’s new promise based getUserMedia(), the almighty gateway to accessing the user’s webcam and microphone. The No.1 feature request we got this year is the ability to record audio instead of video so we set out to deliver just that, hopefully by the end of the year.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |