Are you using the best audio codec settings for your live streams and VODs? This article will review the basics and help you solidify your knowledge of codec settings. Here at DaCast, we often hear questions about audio and video codecs as well as related settings for live streaming. This blog will go over these topics.
In more detail, we’ll also go over what exactly an audio codec (or a codec in general!) is. We’ll share common audio codecs, and discuss other audio settings like bit rate, channels, video settings, and so on. Armed with this information, you should be able to make an informed decision about which audio codec to use for streaming live video.
Let’s get started with the basics.
What is an audio codec?
The term codec is a portmanteau that combines the words “encoder” and “decoder.” As the term implies, a codec is a standard or tool for “encoding” and “decoding.” But what the heck does that mean?
It’s all about data compression. “Raw” or uncompressed audio files are recorded using techniques that capture as much data as possible. This provides very high quality, but results in very large file sizes that aren’t practical for most uses. For instance on DaCast OVP, you can upload a raw file or you can upload a file using our auto-encoding method so you don’t use as much storage space in your account.
To make audio files smaller, and thus easier to distribute, we use a codec. The first thing a codec does is “encode” an audio file. This encoding involves tossing out extra information to reduce file sizes while maintaining as much quality as possible. This involves a lot of complex mathematical operations which are beyond the scope of this article. However, you can read a basic overview here.
The second part of what a codec does is play back, or “decode,” an audio file which has previously encoded. To make a complex process very simple, this means reversing the math done during the encoding step.
In short, an audio codec is a protocol for compressing digital audio to save space, and for playing back that video.
Common audio codecs
There are a wide range of audio codecs available today. However, not all audio codecs are equally supported. Some devices may support one audio codec, but not another. Some provide better quality, while other focus on compression above all else. These are important considerations when it comes to deciding on the best audio codec for a given situation. Let’s go over a few of the most common and best audio codecs.
The first format we’ll quickly review is WAV, or Waveform Audio File Format. WAV was originally released more than 25 years ago, and was primarily used on Windows computers to store uncompressed audio in the LPCM format.
AIFF is a Mac format that’s similar to WAV. It stores uncompressed audio using the PCM (Pulse-Code Modulation). Like WAV, AIFF files are very large—around 10 MB for one minute of a standard audio recording.
The most well known audio format is probably MP3, technically called MPEG-2 Audio Layer III. Originally introduced in the 1990’s, MP3 revolutionized digital audio. Files were much smaller than the previous formats, allowing them to be streamed and downloaded over the internet. MP3 also helped push the era of portable digital music past the CD era by enabling iPods and other early “MP3 players.” It is still widely used today.
Developed a few years after MP3, AAC built on the success of that format but increased compression efficiency. AAC generally provides better audio quality at the same bit rate as MP3, or comparable quality at lower bitrates. AAC has been upgraded several times. The latest version of the standard is HE-AAC. It is a closed source format, but is probably the most widely used audio codec on the internet today and the one supported by most of the video streaming platforms.
Another codec on the market, albeit one that is becoming less common, is WMA—Windows Media Audio. This codec was developed as an alternative to MP3 but has become somewhat of a niche product.
The final audio codec we’ll take a look at is Opus. Opus isn’t in wide use yet, but it’s a next-generation codec. It provides higher audio quality at all bitrates compared to every other codec listed here. Opus also has the added advantage of being royalty free and open source as well.
Both iOS and Android now natively support Opus playback. We’ll likely see Opus getting wider use in the future.
Our recommendation for the best audio codec
We recommend AAC as the best audio codec for most situations. AAC is supported by a wide range of devices and software platforms, including iOS, Android, MacOS, Windows, and Linux. Other devices such as Smart TVs and set-top boxes will also support AAC.
Besides wide support, AAC also has the advantage of better audio quality compared to MP3. Blind listening tests generally show that AAC is the best codec available for general use. This may change in the future as Opus becomes more broadly supported. However, hardware and software changes move slowly. That day is likely still a few years away.
For internet video, AAC is the best audio codec for live streaming as well as video on demand. This is generally configured via settings in your hardware or software encoder.
Bit rate, channels, and other audio settings
Aside from codecs, there are a number of other settings that are important for the audio portion of any live stream or video on demand. We often write about video settings, but less often cover audio. Let’s go over some of these details now as audio quality is as important as video quality.
Recommended audio bit rate for live streaming
Bit rate refers to the amount of data contained in a digital media file per second of that media. Typically measured in Kbps (Kilobits per second), audio bit rate can often be a stand in for quality. All else being equal, an AAC audio file that’s encoded at a bit rate of 192 Kbps will sound better than one encoded at 64 Kbps.
Our recommended bit rates for audio, when using our recommendation for the best audio codec (AAC) are as follows:
- For 360p (low quality) video, use 64 Kbps audio bit rate
- With 480p and 720p video, use 128 Kbps audio bit rate
- For 1080p video, use 256 Kbps audio
Channels (stereo vs. mono)
You may also notice a setting for audio channels in your encoder settings. There will be two settings here: stereo, and mono. Mono refers to “one,” a setting which should be used only for low quality video. Using mono reduces bitrate.
Generally, you should use stereo audio for all video recordings and broadcasts at 480p and above. This will provide a superior listening experience.
Recommended audio sample rate for live streaming
Sample rate is another setting related to audio quality. It simply refers to the number of audio measurements taken per second with a given recording. More samples per second will record a fuller, richer palette of tones, but will result in more data.
Generally, we recommend that you use 44100 Khz as the audio sample rate for all live streaming and online video. This is the standard for most audio equipment and recordings, and will function perfectly.
Related settings such as video codec
Of course, a live stream or online video requires more than the best audio codec settings. Video is crucial as well. That’s why it’s important to understand video codecs as well as audio codecs. To learn about our recommendations for the best video codec for html5 live streaming, check out the sister article to this piece.
As we said, audio can be a confusing topic. But once you begin to understand the principles, it all comes together. Hopefully this piece has helped you to understand how all the pieces of audio compression and transmission work together to provide a good outcome.
DaCast helps a wide range of businesses get started with live streaming. If you’d like to try out our services, you can check out how our live streaming platform could boost your business with our 30-day free trial (no credit card required). We’d love to help you meet your streaming goals today!
Thanks for reading! We love to hear from our readers, so if you have any questions or experiences to share, let us know in the comments! For regular tips on live streaming, feel free to join our LinkedIn group.
By Max Wilbert.