As a broadcaster, you are likely familiar with codecs. Video and audio codecs are, as you may know, a crucial component to live streaming setup. However, we can all be forgetful, and we’re here to offer a refresher. Overall, this article reviews codec basics to help you to offer the best possible experience to your viewers.
In this article, we’ll share everything you need to know about codecs. First, we’ll discuss what a codec is and how they work. Next, we’ll discuss several of the most common audio and video codecs. We’ll also cover some associated topics, including wrappers and transport protocols.
Toward the end of this article, we’ll talk about the relationship between codecs and bandwidth. Finally, we’ll share some of our recommended codec settings for online video and live streaming. Let’s get started with some codecs basics, below.
What professional broadcasters should know about codecs
Professional broadcasters need to understand codecs in depth. Even if you’re not a video engineer, this topic is important. As you probably know, codecs affect your equipment needs, compatibility, budgets, bandwidth needs, and more. Moving forward, next-generation codecs can be the difference between fading into obscurity or being on the cutting edge.
If you’re involved in the digital video industry, this article will provide a checklist of codec information to make sure you’re on top of things.
Codecs, data rate, and file size
Raw digital video is composed of a series of still pictures. When played one after the other is a high speed, you get a video. Similarly, raw digital audio is simply a collection of measurements of the magnitude of various tones.
This raw data is incredibly rich in information. However, that also means it’s bulky and unwieldy. A video composed of thirty images per second quickly becomes extremely large. Therefore, cinema cameras that shoot raw video can easily create terabytes of data from a single day of shooting. The same is true of raw audio recorders.
While this is valuable in certain industries, it’s a liability for online video and live streaming. Our internet connections, mobile devices, and home computers simply aren’t powerful and fast enough to process this data. Storage and bandwidth are expensive, and raw files tear through it.
Codecs shrink multimedia files to manageable sizes
The solution to file size and data rate issues is a codec. The term codec stands for “encoder/decoder.” Essentially, a codec is a mathematical process that reduces digital file sizes by “throwing out” or otherwise reducing unnecessary data. The complex part is doing this intelligently, retaining as much quality as possible.
Different codecs do this in different ways. One basic method that codecs use is to compare each frame to the previous frame. If data remains the same (for example, there’s a dark corner of the frame in both images), it can be tossed from the second frame. This is a simplified example, but it helps you understand how a codec works.
Over time, the methods have improved. However, codecs that compress video to smaller sizes while retaining more quality tend to require more processing power—both to encode and decode.
Common audio and video codecs
There are many different codecs available today. However, there are a few main codec types being used for online audio and video. They are:
- H.264 is the most common video codec used today. It’s supported by every single device and is our recommend codec for online video and live streaming.
- VP9 is another codec that’s developed by Google. It’s free, open-source, and provides better performance than H.264. However, it’s not widely supported for live streaming yet.
- AAC is the most common audio codec today. Developed in the late 1990s, AAC provides good audio quality at relatively low bitrates. AAC is also widely compatible with all sorts of devices.
- MP3 is the original codec that popularized internet sharing of media. It’s still widely used, but not for video streaming. AAC is more efficient and widely supported.
As H.264 is the most popular video codec for online video, it’s worth mentioning a key element of it: profiles. Profiles are different versions of the H.264 codec. There are many different profiles, but the most common are Baseline, Main, and High.
Baseline and Main were originally created for low-powered devices. However, today the High profile is an excellent choice for most live video broadcasts.
Wrappers (mp4 is not a codec)
Let’s clear up one common confusion. The file extension at the end of a digital file often doesn’t tell you anything about the codec. Common filenames for media end in .mp4, .mov, or .avi.
These are called “wrappers” or “container formats.” A wrapper allows a file to contain multiple different elements, such as subtitles and metadata. The container format you use isn’t particularly important for online video. If in doubt, use mp4. It’s the most widely supported format in wide use today.
As you can tell, internet video is a series of technologies built on top of each other to solve new challenges. The transport protocol falls into this category.
Transport protocols are methods for streaming multimedia over the internet. They must be understood by both the sender and receiver in order to function.
There are two very common protocols in use today in the live stream industry. The first is HLS, which is what we use at Dacast to deliver streams to viewers. HLS is widely compatible and provides good performance. The second protocol is RTMP. This is an aging standard, but it’s still widely used for stream ingestion.
Codecs and bandwidth
As you’ve learned, codecs help shrink files, which makes it easier to transmit over the internet. Internet speeds are increasing, but video files are getting bigger also. 4K video is becoming more common, as is HDR and HFR.
The size and quality of your video stream determine how much bandwidth you use. Higher bitrates (which correspond to higher quality) require more bandwidth to send. You’ll need to ensure your internet connection is fast enough to stream at your desired bitrate. You may also want to ensure your viewers have a quality viewing experience by streaming in multiple bitrates at once.
However, this usage is dependent on the codec you use. There are a variety of next-generation video and audio codecs in development today. These promise to deliver better quality with smaller file sizes.
Let’s mention a few briefly. The first, VP9, we’ve already mentioned. Another up and coming codec is HEVC or H.265, which is the successor to H.264. It promises to deliver video with about double the quality/efficiency ration of H.264.
Another forthcoming codec to watch is AV1. This open-source alternative to H.265 provides better quality and maybe ubiquitous in a few more years.
Another codec, this time for audio, is called Opus. The Opus codec delivers better audio quality at every bitrate compared to other audio codecs. Opus codec is free and open-source and natively supported on iOS and Android.
Recommended codec and settings for most live streams and online video
For now, we recommend that most broadcasters use the H.264 codec for video and the AAC codec for audio. These recommendations may change in the future as codec technology matures. However, for now, these are the best choices to reach the maximum possible audience with your OTT video.
For other settings such as bitrate, resolution, sample rate, and so on, check out our blog detailing recommended encoding software settings.
In this blog, we’ve reviewed how codecs work and what the ideal codecs are for use in online broadcasting today. Hopefully, this has helped refresh your memory to prepare you for successful streaming now and into the future.
Now that you’re up to date, you’re ready for live streaming. If you don’t already have one, you’ll need a live streaming platform like Dacast. Ready to test out a live streaming service today? To give Dacast a try, why not start today with our 30-day free trial (no credit card required)? Just click the link below to start streaming live in a matter of minutes!
Any questions, comments, or ideas? Let us know in the comments section, below! And for regular tips on live streaming and exclusive offers, feel free to join our LinkedIn group.
Thanks for reading, and as always, best of luck with your live streams!