OpenOB 

utilising Opus for Broadcast Audio Links

The codec, features, potential uses and tools


Developer: James Harrison (@JamesHarrison) - BBC Research & Development

Speaker: Chris Roberts (@naxxfish) - Canterbury Youth and Student Media / BBC Major Projects Infrastructure

A Disclaimer

The BBC does not endorse or recommend Opus, does not use Opus to the best of my knowledge at this time, and does not endorse or recommend any of the software covered in this presentation.

Audio over IP - An introduction

Codecs and Containers

What is Opus?

Don't we have a few of those already?

  • AAC-LC, -LD
  • HE-AACv2
  • MPEG-2
  • MP3
  • G.722
  • Vorbis
  • iLBC
  • Speex
  • AMR-NB
  • AMR-WB
  • ... to name a few

The Rationale for Opus

Comparison of Codecs


(from opus-codec.org)

Opus is a hybrid codec

SILK + CELT

(LPC + MDCT)

SILK

SILK at a glance

  • Based on linear predictive (LP) coding
  • 4-12kHz input bandwidth (8-24kHz sample rate)
  • 6-40kbit/s bitrates
  • Supports bitrate adaptation, discontinuous transmission
  • Low-latency - typically 25ms

SILK in Opus

  • Opus uses SILK in most low-bandwidth modes
  • Optimized for speech rather than music

CELT

CELT at a glance

  • Modified discrete cosine transform (MDTC) codec
  • 16-24kHz input bandwidth (32-48kHz sample rate)
  • 24-128kbit/s bitrates
  • Supports bitrate adaptation, discontinuous transmission and packet loss concealment
  • Low-latency - typically 2-10ms

CELT in Opus

  • Opus uses CELT in medium to high bandwidth modes
  • Good all-round performance for speech and music at higher bitrates (over 32kbps)

How does this "hybrid" stuff work?

  • Can be switched to LPC or MDCT explicitly
  • Hybrid mode takes sub-8kHz through LPC and above-8kHz through MDCT
  • Internal filter banks to split and recombine
  • There is better performance in LPC mode than hybrid mode at lower bitrates for speech

Opus Hybrid Block Diagram


So what about audio quality?

  • We don't know!
  • Some subjective testing being done by the EBU Audio Subjective Testing working group

... so does it sound "alright"?

Yeah, pretty much.

Google and Nokia Research have performed listening tests for speech content and found it better than or equivalent to comparable speech codecs.

Hydrogenaudio conducted public listening test, better than AAC-LC and HE-AAC and Vorbis in VBR mode, lower/more consistent bitrate

Fixed standard, living code

So why is Opus so important?

  • It's free and royalty-free
  • Because it's free and royalty-free it's trivially implemented
  • It's potentially higher-quality-per-bit than existing codecs

Latency

Latency is bad

We want less of it in our broadcasts.

Where does latency come from?

  • Audio device buffers
  • Coding and muxing
  • Routing and transit over IP
  • Jitter buffers

Opus Latency

Frame Size Algorithmic Delay Bitrate overhead
20ms 22.5ms 0%
10ms 12.5ms 10%
5ms 7.5ms 32.5%
2.5ms 5ms 75%

2.5ms frame size = 112kbps to match 64kbps

Jitter Buffer Tradeoffs

Larger jitter buffer = more resilience, more latency

Jitter can be induced in the hardware at each end or (more often) the IP link layer

Reliability

...two links lost in the first 20 minutes of the programme, we're off to a good start...

...I'm sorry, we've lost him. He was in Beirut, though, so there's a bit of an excuse...

I'm going to have to cut you off there, we'd love to hear more but I'm afraid your link appears to be broken...

(All from 30 minutes of the 3-hour-long Today programme, BBC Radio 4's flagship current affairs and world news programme)

Reliability in Opus

  • Forward Error Correction (FEC) - I'm expecting a maximum of 5% loss on this link so put enough information about the previous packet in each subsequent packet to cope with it
  • Packet Loss Concealment (PLC) - I've lost a packet entirely and can't correct for it with FEC, do I notice it in the audio?

Dealing with the effects of loss and jitter

All of Opus' reliability features work no matter what bitrate or frame size

Jitter buffers will still help on internet links but PLC and FEC can allow for reduced buffers versus other codecs

Dynamic Control

Huge chunks of Opus can be adjusted at runtime and without introducing discontinuities in most cases

Open-Source Tools for Opus

opusenc/opusdec, libopus

  • The reference implementation
  • Excellent quality, performance acceptable on many platforms
  • Script-friendly CLI tools for static file encoding
  • Supports fixed-point as well as default floating point operation

Gstreamer opus elements

  • GStreamer plugins providing elements for encoding and decoding of audio
  • RTP payloading/depayloading also supported
  • Error correction/PLC supported
  • Very friendly interface for streaming application development

What about end-user friendly tools?

My users are not geeks. How can they use this shiny new technology?

OpenOB

(Not a project endorsed or supported by BBC R&D)

OpenOB - An Introduction

  • Open-source RTP link manager (BSD 3-clause license)
  • Supports Linear PCM, CELT and Opus transports via GStreamer
  • Broadcaster-oriented - high reliability, automatic aggressive failure recovery
  • Currently uses Redis for message passing and session setup

OpenOB - What it can do

  • Configure to link bandwidth, everything else automatic
  • Sending party configures receiver
  • Jitter buffer/latency configurable
  • Total system latency as low as 25-50ms on Linux

OpenOB - Building codec hardware

  • Lightweight - runs on Raspberry Pi and similar, ARM
  • Programmatic access to link management tools
  • The longer-term goal - simple message-based API for control surfaces
  • Using hobbyist parts for low costs - great for community, student and other low-budget stations

  • Want pro quality? Use industrial computers, pro audio interfaces

What about reliability?

OpenOB - Reliability Features

  • If your network link glitches for 10ms, you only lose 10ms of audio
  • Packet loss concealment support
  • Forward error correction configurable on link setup
  • Jitter buffer configurable for high-jitter networks like the internet/3G links

OpenOB - Multipath

  • Send multiple copies on different connections (eg 2 3G providers)
  • Receive all copies that make it, deduplicate packets
  • Previously only available in high-end commercial codecs
  • Adds considerable latency but great for STLs
  • ... but moderately complex firewall configuration required on originator
  • OpenOB doesn't try to configure your network for you.
  • (not in GitHub yet!)

OpenOB - Applications

  • Outside broadcast contribution links
  • Broadcast emission links (studio-transmitter, studio-studio)

OpenOB - Where next?

  • Multipath and more complex configurations need better configuration management
  • Easier end-user front-end via web interface
  • Shift towards message bus architecture using AMQP, decentralized components for flexible integration
  • NAT autonegotiation via STUN/TURN tunnels/ICE
  • In-progress link monitoring, loss measurement and reconfiguration

That's all!

Any questions?

Chris Roberts (@naxxfish)


James Harrison (@JamesHarrison)