Wondering what an audio codec is and how to choose the right one for live streaming video or recording?
Imagine we lived in a purely analog world. There would be no need for such things as audio codecs. What is an audio codec you ask? It’s an algorithm used to convert analog audio signals into digital ones. A necessity in the world of digital devices, media players, and the Internet.
Audio codec quality has improved over the years. Think back to the 1980’s when digital amps were becoming mainstream. Compared to the quality reproduction of today’s digital amps, the difference is obvious. Better audio codecs reproduce more realistic sounding, high-fidelity audio.
But there are so many audio codecs out there. How do you choose?
Many codecs are specialized. Some are proprietary and others are created for specific applications, like telecommunications. For voice-only signals, like on your phone, you don’t need high-fidelity and may actually benefit from using a codec that reproduces a signal with a limited audio range. But for music, a higher fidelity audio signal is definitely more desirable.
Dig deeper and you discover that different audio codecs do different things to the original analog signal. For example, an audio codec like PCM is a lossless compression algorithm. That means the signal is reproduced digitally without losing any of the original bits of information. Other audio codecs, like AAC and MP3, are lossy and compress the audio.Compression drops little bits of the original content to make the file size smaller. If you’re listening to songs on a mobile device, then you can be sure that the files are compressed to make them smaller. That way more music files can fit on your device, but the quality is less than optimal.
Audio codecs on Pearl and Pearl-2
Now I’m not trying to bridge the gaping audio-codec divide in this blog, but help you clear up some of the fogginess around choosing an audio codec for live streaming video or recording using Epiphan Pearl or Pearl-2.
Three audio codecs are available on Pearl:
- PCM – Uncompressed audio codec that’s best if you’re planning to record your program for editing later and when you’re not worried about the amount of bandwidth required.
- AAC – A compression audio codec that’s good for live streaming or recording content for immediate playback on media players and for uploading to the Internet. Experts say AAC reproduces better quality audio than MP3 does at the same audio bitrate. Although I haven’t tested that, the newer audio codecs do tend to reproduce analog signals better than the older ones so I wouldn’t be at all surprised if that were true (nod to the experts).
- MP3 – An older but still very popular compression audio codec that’s good for live streaming or recording content for immediate playback on media players and for uploading to the Internet.
Choosing the right audio codec is important when setting up your live streaming event or recording using Pearl or Pearl-2. Other things to consider for higher quality audio are choosing a sample rate and the effects of resampling the audio.
Sample rates and the problem of resampling
The sample rate is the number of times per second the audio signal is sampled.
Higher sample rates equal more information, which means higher fidelity – right? So if I choose a lossy compression codec like MP3, can’t I just increase the sample rate and the audio bitrate to improve the quality?
It’s true that more of the original signal is sampled. But more doesn’t automatically mean better. It’s important to match the sample rate of the encoded signal of your live stream (or recorded content) to the rate of the source signal to preserve the quality of your audio.Professional audio equipment uses a sample rate of 48 kHz and consumer audio equipment uses a rate of 44.1 kHz. HDMI and SDI sources sample audio at 48 kHz. If you change the sample rate of your audio while streaming, audio is distorted because the signal is resampled at a different rate.
A common example of resampling is when you take audio that was originally recorded using professional equipment at a sample rate of 48 kHz and transfer it to CD on your computer. The audio is resampled to a lower rate of 44.1 kHz, which causes some audio distortion and a loss of some fidelity. In this case, a slightly better choice is to sample at 88.2 kHz (if your equipment supports it) since that converts evenly into 44.1 kHz.
So why is 48 kHz the gold standard and widely used by HDMI or SDI sources? Because it produces good sounding audio for the average listener and doesn’t create overly large files. Increasing the sample rate by a lot won’t pay off if your ear can’t pick out the difference. And for the average listener, the difference between audio recorded at 44.1 kHz and 48 kHz is negligible (though I’m not saying there isn’t any for all you audiophiles).
There are cases when a higher sample rate may be useful. You could be recording original content to post-produce and record later on to CD (sampling at 88.2 kHz works nicely), or maybe you’re restoring historical recordings and want as much data to work with as possible. There are good arguments for sampling at higher rates such as 96 kHz or 192 kHz. However, doing that produces much larger files.
A little talked about phenomena when choosing sample rates that are above 48 kHz is the potential generation of ultrasonic harmonics. These harmonics may not negatively affect your end product, but how those harmonics are processed depends largely on your equipment. Ultrasonic frequencies are well outside the audible range of the human ear, but there is potential for the electronics in your equipment or speakers to generate distortion that’s within the audible range, which is roughly 20 Hz to 20 kHz for the average person. You may want to research that further and test your equipment before using sample rates that are 96 kHz and higher.
Audio codec, sample rate, and audio bitrate considerations
Audio codecs, sample rates, and the resulting audio bitrate (i.e. the amount of data per second) are tied at the hip. What’s right for you depends on considerations like how much bandwidth upload capacity you have available and the equipment you’re using.
A larger audio bitrate means a larger file size and so some websites limit the bitrate. Sites like YouTube support bitrates as high as 320 kbps (at the writing of this blog), but other are less. Check into that before you choose one.
Using Pearl or Pearl-2, the maximum audio bitrate for encoding mono audio signals that are sampled at 44 kHz is 264 kbps. For stereo, 320 kbps is supported.
Here are some practical things to consider when choosing an audio codec and audio bitrate.
- How much bandwidth upload capacity do you have available? And how much bandwidth do you want taken up by your audio signal when you also have to consider how much bandwidth your video needs?
- Do you sacrifice video quality by increasing the audio quality? Lower quality video is a lot more obvious than lower quality audio. Are you willing to tolerate some dropped frames of video for higher fidelity audio if your Internet connection can’t handle the combined bandwidth requirement?
- What audio source are you capturing? Are you capturing only voice or do you need higher fidelity? If you’re simply recording someone speaking, you can get away with using a lower bit depth. The file will be smaller too. But keep in mind that compact disc digital audio uses 16 bit, DVD Audio and Blu-ray support up to 24 bit. The higher the bit depth you select, the better the resolution of your resulting digital signal.
- Recording at sample rates higher than 48 kHz (i.e. 96 kHz or 128 kHz) is not usually necessary and will increase the size of your files a lot.
- Are you uploading files directly to the Internet and want compression or are you recording the file to edit later using your video editing software and therefore don’t want compression? Choosing a codec like PCM retains the full integrity of the stream for editing later. If bandwidth isn’t an issue, choose the highest audio bitrate you can. Otherwise, use AAC or MP3 and select a sample rate that matches the sample rate of your source to avoid resampling the audio.
Your audio codec choice makes all the difference
Making the right choice of codec and sample rate can help you improve the quality of your digitally recorded or streamed content. Knowing what’s needed for your particular application or the requirements of your chosen content distributor makes all the difference. Although I’ve only scratched the surface here, hopefully you can make a more informed decision when choosing an audio codec for your next live streaming or recorded event.
Pingback:Find New Ways to Stay Connected With Your Audience – ReBild.life
[…] For example, YouTube supports audio bitrates up to 320 kbps. You can read this blog for more about audio codecs and bitrates, and we did this bitrates demystified video that talks all about bitrates and resolutions. […]