WebRTC Audio Codecs: Opus and G.711

In my previous posts I have discussed how we are to implement the Opus codec within Drum (this should be rolled out in the next couple of weeks).  But, I have not detailed the advantages in adding this new codec in addition to G.711 that we already support.

The WebRTC Mandatory Audio Codecs

The WebRTC standards specify that both Opus and G.711 are Mandatory To Implement (MTI).  The rationale for this decision is that Opus is able to support high-quality audio over variable bit-rates while G.711 is included as a fallback option for situations where it is difficult to implement the more complex Opus or for integration with legacy systems.  (I will not cover the other variable bit rate protocols that could have been adopted – this has been covered in many other places.)

G.711 was first published by ITU-T in 1972.  It was designed to carry audio at a fixed bit rate of 64 kbit/s over circuit switched networks although it has also been used for many years in packet switched networks.  G.711 does not implement any compression, hence has zero compression latency.  All applicable patents on the protocol have expired.

Opus was specified by IETF as RFC6716 in 2012.  Unlike G.711 it was developed specifically for the packet switched Internet.  Opus incorporates technology from two codecs: the speech-oriented SILK and the low-latency CELT.  It can adjust seamlessly among high and low bitrates and transition between a linear prediction codec at lower bitrates and a transform codec at higher bitrates, as well as a hybrid for a short overlap.  It is specified from 6 kbit/s to 510 kbit/s.  It also offers very low latency.  Patents which cover Opus are offered on royalty free terms.

Quality and Complexity

Opus is able to offer superior audio quality across all of its bitrates (ie. even at the lowest bitrate it will out-perform G.711 at 64 kbit/s in listening tests).  At the higher bitrates Opus may also support spatial audio for truly awesome quality!

This increased audio quality does, however, come at the price of complexity.  The Opus codec is incredibly difficult to implement.  I am unaware of any implementations of Opus in hardware.  Conversely G.711 has a virtually zero implementation cost and has been available in hardware for many years.

Unsurprisingly, given its longevity, G.711 has proliferated everywhere.  While, although very young, Opus has been rapidly gaining traction.

The WebRTC standard leaves implementors to choose to implement codecs in addition to G.711 and Opus.  But, at least the ability to fall back to one of the MTI codecs should reduce  interoperability issues.  Even if the IETF did mandate more codecs, this would not altogether eliminate negotiation failure with non-WebRTC endpoints – there may always be a pair of endpoints which cannot agree!

And the winner is….

In summary, it would appear that for most cases Opus wins straight out.  Although, it is very useful to have a simple protocol such as G.711 for implementations that for any reason cannot handle the complexity of the Opus protocol.  So, I reckon, full marks to the WebRTC standardisation body – you made the right choice!

The choice of video codec it not quite so clear cut.  Currently the open-sourced VP8 is the only video codec that is mandatory.  But there is strong support for the more widely adopted patent/royalty encumbered H.264 protocol.  I’ll leave this argument for another post…

Dr Richard Screene is a Senior WebRTC Developer at Drum.  Richard has over 20 years experience of development for communication protocols.  He is currently responsible for integrating the Drum web and audio conferencing products using WebRTC.

Richard has experience in development of software for circuit switched protocols and recent projects have involved LTE and SIP. With an in-depth knowledge of  C/C++, Java, Javascript and shell scripting,  Richard earned a PhD degree in Electronic Engineering from Manchester Metropolitan University.  Richard also holds a master’s degrees in Computer Communication & Networks from Leeds Metropolitan University and a bachelor’s degree in Computer Science from the University of Leeds.

I will reply to all comments and questions!

%d bloggers like this: