Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

MediaRecorder does not resample Opus input audio

  • 3 replies
  • 1 has this problem
  • 1 view
  • Last reply by raycarino

more options

I'm on firefox 59. My microphone records audio at a sample rate of 44.1khz. Per OpusTrackEncoder https://github.com/mozilla/gecko-dev/blob/a341b32d064bafac5422f72fef6afe740045105c/dom/media/encoder/OpusTrackEncoder.cpp#L162 and this bug https://bugzilla.mozilla.org/show_bug.cgi?id=922247, I would have expected a MediaRecorder to emit ogg-opus audio at 48khz, but it's still 44.1khz after inspecting the ogg header.

Am I wrong in undrestanding that MediaRecorder should resample to 48khz if the microphone's sample rate is non-standard?

I'm on firefox 59. My microphone records audio at a sample rate of 44.1khz. Per OpusTrackEncoder https://github.com/mozilla/gecko-dev/blob/a341b32d064bafac5422f72fef6afe740045105c/dom/media/encoder/OpusTrackEncoder.cpp#L162 and this bug https://bugzilla.mozilla.org/show_bug.cgi?id=922247, I would have expected a MediaRecorder to emit ogg-opus audio at 48khz, but it's still 44.1khz after inspecting the ogg header. Am I wrong in undrestanding that MediaRecorder should resample to 48khz if the microphone's sample rate is non-standard?

All Replies (3)

more options

Forgot to mention that I'm using the MediaRecorder like so: https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder#Example

more options

This topic might be beyond the expertise of this forum. There is a developer mailing list for media-related topics that might be a good place to try next:

https://lists.mozilla.org/listinfo/dev-media

more options

Thank you jscher2000!