Why do so many video formats exist? Why can't we all just agree on one and stick to it? There are so many out there, many of which have gone extinct but many that haven't. How frustrating is it when you download a video that's only available in a format that isn't supported by the device you want to use?

For example, I recently downloaded a video course comprised of MOV files, a format unsupported by my old and outdated smart TV. So instead of watching in the comfort of my living room as I'd intended, I had to watch on my laptop.

Why does this happen? What do you need to know in order to avoid these headaches yourself? Here's everything you need to know about video formats, containers, and codecs.

Understanding Containers and Codecs

Multimedia files are composed of two parts: the container and the codec. The difference between these two things is what trips up most users, but once you understand this difference, you'll finally see why some video files are preferable to others.

When you see a video file with a given extension, you're actually seeing the container type. The container type dictates what kinds of data can be held in the file and how that data is arranged within the file. For example, a container format might have room for one video track, one audio track, and one subtitle track. The thing is, container types don't necessarily dictate how data is encoded.

Image Credit: Michal Steflovic via Shutterstock

Raw video footage requires a lot of space -- a one-minute recording could take up several gigabytes depending on the resolution and framerate. That's why video tracks need to be compressed to reasonable file sizes before they can be burned onto discs or put online to be downloaded. But there are different methods of compression, each with its own pros and cons.

When we talk about video codecs, we're talking about these different methods of compression. And the important thing to know is that container files can support multiple codecs.

This is how problems can arise. Even if your device knows how to read the MP4 video container format, it may not know how to decode the video track within that MP4 file, which might be encoded as Xvid, x264, or x265. Or maybe it can't read the audio track, which could be encoded using any number of audio compression methods.

Common Video Containers

Of the many video container types that have ever been introduced, only a handful of them are used on a day-to-day basis. When downloading videos off the web, there's a 99 percent chance that that file will be one of the following three container types:

  • AVI (Audio Video Interlaced) -- First introduced in 1992 by Microsoft, AVI videos were the most popular type throughout the 90s and into the early 2000s. It can only contain video and audio tracks, and it can actually hold multiple tracks of each but this feature is rarely used. Readability of AVI is almost universal, but it has some compression limitations that result in larger-than-average files.
  • MKV (Matroska Video Container) -- First introduced in 2002, the Matroska format is both free and open standard, which has helped it to stay relevant over the years. MKVs can contain virtually all kinds of video and audio codecs, plus multiple subtitle tracks and DVD menus and chapters, making it the most flexible format currently available. And while Matroska's popularity has been on the rise, it isn't universally supported yet.
  • MP4 (MPEG-4 Version 2) -- First introduced in 2001 but later revised in 2003, the MP4 format took the then-popular QuickTime File Format and improved on it in several ways. It supports a wide variety of video and audio codecs but is most often used with H.263/H.264 for video and AAC for audio. Also supports subtitle tracks.

Common Video Codecs

Though the world hasn't decided on a single standard, the good news is that most videos are produced using one of the following four video codecs. Even better, most devices and video player apps and software support most of these commonly-used codecs out of the box. Mismatched codecs are rare these days and should only happen with very old or very rare videos.

  • WMV (Windows Media Video) -- First introduced in 1999, WMV is a proprietary codec developed by Microsoft to be used with their proprietary ASF container format. A file with the WMV extension is an ASF container with a WMV video track, but WMV video tracks can also be stored within AVI or MKV containers. Most Microsoft devices still support it, but it has fallen out of popular use in recent years.
  • Xvid (H.263/MPEG-4 Part 2) -- First introduced in 2001 as an open source competitor to DivX, Xvid became popular for its ability to compress DVD movies down to CD sizes without sacrificing much quality. Most players support Xvid today.
  • x264 (H.264/MPEG-4 AVC) -- First introduced in 2003, H.264 is best known as one of the encoding standards used on Blu-ray videos and as the most popular encoding standard for video streaming, used by sites like YouTube, Vimeo, etc. x264 is an open source implementation that allegedly produces higher-quality videos at smaller file sizes.
  • x265 (H.265/MPEG-H HEVC) -- First introduced in 2013, H.265 is the up-and-coming successor to H.264, allowing more than twice the data compression while keeping the same video quality. It also supports resolutions up to 8K. All of this means that H.265 will pave the way for better-quality videos while keeping file sizes reasonable. x265 is an open source implementation of it. Because H.265 is so new, it isn't widely supported yet.

Depending on which codec is used, you'll get a different balance between video quality and file size. That's why one person can rip a Blu-ray movie at 1080p for under 2 GB and someone else can rip that same movie at 720p for more than 5 GB. This also explains why Vimeo videos look better than YouTube videos even at the same resolution -- encoding methods matter!

Which Video Format Is Best?

There are only two situations in which you'd need to know about the "best" video formats:

  1. You're creating a video and you need to weigh the pros and cons of how many people can play a certain container type, how many people can play a certain codec, and how to maximize video quality while minimizing file size.
  2. You're given the choice to download a video in multiple formats and you want to know which one will give you the best quality, smallest file size, or a middle-of-the-road compromise.

For containers, choose MP4 if you want to ensure universal playback support but MKV is catching up in popularity because it offers more features and flexibility. As support for MKV grows, you should consider switching from MP4 to MKV.

For video codecs, H.264 is the closest option to a set-it-and-forget-it mentality. It has the widest support and it offers an above-average balance between video quality and file size. But as H.265 gains support over the next few years and as video resolutions push toward 4K, 8K, and beyond, you'll want to switch over to it.

Hope that helps! Still have questions? Feel free to ask! Otherwise, if you have anything else to add, please let us know in a comment below.