Team Blog

What is the Best Video Codec for Web Streaming? [2021 Update]

By Max Wilbert

12 Min Read

banner image featured
author avatar

Max Wilbert

Max Wilbert is a passionate writer, live streaming practitioner, and has strong expertise in the video streaming industry.

Table of Contents

    Share this post

    Table of Contents

      Getting started with live streaming is easier than ever. However, setting up advanced, high-quality streams does require a small amount of technical knowledge. Although your online video platform will take care of most of the technicalities, it’s still good to have some idea of what is going on behind the scenes.

      That said, codecs are important for HTML5 video streaming. This technology is what makes it possible to stream over the internet. Codecs are important, but they can also be a bit confusing.

      In this post, we’re going to give you a little bit of background on codecs before we discuss which video codec is best for web streaming in 2021. We will discuss the optimal settings for this codec and review some of the next-generation video codecs to look out for.

      Table of Contents

      • What is a Video Codec?
      • 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?

      best web video codec
      Video codecs are essential to web streaming.

      Raw video is composed of a series of still images played one after another. However, at thirty frames per second, the amount of storage space necessary for digital video grows very quickly.

      Codecs, which is short for “coder-decoder,” were created as a solution to this problem. At their core, a codec is a video compression method. They “throw out” certain data to make video files smaller in size, while trying to retain as much quality as possible.

      Modern video codecs use many different mathematical methods to reduce file size. These methods include detecting when certain areas of the video don’t change from frame to frame, allowing you to toss out certain data.

      Other methods look at movement and use mathematical prediction to reduce the need to store every pixel. Some of these methods are called chroma subsampling, quantization, and spatial/temporal downsampling.

      There are different types of codecs available for broadcasting, and as related broadcasting technology evolves, codecs follow suit.

      What is the Best Video Codec for Streaming?

      At this point, H.264 is the best video codec for web streaming. The main reason that H.246 is considered the best code by many is because it hits the sweet spot between efficiency and compatibility.

      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 Advanced Video Coding (AVC)
      H.264 is a powerful video codec.

      H.264 was originally 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.

      Any device built in the last decade probably supports H.264 advanced video coding to some degree. 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.

      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.

      H.264 Encoder Profiles

      The H.264 codec has gone through a number of iterations and updates. It’s not a monolithic standard. In fact, H.264 could best be understood as a “family” of related standards. These are captured in the H.264 “profiles” that are 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.

      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.

      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 not be able to decode videos streamed with this profile. However, file sizes are smaller.

      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, and so on. However, using a high profile may prevent users with very old devices from accessing content.

      Which H.264 Encoder Profile to Use

      In short: use the baseline profile if you’re targeting users on very old, underpowered devices. If your viewers tend to use modern devices, the high or main profile should be fine to use.

      Other H.264 Settings

      H.264 video codec
      H.264 is geared for high-quality HD (high-definition) digital video and compatible with a wide variety of old and new technology, from TVs to laptops.

      Any video stream or file can be encoded using a wide variety of live video format options. Here are some of the H.264 encoder settings that need to be set when streaming to an HTML5 video player.

      Resolution

      Video resolution refers to the size of the video, measured in pixels. A standard high-definition video frame, for example, is 1920 pixels wide and 1080 pixels in height.

      Frame Rate

      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.

      Bitrate

      Video bitrate refers to the amount of data being included in a video, measured in kilobytes or megabytes per second. For example, a video may be encoded at 500 kbps, or at 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.

      Audio Codec

      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 common audio codec.

      Audio Bitrate

      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.

      Keyframes 

      We recommend setting the keyframe interval to 2 seconds.

      How Codec Settings Affect Bandwidth

      live video codec
      Bandwidth consumption depends on your encoder settings.

       

      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 amount of 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, there are some codecs on the horizon that will likely take their place in the future.

      Let’s take a look at three emerging codecs.

      H.265

      Video codecs are always evolving. H.264 is an older video streaming protocol, and it 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.

      H.266/VCC

      Another rising codec is H.266, which is 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 codec is very versatile and can handle everything from ultra-low quality videos to ultra-high definition.

      The other major 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.

      VP9

      VP9 codec
      VP9, a successor to VP8, is an open and royalty-free video coding format developed by Google.

       

      Of course, the H.26x family of codecs isn’t the only video codec that exists. One alternative is VP9, which is developed by Google and is free and open source.

      VP9 is a powerful codec that is used by YouTube. It’s also been tested by Netflix and found to be highly effective for delivering 4K video content. This format is open-source which makes it quite 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.

      Conclusion

      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, once the related technology catches up, H.266 may take that title.

      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 30-day free trial.

      All you have to do to get started is create a Dacast account today. No credit card required.

      GET STARTED FOR FREE

      For regular tips on live streaming, feel free to join our LinkedIn group.

      Thanks for reading, and good luck with your broadcasts!

      Please note that this post was originally written by Max Wilbert. 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.

      author avatar

      Max Wilbert

      Max Wilbert is a passionate writer, live streaming practitioner, and has strong expertise in the video streaming industry.

      Sign up for a 30-Day trial.

      Read Next

      article featured
      article featured
      article featured

      Team Blog

      Mobile Live Streaming: How to Broadcast from a Smartphone

      author avatar

      Emily Krings

      15 Min Read