On Thursday, July 19, 2018 at 10:25:05 PM UTC-7, [email protected] wrote:
> On Thursday, July 19, 2018 at 2:47:13 AM UTC-7, Timothy B. Terriberry wrote:
> > raycarino--- via dev-media wrote:
> > >>> I'm on firefox 59. My microphone records audio at a sample rate of 
> > >>> 44.1khz. However, MediaRecorder outputs OGG Opus audio at 48khz.
> > >>
> > >> This is what you wanted, right?
> > > Thank you for the quick reply!
> > > 
> > > Sorry, for the typo. Expected: 48kHz output. Actual is 44.1kHz. It seems 
> > > that the resampling logic either failed or wasn't reached.
> > 
> > No worries. I figured there was a typo somewhere, just trying to figure 
> > out exactly where.
> > 
> > The Ogg Opus file format does not actually support encoding 44.1 kHz 
> > audio directly, so unless you can hear some sort of weird pitch shifting 
> > going on, that means it hit the resampling logic correctly.
> > 
> > What it does do is store the original sampling rate in the header as 
> > metadata. That lets other tools resample back to the original sampling 
> > rate if that is appropriate. E.g., if the input was originally 44.1 kHz, 
> > it's normal to resample back to 44.1 kHz when decoding to a file to 
> > avoid surprises for users who don't know that Opus internally only 
> > supports sample rates that evenly divide 48 kHz. But if you were just 
> > playing the file back, you'd normally skip that resampling as most 
> > soundcards run at 48 kHz natively.
> > 
> > I hope that helps!
> It does. Thank you so much Timothy and Andreas!
> 
> Re: Andreas' question about how I'm checking the output files. 
> I was only checking the input sample rate section of the OGG header. I 
> expected it be the encoded sample rate, but that assumption was wrong and 
> clarified by Timothy.

I have a follow on question. What's the best way to determine an Ogg Opus 
file's encoded sample rate?

I've tried ffprobe as suggested by Andreas like so:
$: ffprobe -show_streams dicto_44.1_label.ogg
>>>
...
[STREAM]
...
sample_rate=48000
...
[/STREAM]

Does this ffprobe command prove the file is encoded at 48kHz? In my mind, it's 
also possible that the [STREAM] section's sample rate could also be the 
decoding sample rate per the RFC's spec "1.  If the hardware supports 48 kHz 
playback, decode at 48 kHz." https://tools.ietf.org/html/rfc7845#section-5.1.
_______________________________________________
dev-media mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-media

Reply via email to