Skip to main content


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: Does Opus work properly with 24-bit input files? (Read 4769 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Does Opus work properly with 24-bit input files?

I know that Opus uses the Speex resampler to resample all input to 48 kHz, but does it also automatically dither files to 16-bit if they are in a 24-bit format? I couldn't find any information about it other than this post (which says that "Opus cannot accept 24 bit integer samples directly") and would like to convert some 24-bit FLAC files to Opus.

I have tried it with opusenc 1.3 and it produces working files, but obviously if it is best practice to first dither the files to 16-bit using SoX or another program, I'd like to do that.

Re: Does Opus work properly with 24-bit input files?

Reply #1
if you have read the next post =
Quote from: jmvalin
Opus itself supports 24-bit audio and can handle all of the dynamic
range (and then some). I *think* the opusenc command-line tool can
handle 24-bit wav files, but I could be wrong (if not it's something
that needs to be added).
that tell you that it can handle all the dynamic range of 24 bits audio and that the problem was probably was in the opusenc command line, this been more then 3 years ago... today I can affirm that if you put 24 bits audio it isn't down sampled to 16 bits, it even accepts 32 bits float audio and opusdec supports output to 16 bits and 32 bits float. Also opusdec is the one that dithers the output when the audio is decoded to 16 bits.

In reality the audio is converted to an internal representation, I don't know its internal precision but I guess that is going to be 32 bits float, 48 bits int or something in that line. This is common for lossy codecs and even MP3 supports 24 bits audio, but most encoders and decoder are incapable of it.

Re: Does Opus work properly with 24-bit input files?

Reply #2
Opus is a lossy codec and does not really have an internal sample size, so the idea of dither is somewhat moot.  On decoding, Opus can output 16 bit integer or float samples, but that does not mean that it stores audio data internally as either 16 bit integer or float samples.  The actual internal representation depends on software and hardware architecture, will be integer for float depending on the nature of the arithmetic, with a word size sufficient to avoid inaccuracies.  Opus explicitly allows for configuration of a meaningful bit depth to allow bits below any noise floor to be ignored, and this is set by default at 24 bits per sample, so 24 bit audio should always be encoded as transparently as possible given the configured bitrate.


Re: Does Opus work properly with 24-bit input files?

Reply #3
Awesome, thanks! Then I'm going to encode them just as usual! :)

SimplePortal 1.0.0 RC1 © 2008-2021