Tag Archives: Codec2

Using Opus & Codec2 to Compress Podcasts

With my current job, bandwidth is sometimes limited and can be expensive. I have been thinking about how to better enjoy all of the podcasts that I listen to every week. Each episode can be anywhere from 50Mb to 150Mb, resulting in 1-2Gb of bandwidth being used just for podcasts. I am working on a system that would run on a VPS, downloading the podcasts and transcoding them to a more efficient codec. Opus is an excellent codec for voice, especially at low bitrates but what if I wanted something more extreme.

David Rowe’s Codec2 is being designed for amateur radio for use on the HF & VHF bands. Codec2 isn’t being designed for audio storage, and there isn’t any container format that supports it but I was able to transcode the original podcast to a raw bitstream that can be saved to a file. There currently isn’t a player that supports Codec2, so you have to feed the bitstream though the decoder to save it as audio that you can play.

For the source I will be using the first minute of episode 747 of the No Agenda Show as the source for the demo, it can be listened to below:

The original podcast is 143.4 MB.  I’ve experimented with encoding the podcast with three different codecs (Mp3, Opus, and Codec2) at different bitrates.

Codec ChartThe file sizes are similar at the same bitrate (as expected) but Opus does a much better job with the lower bitrates.  Mp3 has a lot of compression “warble” while the Opus maintains the treble and base tones of the host’s voices.  The samples at different bitrates can be found below:

Mp3 Opus
32 kb/s
24 kb/s
16 kb/s
8-6 kb/s

Opus performs well, even down to 6kb/s while Mp3 is completely unlistenable at it’s minimum at 8kb/s.  But I want to try something more extreme, so I started playing with Codec2.  To create the test example I used Audacity to down-sample the original to 8000Hz mono raw PCM file.  The raw PCM audio was processed by the Codec2 encoder at different bitrates and saved.

3200 b/s
1600 b/s
1600 b/s

At 3200 b/s Codec2 does a reasonable job with the presenters voices, but the introduction and sound effects doesn’t compress well.  Even down to 1200 b/s still sounds intelligible, but any non-voice audio doesn’t compress well at all.  In order to make this work, some significant audio preprocessing would have to be done for it to be compressed properly. I am excited for the possibility for having 3+ hours of audio being compressed to a 5Mb file.

My next task is to get a script working on the server to act as a podcatcher and automatically transcode the content, then create it’s own private RSS feed for my device to make the much smaller podcast available for download.  For now I will be using Opus, but more research will be done with Codec2.