Which Codecs Does YouTube Use?

Author’s Note (March 15, 2022): A colleague recently advised me that YouTube was now encoding all videos into VP9 format. A quick check revealed that he was correct; literally every video that I checked, including some uploaded back in 2010, was encoded into VP9 as well as H.264.

What’s interesting is that many low-volume videos, like this one with 118 views that I uploaded in 2010, displayed H.264 even though there was a VP9 version available with a lower bitrate.

Here’s the file list produced by YouTube-dl. Note that the MP4 file using the avc1 codec has a bitrate of 2310 kbps, while the webm VP9 file has a bitrate of 1505 kbps. Why would YouTube produce a VP9 with a lower bitrate and then not stream it?

To verify this behavior, I loaded all the files contained in Table 6 below. All continued to display avc1 according to Stats for Nerds though all had VP9 encodes. As above, this happened even when the VP9 encoded file had a much lower bitrate.

The other major change that I noticed was that AV1 usage had been pushed to very low view counts. Table 4 from the original article showed that all Seth Meyers videos, even those with multiple million view counts, were encoded to VP9. This time around, every Meyers video that I checked used AV1.

As shown in Table 5 below, when I last checked, all Dan Patrick videos, which had view counts ranging into the low 20 thousand, were encoded with VP9. When I checked today, several Dan Patrick videos with view counts in the mid-teens were encoded with aV1, like this one. That’s a remarkable change.

What does this all mean? It may be time to rethink deploying VP9, AV1, or both.

Also, it means that most of the data below is obsolete and, at least as it relates to the split between H.264 and VP9, may have been wrong in the first place. I didn’t know about youtube-dl when I wrote this first article and assumed that YouTube didn’t stream VP9 for low view count videos because they didn’t encode with that codec.

Now we know that for certain videos, YouTube still streams H.264 even when VP9 is available. So, when I tested last August, YouTube could have been producing VP9 encodes for the files listed in Table 6 and just not streaming them.

As of today:

  1.  YouTube encodes all videos with the VP9 codec, but for some reason displays H.264 for low view count videos.
  2. YouTube deploys the AV1 codec at much, much lower view counts than reported below.

This article reviews which codecs YouTube uses for the unrelenting torrent of videos that it ingests and encodes. The data suggest that AV1 is only worthwhile for videos with view counts in the mid-to-high millions, but VP9 is worth considering for view counts in excess of a few thousand. 

As a general rule, if YouTube can’t afford to use a particular codec, chances are you can’t afford to use it either. On the other hand, if YouTube is starting to use a codec for videos with moderate view counts, perhaps it’s interesting for you as well.

This article explores which codecs YouTube uses for the different videos uploaded to the service and their respective view counts. By way of background, I was trolling YouTube and the fabulous Stats for Nerds feature for a lesson that I’m producing for a new course. The object of the exercise was to ascertain the breakeven points that seem to dictate codec usage.

Encoding Cost and Bandwidth Savings

In terms of cost/quality tradeoffs, the last time I looked, AV1 (libaom-AV1) took about 18 times longer to encode than H.264 (x264), which translates directly into 18 times the encoding cost if you’re running your own encoding farm, which YouTube does. In contrast, VP9 (libvpx-VP9) took only twice as long as H.264. At best, I found that VP9 saved about 15% over x264 while AV1 shaved 45% at the same quality level.

How do these quality/bandwidth savings numbers translate to codec usage for YouTube, which ingests a mind-boggling 500 hours of video per minute?  The TL/DR is that YouTube uses H.264 for the vast majority of videos that might get watched a few hundred times, or even lower. Starting in the 3-5,000 range, YouTube starts to use VP9, with AV1 reserved only for videos that will likely exceed more than five million views or so.

Of course, perhaps Google’s Argos Video Coding Unit, which Google developed specifically to process video, is responsible for what appears to be a dramatic change of behavior relating to VP9 usage. AFAIK, there’s only one other VP9 hardware accelerator (from Xilinx by way of NGCodec) and it’s for live video and isn’t commercially available. So, even if YouTube uses VP9 for comparatively low view counts, it might not make sense for others without hardware-accelerated VP9 encoding.

AV1 for Multiple Million View Counts

Let’s start at the top. Clicking Explore then Music, I checked the top ten “hottest videos of the week” in the music section. Most of these videos were newly released, yet many had over 5 million views. Eight of the ten videos were encoded using the AV1 codec; the rest were VP9. Interestingly, YouTube whiffed on the fabulous Olivia Rodrigo video (it is brutal out there), which was top of the list and had over 9.6 million views and counting.

YouTube uses the AV1 codec when views exceed several million
1. Codec usage for music videos.

VP9 for Multiple Thousand View Counts

Next, I checked the top 10 news videos, all with much lower view count, and with much shorter legs than other categories that I checked (news being topical and all that). Though the view count ranged from 4,582 to 673,454, YouTube encoded all videos using the VP9 codec.

YouTube uses the VP9 codec when views are between a few thousand and a few hundred thousand.
2. Codec usage for news clips.

Next, I checked gaming videos, which enjoy greater view counts than news and presumably longer tails. Here we saw an even split between AV1 and VP9. The choice of codec sometimes made sense (see the bottom three) though using VP9 for Call of Duty and LEGO had me shaking my head.

YouTube used a mix of VP9 and AV1 for gaming clips.
3. Codec usage for gaming clips.

Next, I hunted around for an entertainment site with moderate to high views and settled on Late Night with Seth Meyers, apparently the new home for Mr. Meyers who I’m sure we all remember from Saturday Night Live. A line of videos entitled A Closer Look enjoyed very solid view counts in the low millions, yet YouTube encoded them all in VP9.

YouTube eschewed AV1 even when view counts were in the low millions.
4. Codec usage for A Closer Look.

My favorite website for sports clips while working out is the Dan Patrick show; Numbers here were modest but VP9 was again used for all videos.

YouTube used VP9 even when view counts were relatively low.
5. View counts and codec usage for the Dan Patrick show.

H.264 For the Great Unwashed

Finally, I looked at the videos that I produced, all with pathetic view counts (note to self: fire marketing director). As you can see below, it was all H.264. I checked Streaming Media’s YouTube videos which enjoyed counts into the low several hundred and they were all H.264 as well.

YouTube encoded with H.264 when view counts were in the three figures
6. Codec usage for the Streaming Learning Center.

The Bottom Line

The bottom line appears to be:

  • View counts below a few thousand – use H.264.
  • View counts reaching into the mid-five figures, say over 3,000 or so – consider VP9. Again, since Google’s use of VP9 may be triggered by the Argos VCU, you should do your own testing with your encoding setup to confirm this result.
  • Don’t consider AV1 until view counts exceed multiple millions.

The big surprise for me wasn’t the AV1 findings, but that YouTube uses VP9 so extensively. When I analyzed VP9, the results were meh (see here). It may be that YouTube is using a different VP9 codec than I tested, or that YouTube is simply better at encoding VP9. Whatever the cause, given that YouTube’s bandwidth costs are probably a lot lower than yours (per GB), it should take you fewer viewing hours to achieve breakeven, meaning that it might be time to rethink VP9.

Resources

Real-World Bandwidth Savings from VP9, HEVC, and AV1

Computing Breakeven on New Codec Deployments

How to predict codec success – Techradar Pro, December 2020.

 

 

 

 

About Jan Ozer

Avatar photo
I help companies train new technical hires in streaming media-related positions; I also help companies optimize their codec selections and encoding stacks and evaluate new encoders and codecs. I am a contributing editor to Streaming Media Magazine, writing about codecs and encoding tools. I have written multiple authoritative books on video encoding, including Video Encoding by the Numbers: Eliminate the Guesswork from your Streaming Video (https://amzn.to/3kV6R1j) and Learn to Produce Video with FFmpeg: In Thirty Minutes or Less (https://amzn.to/3ZJih7e). I have multiple courses relating to streaming media production, all available at https://bit.ly/slc_courses. I currently work as www.netint.com as a Senior Director in Marketing.

Check Also

How GPAC Technology is Shaping the Future of Streaming: Key Insights from Fred Dawson

In a recent interview available on YouTube, Jan Ozer sat down with Fred Dawson, an …

The Reality of Codec Adoption in Six Pictures

Most people reading this post want new codecs to succeed as soon as possible, and …

New Lessons on Streaming Monetization Added to Streaming Media 101

The Streaming Learning Center is pleased to announce the addition of four new lessons on …

7 comments

  1. If you look at this video.
    https://www.youtube.com/watch?v=0yk4SPRisPA
    min 10:54
    You can see that there is VP9 hardware accelerator from Broadcom on top of the Google and NGCodec that you mentioned.

  2. Hey Jan,

    Thanks for the info. What if my device does not support AV1, and I click on a video with millions view counts (suppose it is encoded with AV1)? Then my request will be redirected to the same video encoded with VP9? And if my device does not support VP9 either, the request is redirected to the same video with H264?

  3. Jan,

    Do you think that YouTube will gradually convert more and more lowish viewcount videos over to AV01 and then eliminate their VP9 and/or h264 copies? If so, when do you think this might happen? Or do you think they would at least keep the VP9 version around for many years, even if h264 goes away?

    Asking this question because I am looking at one or more new laptops and/or micro PCs where it would be just an iGPU. Trying to weigh the relative merits of Intel 11gen iGPU which has fixed function AV01 decode vs AMD 5000 iGPU which doesn’t, but CPU offers 6 to 8 cores vs only 4 for Intel, and better performance per watt.

    If I find that I need something more powerful, like a gaming laptop with a dGPU chip or desktop with dGPU card, and if it’s an nVidia 3000 or Radeon 6000 series, that could handle the AV01 decode, but I suspect that having to use your dGPU to play a YT or similar video isn’t very power efficient.

    I’m not concerned about battery runtime nor am I going crazy with carbon footprint or costs, it’s more a concern about cooling, since even if I’m not touching the 3D graphics or tensor cores the dedicated uses more power just for baseline video rendering.

    Although less important to me because it’s more of a TV than computer thing, what do you think Netflix is gonna do viz older formats being replaced with AV01?

    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *