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:
- YouTube encodes all videos with the VP9 codec, but for some reason displays H.264 for low view count videos.
- 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.
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.
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.
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.
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.
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.
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.
How to predict codec success – Techradar Pro, December 2020.