If you’re new to the wide and wonderful world of YouTube—or working with any kind of video for that matter—you might have heard of video codecs.
Or perhaps you’re not so new, and you’ve heard of them, but you don’t really understand what they are or what they do. If you are either of these people, this post is for you.
Video codecs are the software and method that is used to compress video. In the case of YouTube, codecs are employed to reduce the size of the video before it is streamed by millions of people across the globe.
It is an essential part of transmitting video, and there are a variety of different flavours available. But what are they? And why are they so important? Read on to have YouTube codecs explained in full.
What is a Codec?
In short, codecs are compression. They are the software and method used to compress a large video file into a smaller video file using clever algorithms that strive to achieve the most significant reduction in size at the expense of as little loss of detail as possible.
Video is an incredibly large medium in terms of raw data—which we’ll get to shortly—and few people who don’t work with video appreciate just how much information is involved. Of course, anyone who edits video in any capacity will be fully aware, and anyone who has ever attempted to edit 4K video on a computer that, while powerful, was nevertheless not up to the task, will appreciate the struggle that video can present.
If you need help in deciding between 1080p and 4K – maybe you are lost and don’t know the difference – check out my deep dive blog on 4K and it could take YouTube by storm!
Codecs don’t typically help with editing, however, but they make life a lot easier on your Internet connection, and given how far our Internet speeds have come in recent years, the fact that there are still effort to improve compression and shrink video files further should serve to highlight how big video can be.
How do Codecs Work?
In the simplest terms, codecs compress information into a smaller size by replacing it with a different set of data that represents the original information.
To give a very simplified example of this, imagine you have a still frame of 1080p video where the top half of the screen is entirely black. Each pixel on the screen has to be accounted for in the data for that still frame, which means there are 1920×540, or 1,036,800 pixels. That’s a lot of data.
However, we don’t need to store every single pixel in our data. Knowing that the next million pixels are the same, we can just say that and be done. Saving the data equivalent of “Black: 1,036,800 times” is a lot more efficient than actually listing black over a million times.
Of course, there is much more to it than that, but it should serve to give you a basic grounding in how codecs do their job. Compression can be taken to extreme levels, of course. Video can be compressed until it is little more than a pixellated blur of what it once was—albeit is a pixellated blur that takes up considerably less space than it once did. Many ingenious techniques are employed to preserve information, but as a general rule, the more compressed a video is, the more of that original information you lose.
“Why is information lost?” we hear you asking. In the above example of a frame that is half black, no information would be lost. The entirety of that black half of the screen would be stored fully intact in the dramatically reduced space we outlined. Real-world applications of compression are not so simple, however.
There are very rarely large portions of a frame that are the same colour in a frame of video, especially a film or TV show. Furthermore, there may not be any smaller areas that are identical. When you consider the depth of colours available and things like film grain, it is entirely possible to have frames of video where there isn’t a single collection of pixels adjacent to each other that are identical. In those cases, the simple compression method we detailed above would be useless.
This is where the information loss comes in. Codecs employ algorithms to decide what is compressible. If you have two pixels that are ever so slightly different shades of blue, they would technically be different but probably not different enough that the human eye could distinguish between the two.
The compression algorithm may count both of these pixels as the same colour, allowing it to reduce the size of the frame slightly.
And, when the video is decoded, it will still look good to our human eyes, but the information of that slightly differently shaded blue pixel is lost, and cannot be recovered from the encoded video.
This is why high-resolution footage with a lot of film grain is hard to compress, because you either can’t get much of a size reduction from the compression, or you lose a lot of that fine detail.
This should hopefully also go some way to explaining why there are so many codecs available. It is not a simple matter of which codec reduces the video size the most, there are preferences to take into account.
Some codecs are more aggressive, others don’t achieve the same degree of size-reduction. Depending on what you are doing with your video, different codecs may be suitable.
Why do we Need Codecs?
Computers are getting more powerful, and Internet speeds are getting faster, but at the same time, media is growing in fidelity.
There was a time not too long ago when our only means of watching video was the equivalent of a 640×480 screen, in what would retroactively be called 480i. For comparison, 1080p—which is considered the bare minimum these days and is even drifting slowly into obsolesce—is 1920×1080. That’s three times more information than the standard definition video we used to watch.
In keeping with this trend, 4K—which is well on its way to replacing 1080p as the defacto standard—is four times larger again. It should be noted that the “4” in 4K is not down to the fact that it is four times the size of 1080p, but rather the fact that the horizontal resolution is nearly 4,000 pixels across.
But 4K itself already has a replacement on the horizon, with 8K screens creeping onto the market. As you might have guessed, 8K is four times larger again than 4K, though we are far from 8K being commonplace in our homes, so we wouldn’t hold off on purchasing that 4K television just yet.
So what does all this mean? It means that despite computers getting more powerful and Internet speeds getting faster, the size of the media we are trying to play is getting similarly more substantial. Exponentially so, in fact. And this is just taking video files into account; there is also game streaming to consider, which Google is getting into in the form of their Stadia service.
And, while this is a gaming platform, it ultimately boils down to streaming live video to your screen, and will likely be a big part of YouTube if it succeeds.
Two players playing video games on TV at home
To illustrate this point, here is a list of some resolutions and their typical data rate in megabits per second (Mbps). This is the amount of data that is being transmitted per second, whether that is from a Blu-ray drive to your screen, or from a distant server and over the Internet.
Compression Type
Resolution
Bitrate
YouTube @ 60FPS
1080p
4.5-9 Mbps
Blu-ray
1080p
20-30 Mbps
H.264 50Mbps
1080p
50 Mbps
No Compression
1080p
3,000 Mbps
YouTube @ 60FPS
4K
20-51 Mbps
X264 Codec
4K
100 Mbps
Blu-ray
4K
82-128 Mbps
No Compression
4K
10,000 Mbps
We should mention that all of the above compression methods are to a degree where the video is still kept to a high quality.
Of course, it would be possible to significantly reduce the bitrate further with more compression, but that would compromise the quality of the video to the point where it would affect the viewing experience.
Hopefully, that table will illustrate the importance of codecs. Even looking at the raw, uncompressed 1080p bitrate, it is sixty times more data than the typical bitrate that 4K video streamed over YouTube requires. Bearing in mind that 8Mbps is equivalent to 1 megabyte per second, a raw, uncompressed 4K stream would require data transfer rates of over a gigabyte per second.
This would present serious problems for Internet delivery, optical bandwidth in disc drives, and even if you were pulling the information directly from a high-speed solid-state drive, your computer would still need to be up to the task of processing that much information.
Audio Codecs
We’ve been focused on video codecs so far, but the audio is a critical part of the process as well, and the two do not necessarily go together in the compression process. When you encode video, the file name at the end (often .MP4) is little more than a wrapper. For the most part, you can mix and match your video and audio codecs to suit your needs.
As for the audio codecs themselves, there are nuances to compressing audio that differ from video, of course. For one thing, the smaller size of audio means that audio bitrates are typically measured in kilobits per second (Kbps) rather than megabits per second (Mbps).
But the broad strokes are the same as video codecs. They work to reduce the size of the audio by compressing it, often at the cost of some of the information stored.
The Best Codecs For YouTube
The answer what the best codecs for YouTube are is quite a short one since YouTube themselves openly tell us. YouTube prefer you to upload your videos in MP4 format, encoded with the H.264 video codec and AAC audio codec.
As we mentioned above, the file format and the codec are two different things, and YouTube is open to several different formats, such as MOV, AVI, MP4, WMV, MPEG, WebM, 3GPP, and FLV.
What Happens When I Upload Video to YouTube?
If you are already uploading videos to YouTube, you will be familiar with the “processing” phase of the upload process. During this time, YouTube is converting your video to a number of different resolutions.
When you select a different quality in a video—or when YouTube changes the quality automatically due to bandwidth issues—YouTube is not doing that on the fly. All the available quality options on a video are pre-processed and exist as their own video files on the YouTube servers.
Obviously, the capability to upscale your video to higher resolutions than the one you uploaded does not yet exist to the degree that would be feasible to use in this manner, but YouTube will create lower resolution alternatives. The standard definition is typically the first one to be created, though we would generally advise waiting until at least the high definition option has finished encoding, as that will be the most in-demand version.
YouTube has a preference for the codec you upload your video with because the fewer incoming codecs they have to deal with, the more they can optimise their platform and reduce the time it takes to process new video.
Not all codecs are free; however, the most popular ones that are used today do not cost money to use. While we are on the subject of free codecs, it is worth pointing out that codecs can be dangerous in the same way that downloading an executable file from an untrustworthy source can be.
Codecs can be used to get malicious software onto your computer, or they could just cause serious problems when attempting to playback media. So take care when downloading them, and make sure you are downloading from a verified source.
Summing Up
So, now you have had YouTube codecs explained, why you need them, and how they work (in simplified terms).
Remember, the world of codecs is not static, and new developments happen all the time, especially with new video formats and resolutions popping up from time to time.
It’s worth checking in with YouTube’s help resources occasionally to make sure there haven’t been any developments you should know about.
Top 5 Tools To Get You Started on YouTube
Very quickly before you go here are 5 amazing tools I have used every day to grow my YouTube channel from 0 to 30K subscribers in the last 12 months that I could not live without.
1. VidIQ helps boost my views and get found in search
I almost exclusively switched to VidIQ from a rival in 2020.
Within 12 months I tripled the size of my channel and very quickly learnt the power of thumbnails, click through rate and proper search optimization. Best of all, they are FREE!
2. Adobe Creative Suite helps me craft amazing looking thumbnails and eye-catching videos
I have been making youtube videos on and off since 2013.
When I first started I threw things together in Window Movie Maker, cringed at how it looked but thought “that’s the best I can do so it’ll have to do”.
Big mistake!
I soon realized the move time you put into your editing and the more engaging your thumbnails are the more views you will get and the more people will trust you enough to subscribe.
That is why I took the plunge and invested in my editing and design process with Adobe Creative Suite. They offer a WIDE range of tools to help make amazing videos, simple to use tools for overlays, graphics, one click tools to fix your audio and the very powerful Photoshop graphics program to make eye-catching thumbnails.
Best of all you can get a free trial for 30 days on their website, a discount if you are a student and if you are a regular human being it starts from as little as £9 per month if you want to commit to a plan.
3. Rev.com helps people read my videos
You can’t always listen to a video.
Maybe you’re on a bus, a train or sat in a living room with a 5 year old singing baby shark on loop… for HOURS. Or, you are trying to make as little noise as possible while your new born is FINALLY sleeping.
This is where Rev can help you or your audience consume your content on the go, in silence or in a language not native to the video.
5. Shutterstock helps me add amazing video b-roll cutaways
I mainly make tutorials and talking head videos.
And in this modern world this can be a little boring if you don’t see something funky every once in a while.
I try with overlays, jump cuts and being funny but my secret weapon is b-roll overlay content.
I can talk about skydiving, food, money, kids, cats – ANYTHING I WANT – with a quick search on the Shutterstock website I can find a great looking clip to overlay on my videos, keeping them entertained and watching for longer.