Skip to main content
Topic: Opus sample-rate (Read 1221 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Opus sample-rate

I don't get it, where do I find the sample-rate of the PCM from a decoded Opus stream? I can only see where the the original sample rate is in the header.

https://wiki.xiph.org/OggOpus#ID_Header

Re: Opus sample-rate

Reply #1
Isn't it supposed to be always 48000?

EDIT: A little further down there's what seems to be the answer you need:

Quote
Opus has a handful of coding modes, with internal audio bandwidths of 4, 6, 8, 12, and 20 kHz. Each packet in the stream may have a different audio bandwidth. Regardless of the audio bandwidth, the reference decoder supports decoding any stream at a sample rate of 8, 12, 16, 24, or 48 kHz. The original sample rate of the encoder input is not preserved by the lossy compression.

An Ogg Opus player SHOULD select the playback sample rate according to the following procedure:

    If the hardware supports 48 kHz playback, decode at 48 kHz,
    else if the hardware's highest available sample rate is a supported rate, decode at this sample rate,
    else if the hardware's highest available sample rate is less than 48 kHz, decode at the next higher supported rate and resample,
    else decode at 48 kHz and resample.

Re: Opus sample-rate

Reply #2
I don't get it, where do I find the sample-rate of the PCM from a decoded Opus stream? I can only see where the the original sample rate is in the header.

https://wiki.xiph.org/OggOpus#ID_Header

That is specification for the Ogg container when holding Opus.  The actual sampling rate of a given Opus packet is specified in the underlying Opus bitstream:

https://tools.ietf.org/html/rfc6716

See table 2.

 
SimplePortal 1.0.0 RC1 © 2008-2019