What is the Best Video Codec for Web Streaming? [2022 Update]
Do you know what the best codec is for web streaming? If not, don’t worry; we are here to help you get started with live streaming. Professional online video platforms, such as Dacast, take care of most of the technical side of live streaming for you. However, it is always a good idea to understand what is happening behind the scenes when you live streaming.
Codecs are a technology that makes HTML5 video sharing over the internet possible. Codecs are vital to live streaming, but can be a little confusing to understand
We are here to help provide a little background on codecs and then dive into the best codecs for video streaming in 2022. We’ll even provide you with optimal settings for H.264 (which we think is the best video codec and the one we use at Dacast).
The future is always looking bright, so we will also review some of the next-generation video codecs that may dominate the market.
Let’s get started and learn about video codecs!
Table of Contents
- What is a Video Codec?
- How Modern Codecs Work
- What is the Best Video Codec for Streaming?
- H.264: An Overview
- H.264 Encoder Profiles
- Other H.264 Settings
What is a Video Codec?
When you record a video, you are recording a series of still images that play one after another. When you record a video at thirty frames per second, you record at least 30 images every second. The higher the frames per second, the more images are recorded for each second.
All those digital images, plus the audio files that go with them, can consume a lot of storage space!
To deal with all the storage space videos consume, codecs, which stand for “coder-decoder,” were created.
But what does a codec do? In its most simple form, a codec is a video compression method. It takes your large video file, squeezes it down, and compresses it into something much smaller.
It does this by throwing out certain data from a video file to make it smaller while still working to retain as much visual quality as possible.
Basically, it makes video data small enough so that it can be sent over the internet!
How Modern Video Codecs Work
Compressing video files is a little more complicated than just squeezing the file down to a smaller size. What happens, in reality, is that modern video codecs use various mathematical methods to reduce file size.
These mathematical equations and methods are used to analyze which parts of a video don’t change from one frame to the next, so that information can be tossed out without compromising the quality of the video.
Another method looks at how images move and uses mathematical predictions to reduce what information needs to be stored to show that movement.
A few of the technical names for these techniques include chroma subsampling, quantization, and spatial/temporal downsampling. All you need to know is that advanced mathematical equations are happening behind the scenes to make your files small enough to send over the internet quickly!
There are different types of codecs for different types of broadcasting, and codec technology continues to evolve! Let’s learn more about the exact type of codec you need for web streaming!
What is the Best Video Codec for Streaming?
For web streaming, the best video codec is simple to identify – it is H.264. H.264 is hands down the best codec for web streaming because it is highly efficient and compatible with most other forms of video technology you need to use for web streaming.
While there are more efficient codecs on the market, none of them are quite as compatible as H.264.
H.264: An Overview
H.264 was initially developed in the early-2000s and has been updated continuously. It has been the de-facto standard for internet video delivery for quite some time. This continues today. The continual development of H.264 is why it is the best video codec for the web.
Any device built in the last decade probably supports H.264 advanced video coding. This is the critical feature of H.264 since it means that any video encoded and distributed with H.264 can be watched on most devices. This includes laptops, desktops, smartphones, tablets, smart TVs, gaming consoles, and more. High device compatibility makes H.264 one of the best codecs for streaming.
Another benefit of H.264 is the relatively small file size. Compared to the previous generation of video codecs, such as H.263 and MPEG-2, file sizes are about 50% smaller. This helps users to conserve storage and bandwidth.
When it comes down to what video codec to use, H.264 is always a strong choice.
H.264 Encoder Profiles
The H.264 codec has gone through several iterations and updates. It’s not a monolithic standard. H.264 could best be understood as a “family” of related standards. These are captured in the H.264 “profiles” available in any encoder.
There are at least 20 profiles available for H.264. However, most of those are very specialized. Most encoding software only uses a small number of these profiles. That is why it is essential to understand some of the differences among H.264 encoders.
These more commonly-used H.264 encoder profiles are baseline, main, and high.
1. Baseline Encoder Profile
The baseline profile uses only the older, most widely-supported compression features of H.264. This means that video compressed using the H.264 codec, the baseline profile will be compatible with almost all devices. This includes older and low-power devices.
However, the tradeoff is that file sizes will be larger.
Please also note that the baseline profile is not a supported setting for the Dacast OVP and will break your stream if you try to use it. The baseline encoder profile is older and, therefore, not the one we recommend.
2. Main Encoder Profile
The main profile applies some additional encoding features of the H.264 family. This requires more processing power and memory on the decoding side. Older or low-powered devices (such as tablets or smartphones made more than 5-8 years ago) may be unable to decode videos streamed with this profile. However, file sizes are smaller. If you need smaller file sizes, H.264 may be the best codec for streaming for your needs.
3. High Encoder Profile
The high profile is the most modern implementation of H.264. It includes more encoding features that enable smaller file sizes. However, this requires more processing power and memory from the viewer’s devices.
Today, device power has become less of an issue. The high profile is supported on all modern smartphones, tablets, computers, set-top boxes, gaming consoles, etc. However, using a high profile may prevent users with very old devices from accessing content.
The high encoder profile is the best codec for video quality.
Which H.264 Encoder Profile to Use
In short: use the baseline profile to target users on ancient, underpowered devices. If your viewers tend to use modern devices, the high or main profile should be acceptable to use.
Other H.264 Settings
Any video stream or file can be encoded using various live video format options. Here are some H.264 encoder settings that need to be set when streaming to an HTML5 video player.
Video resolution refers to the size of the video, measured in pixels. For example, a standard high-definition video frame is 1920 pixels wide and 1080 pixels in height.
Video is made up of a series of still images. The frame rate is simply the number of pictures per second of video. Thirty frames-per-second (fps) is the most common setting.
Video bitrate refers to the amount of data included in a video, measured in kilobytes or megabytes per second. For example, a video may be encoded at 500 kbps or 1000 kbps (equivalent to 1 Mbps). Bitrate has a direct relationship to quality. All else being equal, a higher bitrate video will be higher in quality than a lower bitrate video.
Another setting for any video is the audio codec being used. As we covered, H.264 is the most common video codec, but AAC is the best audio codec. If in doubt, use AAC. MP3 is another standard audio codec.
Like video bitrate, audio bitrate influences quality. Generally, audio bitrates are kept between 32 kbps and 128 kbps. Thirty-two is appropriate for voice-only videos. For music or higher-quality content, 128 kbps is recommended.
We recommend setting the keyframe interval to 2 seconds.
Those are the settings for the best video format for online streaming when working with the H.264 codec.
How Codec Settings Affect Bandwidth
While we’re on the topic of codec settings, it is important to point out the connection between them. The video settings you select have a major influence on the quality of your video. They also influence file sizes and bandwidth requirements. In general, higher-quality and higher-resolution video requires more bandwidth.
As we mentioned above, bitrate, H.264 profile, and other settings can influence the amount of bandwidth a given video requires. Understanding the bandwidth you need for live streaming is a key factor in your success.
If you’re streaming a live event and are not sure about the amount of bandwidth, you may need, contact Dacast or use our calculator.
Next Generation Codecs
The thing about live video is that video streaming technology is constantly evolving and improving. Although the H.264 codec is currently the best option, some codecs on the horizon will likely take their place in the future.
Let’s take a look at three emerging codecs.
Video codecs are constantly evolving. H.264 is an older video streaming protocol that will soon be replaced. The next version of H.264 is called H.265, or sometimes HEVC. This codec will provide about twice the video quality as H.264 at a given bitrate. That’s expected to help propel ultra-high-resolution 4K video to the mainstream. However, this high performance will require additional processing power.
H.265 is still in development and isn’t very widely supported. Chances are, most devices you and your audience own aren’t capable of playing back H.265 video. We at Dacast are watching the evolution of H.265 closely and recommend you do the same. It is a potentially powerful streaming codec for the future.
Another rising codec is H.266, also known as Versatile Video Codec or VCC. The main benefit of streaming with this codec is that it is capable of 4K streaming. As the name suggests, this versatile codec can handle everything from ultra-low quality videos to ultra-high definition.
The other significant benefit of this codec is that it is very efficient in data compression and transport, which makes it better suited to handle large files than the other technology we’ve discussed.
The biggest downside of this codec, and the reason that it is not yet the norm, is that it is not yet highly supported by existing streaming technology. It is so far ahead of the game that the industry is yet to catch up. H.266/VCC is a streaming codec of the future with the potential for high video quality.
Of course, the H.26x family of codecs isn’t the only video codec. One alternative is VP9, developed by Google and is free and open source.
VP9 is a powerful codec that YouTube uses. It’s also been tested by Netflix and is highly effective for delivering 4K video content. This format is open-source, which makes it entirely customizable.
However, VP9 is not yet widely supported in the live streaming world. Therefore, we can’t recommend using it for streaming at this time.
Video codecs are a critical part of any digital video effort. Hopefully, this article has helped you understand what codecs are, how they work, and which are the best video codecs for HTML5 live streaming.
As we discussed, H.264 is currently the best codec for streaming. However, H.266 may take that title once the related technology catches up.
Are you looking to start live streaming or improve your professional live streaming experience? Why not give Dacast a try?
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 14-day free trial.
All you have to do to get started is create a Dacast account today. No credit card is required.
Feel free to join our LinkedIn group for regular tips on live streaming.
Thanks for reading, and good luck with your broadcasts!
Please note that Max Wilbert originally wrote this post. It was revised in 2021 by Emily Krings to include the most up-to-date information. Emily is a strategic content writer and storyteller. She specializes in helping businesses create blog content that connects with their audience.