YouTube encodes some videos using the AV1 and VP9 codecs. This post identifies the H.264 versions also created by YouTube for devices incompatible with VP9/AV1 for 1080p and larger videos.
In a recent post, I explored which codecs YouTube used for videos ranging from a few hundred views to a few million. The conclusion was H.264 for videos with a few thousand views or less, VP9 for videos with around 3,500 views and higher, transitioning to AV1 for videos with view counts in the mid-millions.
One reader asked the following question.
“What if my device does not support AV1, and I click on a video with millions of 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?”
My response was that “YouTube encodes all videos to H.264, and adds VP9 and AV1 for videos with high view counts. YouTube appears to encode all videos larger than 1080p with VP9. However, YouTube only creates H.264 versions of those videos at 1080p and lower. So, in all cases, there will be an H.264 version that you can watch but not beyond 1080p.”
Let’s address the 1080p case first.
Which Codec Does YouTube Use for 1080p Videos?
As mentioned before, YouTube encodes all videos to H.264 and adds VP9 or AV1 versions depending upon the view count. You see this in Figure 1 below, which has two components. In the background is YouTube’s Stats for Nerds showing VP9 encoding for this Seth Meyers video. Below that is a screen from the Wondershare Uniconverter, which is the tool I use to download videos from YouTube and other sites.
As you can see, the tool allows you to choose which version you want to download, and in this instance, shows only H.264 files. So, even though the file played in Chrome is VP9 there is an H.264 version available.
Which Codec Does YouTube Use for 2K and Larger Videos?
Here’s where the picture gets a bit murkier. In YouTube, I searched for 4K videos and checked which codec YouTube used for the first ten on a Windows computer running Chrome. All were encoded with VP9.
Then I used Uniconverter to examine the files that YouTube created for each video, as shown in Figure 2. There, you see that the 2K/4K versions are encoded with VP9 (WebM) while 1080p and smaller are H.264. So, legacy devices that only support H.264 can play the video, but only up to 1080p resolution.
Figure 2. YouTube encodes versions larger than 1080p using VP9 only but creates 1080p and smaller versions with H.264.
The fact that YouTube doesn’t encode versions of UHD videos larger than 1080p with H.264 should come as no surprise to those familiar with Apple’s support for VP9 in Safari. Specifically, the primary reason (if not the only reason) that Apple decided to support VP9 in Safari and AppleTV was to play videos at larger than 1080p resolution.
Interestingly, I found no 4K videos encoded with AV1. I’m hesitant to conclude that YouTube doesn’t encode any videos larger than 1080p with AV1 but two bits of evidence point in that direction. First, Apple only supports VP9, not AV1, despite being a founding member of the Alliance for Open Media. You can see this in the screenshot below from caniuse.com/?search=AV1. So, if YouTube encoded any 4K videos in AV1, Apple supporting only VP9 would be an incomplete solution to the 4K video problem.
The other bit of evidence mitigating against YouTube encoding 4K videos with AV1 is, of course, encoding time, which is 18x slower than H.264 and about 9 times slower than VP9 for 1080p videos. I haven’t tested how this scales with 4K videos, but I’m guessing the result would be cost-prohibitive using YouTube’s current software-based AV1 encoding schema.
The bottom line is that YouTube never strands any viewers without an H.264 version to watch, though you may not be able to watch at larger than 1080p resolution unless your viewing device supports VP9.