Opus | |
Extension: | .opus[1] |
Nomimecode: | true |
Mime: | audio/ogg [2] audio/opus (RTP)[3] |
Owner: | IETF codec working group |
Type: | Lossy audio |
Contained By: | Ogg, Matroska, WebM, MPEG-TS, ISOBMFF, CAF |
Extended From: | SILK, CELT |
Open: | Yes |
Free: | Yes |
libopus | |
libopus | |
Developer: | Xiph.Org Foundation |
Latest Release Version: | 1.5.2 |
Programming Language: | C89 |
Platform: | Cross-platform |
Genre: | Audio codec, reference implementation |
License: | 3-clause BSD license |
Opus is a lossy audio coding format developed by the Xiph.Org Foundation and standardized by the Internet Engineering Task Force, designed to efficiently code speech and general audio in a single format, while remaining low-latency enough for real-time interactive communication and low-complexity enough for low-end embedded processors.[4] [5] Opus replaces both Vorbis and Speex for new applications, and several blind listening tests have ranked it higher-quality than any other standard audio format at any given bitrate until transparency is reached, including MP3, AAC, and HE-AAC.
Opus combines the speech-oriented LPC-based SILK algorithm and the lower-latency MDCT-based CELT algorithm, switching between or combining them as needed for maximal efficiency. Bitrate, audio bandwidth, complexity, and algorithm can all be adjusted seamlessly in each frame. Opus has the low algorithmic delay (26.5 ms by default)[6] necessary for use as part of a real-time communication link, networked music performances, and live lip sync; by trading off quality or bitrate, the delay can be reduced down to 5 ms. Its delay is exceptionally low compared to competing codecs, which require well over 100 ms, yet Opus performs very competitively with these formats in terms of quality per bitrate.[7]
As an open format standardized through RFC 6716, a reference implementation called libopus is available under the New BSD License. The reference has both fixed-point and floating-point optimizations for low- and high-end devices, with SIMD optimizations on platforms that support them. All known software patents that cover Opus are licensed under royalty-free terms. Opus is widely used as a voice over IP (VoIP) codec in applications such as Discord,[8] WhatsApp, and the PlayStation 4.
Opus supports constant and variable bitrate encoding from 6 kbit/s to 510 kbit/s (or up to 256 kbit/s per channel for multi-channel tracks), frame sizes from 2.5 ms to 60 ms, and five sampling rates from 8 kHz (with 4 kHz bandwidth) to 48 kHz (with 20 kHz bandwidth, the human hearing range). An Opus stream can support up to 255 audio channels, and it allows channel coupling between channels in groups of two using mid-side coding.
Opus has very short latency (26.5 ms using the default 20 ms frames and default application setting), which makes it suitable for real-time applications such as telephony, Voice over IP and videoconferencing; research by Xiph led to the CELT codec, which allows the highest quality while maintaining low delay. In any Opus stream, the bitrate, bandwidth, and delay can be continually varied without introducing any distortion or discontinuity; even mixing packets from different streams will cause a smooth change, rather than the distortion common in other codecs. Unlike Vorbis, Opus does not require large codebooks for each individual file, making it more efficient for short clips of audio and more resilient.
The Opus format is based on a combination of the full-bandwidth CELT format and the speech-oriented SILK format, both heavily modified: CELT is based on the modified discrete cosine transform (MDCT) that most music codecs use, using CELP techniques in the frequency domain for better prediction, while SILK uses linear predictive coding (LPC) and an optional Long-Term Prediction filter to model speech. In Opus, both were modified to support more frame sizes, as well as further algorithmic improvements and integration, such as using CELT's range encoder for both types. To minimize overhead at low bitrates, if latency is not as pressing, SILK has support for packing multiple 20 ms frames together, sharing context and headers; SILK also allows Low Bitrate Redundancy (LBRR) frames, allowing low-quality packet loss recovery. CELT includes both spectral replication and noise generation, similar to AAC's SBR and PNS, and can further save bits by filtering out all harmonics of tonal sounds entirely, then replicating them in the decoder.[9] Better tone detection is an ongoing project to improve quality.
The format has three different modes: speech, hybrid, and CELT. When compressing speech, SILK is used for audio frequencies up to 8 kHz. If wider bandwidth is desired, a hybrid mode uses CELT to encode the frequency range above 8 kHz. The third mode is pure-CELT, designed for general audio. SILK is inherently VBR and cannot hit a bitrate target, while CELT can always be encoded to any specific number of bytes, enabling hybrid and CELT mode when CBR is required.
SILK supports frame sizes of 10, 20, 40 and 60 ms. CELT supports frame sizes of 2.5, 5, 10 and 20 ms. Thus, hybrid mode only supports frame sizes of 10 and 20 ms; frames shorter than 10 ms will always use CELT mode. A typical Opus packet contains a single frame, but packets of up to 120 ms are produced by combining multiple frames per packet. Opus can transparently switch between modes, frame sizes, bandwidths, and channel counts on a per-packet basis, although specific applications may choose to limit this.
The reference implementation is written in C and compiles on hardware architectures with or without a floating-point unit, although floating-point is currently required for audio bandwidth detection (dynamic switching between SILK, CELT, and hybrid encoding) and most speed optimizations.
Opus packets are not self-delimiting, but are designed to be used inside a container of some sort which supplies the decoder with each packet's length. Opus was originally specified for encapsulation in Ogg containers, specified as audio/ogg; codecs=opus
, and for Ogg Opus files the .opus
filename extension is recommended. Opus streams are also supported in Matroska,[10] WebM,[11] MPEG-TS,[12] and MP4.[13]
Alternatively, each Opus packet may be wrapped in a network packet which supplies the packet length. Opus packets may be sent over an ordered datagram protocol such as RTP.[14]
An optional self-delimited packet format is defined in an appendix to the specification.[15] This uses one or two additional bytes per packet to encode the packet length, allowing packets to be concatenated without encapsulation.
See also: Wideband audio. Opus allows the following bandwidths during encoding. Opus compression does not depend on the input sample rate; timestamps are measured in 48 kHz units even if the full bandwidth is not used. Likewise, the output sample rate may be freely chosen. For example, audio can be input at 16 kHz yet be set to encode only narrowband audio.[16]
Abbreviation | Audio bandwidth | Effective sample rate | |
---|---|---|---|
NB (narrowband) | 4 kHz | 8 kHz | |
MB (medium-band) | 6 kHz | 12 kHz | |
WB (wideband) | 8 kHz | 16 kHz | |
SWB (super-wideband) | 12 kHz | 24 kHz | |
FB (fullband) | 20 kHz | 48 kHz |
Opus was proposed for the standardization of a new audio format at the IETF, which was eventually accepted and granted by the codec working group. It is based on two initially separate standard proposals from the Xiph.Org Foundation and Skype Technologies S.A. (now Microsoft). Its main developers are Jean-Marc Valin (Xiph.Org, Octasic, Mozilla Corporation, Amazon), Koen Vos (Skype), and Timothy B. Terriberry (Xiph.Org, Mozilla Corporation, Amazon). Among others, Juin-Hwey (Raymond) Chen (Broadcom), Gregory Maxwell (Xiph.Org, Wikimedia), and Chris Montgomery (Xiph.Org) were also involved.
The development of the CELT part of the format goes back to thoughts on a successor for Vorbis under the working name Ghost. As a newer speech codec from the Xiph.Org Foundation, Opus replaces Xiph's older speech codec Speex, an earlier project of Jean-Marc Valin. CELT has been worked on since November 2007.
The SILK part has been under development at Skype since January 2007 as the successor of their SVOPC, an internal project to make the company independent from third-party codecs like iSAC and iLBC and respective license payments.
In March 2009, Skype suggested the development and standardization of a wideband audio format within the IETF. Nearly a year passed with much debate on the formation of an appropriate working group.[17] Representatives of several companies which were taking part in the standardization of patent-encumbered competing format, including Polycom and Ericsson—the creators and licensors of G.719—as well as France Télécom, Huawei and the Orange Labs (department of France Télécom), which were involved in the creation of G.718, stated objections against the start of the standardization process for a royalty-free format. (Some of the opponents would later claim patent rights that Xiph dismissed; see below.)[18] The working group finally formed in February 2010, and even the corresponding Study Group 16 from the ITU-T pledged to support its work.
In July 2010, a prototype of a hybrid format was presented that combined the two proposed format candidates SILK and CELT. In September 2010, Opus was submitted to the IETF as proposal for standardization. For a short time the format went under the name of Harmony before it got its present name in October 2010.[19] At the beginning of February 2011, the bitstream format was tentatively frozen, subject to last changes.[20] Near the end of July 2011, Jean-Marc Valin was hired by the Mozilla Corporation to continue working on Opus.[21]
In November 2011, the working group issued the last call for changes on the bitstream format. The bitstream has been frozen since January 8, 2012.[22] On July 2, 2012, Opus was approved by the IETF for standardization.[23] The reference software entered release candidate state on August 8, 2012.[24] The final specification was released as RFC 6716 on September 10, 2012.[25] [26] and versions 1.0 and 1.0.1 of the reference implementation libopus were released the day after.
On July 11, 2013, libopus 1.0.3 brought bug fixes and a new Surround sound API that improves channel allocation and quality, especially for LFE.[27]
On December 5, 2013, libopus 1.1 was released,[27] incorporating overall speed improvements and significant encoder quality improvements: Tonality estimation boosts bitrate and quality for previously problematic samples, like harpsichords; automated speech/music detection improves quality in mixed audio; mid-side stereo reduces the bitrate needs of many songs; band precision boosting for improved transients; and DC rejection below 3 Hz. Two new VBR modes were added: unconstrained for more consistent quality, and temporal VBR that boosts louder frames and generally improves quality.
libopus 1.1.1 was released on November 26, 2015, and 1.1.2 on January 12, 2016, both adding speed optimizations and bug fixes. July 15, 2016 saw the release of version 1.1.3 and includes bug fixes, optimizations, documentation updates and experimental Ambisonics work.
libopus 1.2 Beta was released on May 24, 2017. libopus 1.2 was released on June 20, 2017.[28] Improvements brought in 1.2 allow it to create fullband music at bitrates as low as 32 kbit/s, and wideband speech at just 12 kbit/s.
libopus 1.2 includes optional support for the decoder specification changes made in drafts of RFC 8251, improving the quality of output from such low-rate streams.[29]
libopus 1.3 was released on October 18, 2018.[30] The Opus 1.3 major release again brings quality improvements, new features, and bug fixes.[31] Changes since 1.2.x include:
Notable bug fixes include:
libopus 1.3.1 was released on April 12, 2019.[32] This Opus 1.3.1 minor release fixes an issue with the analysis on files with digital silence (all zeros), especially on x87 builds (mostly affects 32-bit builds). It also includes two new features:
libopus 1.4 was released on April 20, 2023.[33] Opus 1.4 brings the following improvements and fixes:
libopus 1.5 was released on March 4, 2024.[36] It added the following backward-compatible improvements:
The codec is under active development.[37] The current focus is on adding a deep learning based redundancy encoder that enhances packet loss concealment by embedding one second of recovery data in each encoded packet. The deep redundancy (DRED) algorithm was developed by among others Jean-Marc Valin, Ahmed Mustafa, Jan Büthe, Timothy Terriberry, Chris Montgomery, Michael Klingbeil, and Paris Smaragdis from Amazon Web Services[38] with sponsorship to open source the algorithm and subsequently extend the IETF standard from Sid Rao.[39] This encoder is a backwards compatible change to the codec enabling customers to easily upgrade applications to take advantage of this machine learning capability. A draft RFC is underway to standardize the new capability.[40] This RFC is one of the first attempts to standardize a deep learning algorithm in the IETF.
Opus performs well at both low and high bitrates.
In listening tests around 64 kbit/s, Opus shows superior quality compared to HE-AAC codecs, which were previously dominant due to their use of the patented spectral band replication (SBR) technology.[41] [42] In listening tests around 96 kbit/s, Opus shows slightly superior quality compared to AAC and significantly better quality compared to Vorbis and MP3.[43] [44]
Opus has very low algorithmic delay, a necessity for use as part of a low-audio-latency communication link, which can permit natural conversation, networked music performances, or lip sync at live events. Total algorithmic delay for an audio format is the sum of delays that must be incurred in the encoder and the decoder of a live audio stream regardless of processing speed and transmission speed, such as buffering audio samples into blocks or frames, allowing for window overlap and possibly allowing for noise-shaping look-ahead in a decoder and any other forms of look-ahead, or for an MP3 encoder, the use of bit reservoir.[45]
Total one-way latency below 150 ms is the preferred target of most VoIP systems,[46] to enable natural conversation with turn-taking little affected by delay. Musicians typically feel in-time with up to around 30 ms audio latency,[47] roughly in accord with the fusion time of the Haas effect, though matching playback delay of each user's own instrument to the round-trip latency can also help.[48] It is suggested for lip sync that around 45–100 ms audio latency may be acceptable.[49]
Opus permits trading-off reduced quality or increased bitrate to achieve an even smaller algorithmic delay (5.0 ms minimum).[50] While the reference implementation's default Opus frame is 20.0 ms long, the SILK layer requires a further 5.0 ms lookahead plus 1.5 ms for resampling, giving a default delay of 26.5 ms. When the CELT layer is active, it requires 2.5 ms lookahead for window overlap to which a matching delay of 4.0 ms is added by default to synchronize with the SILK layer. If the encoder is instantiated in the special restricted low delay mode, the 4.0 ms matching delay is removed and the SILK layer is disabled, permitting the minimal algorithmic delay of 5.0 ms.
The format and algorithms are openly documented and the reference implementation is published as free software. Xiph's reference implementation is called libopus and a package called opus-tools provides command-line encoder and decoder utilities. It is published under the terms of a BSD-like license. It is written in C and can be compiled for hardware architectures with or without a floating-point unit. The accompanying diagnostic tool opusinfo reports detailed technical information about Opus files, including information on the standard compliance of the bitstream format. It is based on ogginfo from the vorbis-tools and therefore — unlike the encoder and decoder — is available under the terms of version 2 of the GPL.
contains a complete source code for an older version of the reference implementation written in C. RFC contains errata. Libopus is the more up-to-date but non-normative branch of the reference implementation.
The FFmpeg project[51] has encoder and decoder implementations not derived from the reference library. The documentation describes it as CELT-only and poorer-quality than the reference.[52]
The libopus reference library has been ported to both C# and Java as part of a project called Concentus. These ports sacrifice performance for the sake of being easily integrated into cross-platform applications.[53]
See also: Comparison of VoIP software.
Digital Radio Mondiale – a digital radio format for AM frequencies – can broadcast and receive Opus audio (albeit not recognised in official standard) using Dream software-defined radio.
The Wikimedia Foundation sponsored a free and open source online JavaScript Opus encoder for browsers supporting the required HTML5 features.[54]
A list of radio stations that stream using Opus audio codec can be found on the Xiph.Org Foundation Icecast directory.[55]
In late 2014 and 2015, Google's video platform YouTube started offering Opus audio along with VP9 video in the WebM file format, through DASH streaming.[56] In July 2024, YouTube rolled out an additional high quality audio format option, 256 kbit/s Opus, to YouTube Music Premium subscribers.[57]
Since 2016, WhatsApp has been using Opus as its audio file format.[58]
Signal switched from Speex to Opus audio codec for better audio quality in the beginning of 2017.
In 2018, SoundCloud switched from MP3 to Opus, reducing half of its required bandwidth for music streaming.[59]
In January 2021, Vimeo introduced Opus to its video platform.[60]
In 2021, the Danish journalism website Zetland switched from MP3 to Opus for its articles' audio recordings, which attained a 35 percent reduction in bandwidth and reduced climate footprint.[61] [62]
Most end-user software relies on multimedia frameworks provided by the operating system. Native Opus codec support is implemented in most major multimedia frameworks for Unix-like operating systems, including GStreamer, FFmpeg, and Libav libraries.[63] [64] [65]
The WebM container .webm
is mostly used on online video platforms (e.g. YouTube), and is usually treated as a video file by operating systems & media players. Even if a WebM file contains only Opus audio and no video, some music players do not recognize WebM files as audio files and do not support reading of file metadata.[66]
The Ogg container .opus
is preferred for audio-only files, and most media players have support for audio file metadata tagged in the Vorbis comment format.
Google added native support for Opus audio playback in Android 5.0 "Lollipop".[67] However, it was limited to Opus audio encapsulated in Matroska and WebM containers, such as .mkv
, .mka
and .webm
files.[68] [69] Android 7.0 "Nougat" introduced support for Opus audio encapsulated in Ogg containers. Android 10 finally added native support for .opus
extensions.[70]
Due to the addition of WebRTC support in Apple's WebKit rendering engine, macOS High Sierra and iOS 11 were released with native playback support for Opus audio encapsulated in Core Audio Format containers.[71] macOS Sonoma added support for mono and stereo Opus audio encapsulated in MPEG-4 and WebM containers in Safari.[72] [73]
On Windows 10, version 1607, Microsoft provided native support for Opus audio encapsulated in Matroska and WebM containers.[74] On version 1709, support for Opus audio encapsulated in Ogg containers was made available through a pre-installed add-on called Web Media Extensions.[75] On Windows 10 version 1903, native support for the .opus
extension was added. On Windows 8.1 and older, third-party decoders, such as LAV Filters, are available to provide support for the format.[76] A January 2024 update for Windows 10 & 11 caused File Explorer to freeze up when renaming or deleting Ogg files (including .oga, .ogg, .ogm, .ogv, .ogx, .opus), due to bugs involving the MF Media Source Pack Property Handler shell extension by Microsoft and the Web Media Extensions package in Windows, which were not patched before the Windows Updates were rolled out.[77]
iOS 17 includes support for natively encoding and decoding the Opus codec through the operating system's AudioToolbox framework. Playback of Ogg files in the .opus
container is supported through the Files application. Opus is additionally supported within the Core Audio Format .caf
container, the QuickTime .mov
container, and the ISOBMFF or MP4 file format .mp4
container. As the AudioToolbox framework is shared with macOS, similar support should be present in both operating systems as they further develop.[78]
Windows | macOS | Linux | Android | iOS | ||
---|---|---|---|---|---|---|
Codec support | ||||||
Container support | On Windows 10 Anniversary Update (1607): WebM (.webm is not recognised; requires pseudo extension) Matroska (.mka, .mkv) On Windows 10 Fall Creators Update (1709) with Web Media Extensions add-on: On Windows 10 October 2018 Update (1809): On Windows 10 May 2019 Update (1903): | On macOS High Sierra: Core Audio Format (.caf) On macOS Monterey: On macOS Sonoma: | Ogg (.opus) WebM (.webm) Matroska (.mka, .mkv) MPEG-TS (.ts) | On Android 5: WebM (.webm) Matroska (.mka, .mkv) On Android 7: On Android 10: | On iOS 17 and later: Supports playback through Files; supports Ogg as .opus; supported in MP4, standalone or in combination with any officially supported video codec; standalone and expanded but unofficially supported combinations in MOV; standalone support in CAF | |
Notes | On Windows 10 & Windows 11: On Windows 10: On Windows 8.1 and older: | In Safari 15, Apple added support for Opus audio in WebM containers. Experimental support is only present in macOS.[82] | – | - Up till Android 9, the filename extension .opus was not recognised (substitute with a pseudo file extension such as .ogg or .m4a) | - When originally introduced in iOS 11, only constant bitrate Opus audio in a CAF container was supported. - In Safari 15, Apple added support for Opus audio in WebM containers. However, it is non-functional in iOS 15, as of September 2021.[83] - In iOS 17, native support for playing variable bitrate multichannel .opus files through Quick Look in the Files app was implemented; the codec is additionally natively supported if encapsulated in ISOBMFF/MP4, CAF, or MOV. - As of iOS 17, WebM support is present in Safari, but not Files. - Opus can additionally be utilized within MP4 in combination with any video codec supported by the device. |
While support in multimedia frameworks automatically enables Opus support in software which is built on top of such frameworks, several applications developers made additional efforts for supporting the Opus audio format in their software. Such support was added to AIMP,[84] Amarok,[85] cmus, Music Player Daemon, foobar2000,[86] Mpxplay, MusicBee,[87] SMplayer, VLC media player,[88] Winamp[89] and XMPlay audio players; Icecast,[90] Airtime (software)[91] audio streaming software; and Asunder audio CD ripper, CDBurnerXP CD burner, FFmpeg, Libav and MediaCoder media encoding tools. Streaming Icecast radio trials are live since September 2012 and January 2013.[92] [93] SteamOS uses Opus or Vorbis for streaming audio.[94]
Opus support is mandatory for WebRTC implementations.[95] Opus is supported in Mozilla Firefox,[96] Chromium and Google Chrome,[97] Blink-based Opera,[98] [99] as well as all browsers for Unix-like systems relying on GStreamer for multimedia formats support. Although Internet Explorer will not provide Opus playback natively, support for the format is built into the Edge browser, along with VP9, for full WebM support.[100] [101] Safari supports Opus as of iOS 11 and macOS High Sierra.[102]
Due to its abilities, Opus gained early interest from voice over IP (VoIP) software vendors. Several SIP clients, including Acrobits Softphone, CSipSimple (via additional plug-in), Empathy (via GStreamer), Jitsi,[103] Tuenti,[104] Line2 (currently only on iOS),[105] Linphone,[106] Phoner and PhonerLite,[107] SFLphone,[108] Telephone, Mumble, Discord[8] and TeamSpeak 3 voice chat software also support Opus.[109] [110] [111] TrueConf supports Opus in its VoIP products.[112] Asterisk lacked builtin Opus support for legal reasons,[113] but a third-party patch was available for download[114] and official support via a binary blob was added in September 2016.[115] Tox P2P videoconferencing software uses Opus exclusively.[116] Classified-ads distributed messaging app sends raw opus frames inside TLS socket in its VoIP implementation.[117]
Opus is widely used as the voice codec in WhatsApp,[118] [119] [120] which has over 1.5billion users worldwide.[121] WhatsApp uses Opus at 816 kHz sampling rates, with the Real-time Transport Protocol (RTP).[119] The PlayStation 4 video game console also uses the CELT/Opus codec for its PlayStation Network system party chat.[122] The Source Engine uses Opus for its voice chat system.[123] It is also used in the Zoom videoconferencing app.[124]
Since version 3.13, Rockbox enables Opus playback on supported portable media players, including some products from the iPod series by Apple, devices made by iriver, Archos and Sandisk, and on Android devices using "Rockbox as an Application".[125] [126] All recent Grandstream IP phones support Opus audio both for encoding and decoding. OBihai OBi1062, OBi1032 and OBi1022 IP phones all support Opus. Recent BlueSound wireless speakers support Opus playback.[127] Devices running Hiby OS, like the Hiby R3, are capable of decoding Opus files natively.
Many broadcast IP codecs include Opus such as those manufactured by Comrex, GatesAir and Tieline.[128]
The Sony PlayStation 5 supports capturing 1080p and 2160p footage using VP9 video and Opus audio in a WebM container.[129] [130]
Android 13 supports Opus as a bluetooth headphone (A2DP) codec, motivated by its low latency, which is important for head-tracked spatial audio. Google's Pixel Buds Pro supports this A2DP codec.[131]
As an open standard, the algorithms are openly documented, and a reference implementation (including the source code) is published. Broadcom and the Xiph.Org Foundation own software patents on some of the CELT algorithms, and Skype Technologies/Microsoft own some on the SILK algorithms; each offers a royalty-free perpetual license for use with Opus, reserving only the right to make use of their patents to defend against infringement suits of third parties. Qualcomm, Huawei, France Telecom, and Ericsson have claimed that their patents may apply, which Xiph's legal counsel denies, and none have pursued any legal action.[132] [133] The Opus license automatically and retroactively terminates for any entity that attempts to file a patent suit.