### Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How does the opus encoder deal with a 24-bit source? (Read 2837 times)
0 Members and 1 Guest are viewing this topic.

## How does the opus encoder deal with a 24-bit source?

##### 2019-10-04 10:53:38
I know opusenc can take a 24-bit audio file as an input.

But I want to know if the source audio file will be converted to 16-bit first and then be encoded into an opus file.

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #1 – 2019-10-04 11:35:02
As far as I know everything is converted to 16/48 before it's encoded. Also if you need to keep the 24 bit depth I suggest to use a lossless codec instead of a lossy codec. In practice the bitdepth can get lower than 16 bit theoretically.

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #2 – 2019-10-04 11:38:38
As far as I know everything is converted to 16/48 before it's encoded. Also if you need to keep the 24 bit depth I suggest to use a lossless codec instead of a lossy codec.

I don't prefer 24-bit over 16-bit (can't hear the difference), I am just curious.

In practice the bitdepth can get lower than 16 bit theoretically.

Could explain what does that mean?

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #3 – 2019-10-04 12:42:21
Actually all input is converted to 32-bit floating point and processed in that format.

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #4 – 2019-10-04 16:40:45
Actually all input is converted to 32-bit floating point and processed in that format.

Correct. It still means you won't be keeping the (theoretically) very low noise of your 24-bit recording (for that you need lossless). However, you *will* be keeping all of the dynamic range. Opus is capable of representing the full 24-bit dynamic range, and then some.

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #5 – 2019-10-04 17:27:06
But I want to know if the source audio file will be converted to 16-bit first and then be encoded into an opus file.

Almost all practical PC lossy encoders use floating point, so everything gets converted to 32 bit.

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #6 – 2019-10-04 23:04:17
except fdk-aac, I think
some ANC'd headphones + AutoEq-based impulse + Meier Crossfeed (30%)

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #7 – 2019-10-05 01:37:36
fdk-aac must deal with clipped integer samples, and is hard coded to specific integer precision. I even tried decoupling that a bit, to support fixed point that exceeds ±1.0, but the SBC and/or PS code break horribly if the input and output aren't clipped first.

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #8 – 2019-11-30 13:50:10
Actually all input is converted to 32-bit floating point and processed in that format.

Correct. It still means you won't be keeping the (theoretically) very low noise of your 24-bit recording (for that you need lossless). However, you *will* be keeping all of the dynamic range. Opus is capable of representing the full 24-bit dynamic range, and then some.

I thought low noise and high dynamic range were the same thing - dynamic range being the decibels between the quietest intentional sound above the noise floor and the loudest sound. So the only way to have high dynamic range is to have a low noise floor.

And that 16 bits already provides enough at listening levels where the peak won't cause hearing damage (or be distorted by speakers), 24-bits only being of real value during mastering.

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #9 – 2019-11-30 16:22:48
I thought low noise and high dynamic range were the same thing - dynamic range being the decibels between the quietest intentional sound above the noise floor and the loudest sound. So the only way to have high dynamic range is to have a low noise floor.

And that 16 bits already provides enough at listening levels where the peak won't cause hearing damage (or be distorted by speakers), 24-bits only being of real value during mastering.
Actually they are not the same thing and this is made clear with float point numbers, there are various definitions for snr and dr. On definition being: "Dynamic range in dB is the sum of the signal-to-noise ratio in dB plus the headroom in dB", with this definition:

16bit integer:
snr= 6 x number of bits= 6 x 16 = 96db
dynamic range = 96+0 = 96db

16bit IEEE half precision float
snr=6 x 2^(bits in exponent)= 6 x 2^5 = 192db
headroom= 6 x (2 + bits in mantissa) = 6 x (2 + 10) = 72db
dynamic range= 192+72 = 264db
altrough in floats I actually like to consider the precission as the real snr and in this case is 6 x (1 + bits in mantissa) = 66db.

PD. I'm not sure of the float point calculation but at worst the error is no more than 12db.

## Re: How does the opus encoder deal with a 24-bit source?

##### Reply #10 – 2019-11-30 23:33:00
fdk-aac must deal with clipped integer samples, and is hard coded to specific integer precision. I even tried decoupling that a bit, to support fixed point that exceeds ±1.0, but the SBC and/or PS code break horribly if the input and output aren't clipped first.
A bit sad result, but still pretty interesting experiment
I thought low noise and high dynamic range were the same thing - dynamic range being the decibels between the quietest intentional sound above the noise floor and the loudest sound. So the only way to have high dynamic range is to have a low noise floor.
The thing is, noise floor doesn't have to be constant. Lossy codecs, if grossly oversimplified, can be said to work by hiding noise under the signal in such a way that when the signal is quiet, noise is also quiet, and so we don't hear the presence of that noise, but it can be pretty loud (when the signal is even louder).
some ANC'd headphones + AutoEq-based impulse + Meier Crossfeed (30%)