
Opus Audio Codec – FAQ - 8bitsrule
https://wiki.xiph.org/index.php?title=OpusFAQ
======
indolering
I really wish Opus would make it into wireless speakers and headphones. From
what I've read, it might not be the most power-efficient format, however, and
those tiny earbuds need to be /really/ efficient.

But I also suspect that popular wireless codecs (i.e. Dolbly's AptX, MPEG's
AAC, and Samsung's Scalable) are powered by marketing fluff. I'd love an
informed opinion :D

~~~
telesilla
APT-x is very good, low latency codec. It's been around a long time and is not
marketing fluff. Some AAC codecs are also very well made for specific
purposes. Opus is too high latency for headphones.

~~~
sp332
The lowest number I can find for "low-latency Apt-X" is 32 ms end-to-end over
Bluetooth. Opus frames default to 20 ms wide but can be configured as small as
2.5 ms, so I don't think it's going to slow things down very much.

------
lozf
The _only point_ in lossy encoding is to _save space / bandwidth_. Opus excels
at getting good sound quality at lower bitrates.

If there's a talk or lecture on Youtube that you're about to grab, try the
50kbps Opus version and save your limited space for more important things, but
you might need to remux from webm to an ogg container for compatibility.

    
    
        e.g. youtube-dl -f249 $URL  --exec 'ffmpeg -i {} -vn -c:a copy {}.ogg'

~~~
derf_
You can replace the --exec 'ffmpeg ...' with just -x (or the long form
--extract-audio).

~~~
lozf
Yes, but with opus, that only put's the audio in a .opus container, which
isn't as widely compatible as the .ogg container.

~~~
derf_
It is literally the same bits. Feel free to change the extension if that helps
(it does on some old Android versions, for sure).

Source: I am a co-author on RFC 6716 and RFC 7845.

~~~
lozf
Oh, good to know, thanks :)

------
richard_todd
Opus is weird because it can use fewer bits to encode complex sounds, and more
bits on simple sounds. MP3/Vorbis/AAC all do the opposite. I’ve read it is
because it has relatively poor frequency precision, for which it gains
excellent time precision. So, on purer sounds it has to use more bits to
maintain accuracy. But it’s so counterintuitive, that when I also consider it
can’t do a 44.1k sample rate, I stick with vorbis for high-bitrate CD rips,
just so I don’t have to wonder if artifacts are hiding somewhere. I think most
of the testing by far has been on the low-bitrate encoding where it really
excels.

Edit to add: I had my whole collection encoded with Opus at one point, and
could never discern it from the FLACs in a few ABX tests I ran. It’s only
theoretical problems that were nagging at me that made me switch back, nothing
I actually heard.

~~~
aurelian15
If you worry about artifacts introduced by sample rate conversion, you
shouldn't use a lossy format in the first place. The sample rate converter
used by Opus (i.e., the speex resampler used in the opus-tools library) is
completely transparent and does not introduce any audible artifacts. As per
[1], the distortion caused by any lossy codec even at the highest bitrates is
larger than that caused by re-sampling.

As for playback, most likely your sound card is already running at 48kHz;
44.1kHz may actually not be supported properly by your DAC (I guess since it
requires a higher quality anti-aliasing filter). As [1] continues to explain,
Opus is essentially shifting the burden of resampling to the encoding rather
than the decoding side of things.

That being said, Opus technically supports odd sample rates such as 44.1kHz,
but this has to be signalled in a side-channel. See [1] downwards.

[1]
[https://wiki.xiph.org/OpusFAQ#What_is_Opus_Custom.3F](https://wiki.xiph.org/OpusFAQ#What_is_Opus_Custom.3F)

edit: clarity

~~~
richard_todd
Yep, I've read all that before. I didn't mean to focus the discussion on the
resampling--what I was trying to get across is, this codec acts differently
than codecs that have been extensively tested and ABXed at high bitrates for
years. I didn't even mention other factors like how it injects noise into
bands on purpose (where you can also find references claiming that's a benefit
and not a downside, of course). It was about a year ago, but beyond my own ABX
testing I looked around quite a bit, and didn't see many high-bitrate tests
out there. All the focus seemed to be on the 64kbit range.

This should not matter to me personally, as I have proven to myself that
pretty low bitrates are transparent to me, regardless of the codec. But... I
have the same psychosis that a lot of people have, where I _think_ I can hear
differences when I know which is which.

If space were an issue I'd use 90kbit/s opus (that was the threshold for me in
my testing). It's actually pretty amazing, but since I have the storage space,
I archive FLAC and carry around 256kbit/s vorbis, and don't even question the
quality. It's easier to use more space than to fix my faulty perception!

------
mxmilkb
[https://github.com/erikd/libsndfile/blob/master/NEWS#L2](https://github.com/erikd/libsndfile/blob/master/NEWS#L2)
"Version 1.0.29 (2020-08-15) * Add support for Opus files."

~~~
nitrogen
Given that the patents on MP3 have expired, maybe libsndfile will finally
support it...

~~~
mxmilkb
That's
[https://github.com/erikd/libsndfile/issues/258](https://github.com/erikd/libsndfile/issues/258)

------
ksec
20 years ago we all wanted 128Kbps MP3 Quality at half the bitrate, AAC-LC (
Yes they somehow market it that way ), MP3 Pro, HE-AAC etc. And yet 20+ years
later no single Codec can produce MP3 128Kbps quality at 64Kbps.

It was hard to imagine then, but not only do we now have cheap enough storage
to store more music that you will ever listen, bandwidth and Internet speed
has becomes so cheap we can now afford to stream it.

So in an interesting turn of event, the major usage is now 128Kbps and above.
So often I see lots of 1-2Mbps Video Files having 256Kbps AAC within it. (
Normally you would put 128Kbps Audio and save those bitrate for Video ) And
bandwidth and Data are only going to be cheaper in the coming 10 years.

In terms of Standard 128Kbps bitrate and above, AAC-LC in on par with Opus.
And AAC-LC is officially patent free, as all patent has expired. HE-AAC v1
will be patent free as well in 3 years time.

Unless you are doing anything that focus on sub 64Kbps, you have an Audio
Codec that is not just royalty free with patent grant, but free of patents,
and it is extremely good.

I hope one day we would have a decent patent free video codec too.

~~~
widerporst
>And yet 20+ years later no single Codec can produce MP3 128Kbps quality at
64Kbps

I don't have any hard data on this, but I'm pretty sure that Opus produces
better quality audio at 64 kbps than a 2000 MP3 encoder does at 128 kbps. A
current version of LAME will probably be as much better than some old
Fraunhofer encoder as Libopus is better than LAME.

~~~
lozf
As always with lossy audio, different codecs have different "killer samples",
but here are a couple of results from experienced testers that support the
assertion that Opus at 64kbps is suitable as a modern replacement for 128kbps
LAME MP3:

[https://hydrogenaud.io/index.php?topic=117489](https://hydrogenaud.io/index.php?topic=117489)

[https://hydrogenaud.io/index.php?topic=119424](https://hydrogenaud.io/index.php?topic=119424)

------
xellisx
Site has been hugged.

On another point, is Opus a popular format, given that alot of people now
stream stuff mostly? IIRC, some of the Quake engines support it.

~~~
TylerE
I have never seen an Opus file in the wild.

MP3 and FLAC are by far still dominant. Ogg is still popular I. It’s niche (eg
game sounds, and I think Spotify uses it too)

~~~
gruez
Is there a reason why mp3 is still around? AAC has better compression ratios,
and support is a non-issue. Maybe mp3 has better brand recognition? Most
people know what a mp3 is, but probably wouldn't know what AAC or a .m4a is.

~~~
lozf
The roll-out of AAC (which was designed to address the problems with MP3, but
was not backwards compatible) was slowed a bit by expensive licensing fees for
hardware manufacturers and the lack of a good free encoder (though there were
some very poor implementations)...

By the time this was sorted MP3 had gained massive popularity on "teh scene"
and was soon followed by napster etc - the rest is history, so yes it's all
about the "brand recognition" now sadly.

Most people could have a better sounding music collection in about half the
size required for MP3 safely... still at least disk space is cheap these days.

The unfixable problem of MP3s "shortest allowable blocksize" causing audible
smearing on transients will be with us until the format is abandoned, but I
won't hold my breath.

These days for the best quality lossy audio you want AAC-LC encoded with
either Apples encoder or the open source FDK-AAC by Fraunhofer (developed for
Android) but fully cross platform... or Opus for a completely free and open
codec , but still not yet as widely compatible.

~~~
jumelles
> massive popularity on "teh scene"

More than that - scene releases _required_ MP3 (LAME V2 IIRC) to be used.

------
andai
Opus uses a neural network to determine which codec to use:
[https://jmvalin.ca/opus/opus-1.3/](https://jmvalin.ca/opus/opus-1.3/)

------
mhammerc
I had good times with Opus.

We have been capturing then encoding audio using Opus from a low-power chip
(nRF52840) then sent encoded data through BLE.

Worked liked a charm! Encoding used 50% of the CPU time.

------
shmerl
Opus is great. I encode all my music in Opus for playback (after buying it in
FLAC).

Are all browsers supporting it now? I remember in the past Apple staunchly
refused to support Opus and Ogg container. Is it better now after they joined
Alliance for Open Media?

~~~
jmvalin
All major browsers now implement WebRTC, including Opus support. Also, most
browsers now support Opus playback in HTML5, though AFAIK Safari only supports
it in the CAF container. See
[https://caniuse.com/#search=opus](https://caniuse.com/#search=opus)

~~~
shmerl
_> FAIK Safari only supports it in the CAF container_

Apple being Apple. While they "support" it, looks like they can't even do it
properly.

------
spacechild1
I've been using libopus as the main codec for my audio streaming library. It
has all I need: good compression/quality ratio, low latency and multichannel
support. Also, the API is quite simple and well designed!

------
roddylindsay
Opus is awesome. Up to 255 audio channels supported!

