Skip to Main Content

What's the Difference Between All These Video Formats, and Which One Should I Use?


Dear Lifehacker,
I know a lot of video players (like PotPlayer) can play any video file out there, but why are there so many video formats in the first place? Is there a real difference between DivX and XviD, or MP4, and MKV? When I rip a DVD, or go hunting for downloads, which format is the best to use?

Sincerely,
Confused About Codecs

Dear Confused,
The world of video formats can be pretty confusing, but there are only a few things you really need to know. First, it's important to note that a video format is more than just its file extension. Extensions like AVI are not, in fact, video codecs—they're containers. Here's what you need to know about how it all works.

What Is a Codec?

Most of the video you'll come across is compressed, meaning its been altered to take up less space on your computer. For example, a regular Blu-Ray disc usually takes up around 30 or 50GB of space—which is a lot for a normal person to download or store on their hard drive. So, we usually compress movies to make them more manageable, usually with some loss in video quality.

A codec compresses and decompresses data. It interprets the video file and determines how to play it on your screen. Your computer comes with many codecs pre-installed, though you can install codec packs for wider support, or a program like VLC or PotPlayer which have lots of codec support built-in (which we prefer).

Some examples of codecs include:

  • FFmpeg (which includes formats like MPEG-2, the format in which DVDs are stored, and MPEG-4, the format Apple uses for movies in the iTunes store)

  • DivX, which works with a certain type of MPEG-4 file, and was often used to rip DVDs in the pre-HD era

  • XviD, an open source version of DivX, popular among movie pirates

  • x264, which compresses H.264 videos (Also known as MPEG-4 AVC), and is very popular for high definition videos

There are a lot of different codecs out there, and it can get really confusing with all the different versions of MPEG standards. These days, you really only need to concern yourself with a few—which we'll talk about in a moment.

What Is a Container?

A container is, essentially, a bundle of files. Usually a container consists of a video codec and an audio codec, though it can also contain things like subtitles. Containers allow you to choose one codec for your video and one for your audio, which is nice—that way, you can choose to use the high-quality DTS audio, or compress your audio to something like MP3 for even more space savings. It just gives you a bit more control over how you record your videos or rip your movies. Popular containers include:

  • AVI

  • Matroska (which uses the extension MKV)

  • MP4 (which has been popularized by Apple in the iTunes Store—note that this can also come with the M4V extension, but the container is the exact same)

  • MOV (which was created by Apple)

The main difference between different containers is not only the codecs they support but what other features they support—like subtitles or chapters. These days, MKV is an extremely popular container, mainly because it supports nearly any video codec under the sun, as well as a ton of extra features (plus it's open source).

So Which Should You Use?

These days, you'll only really come across a few different codecs and containers as you browse the web for video. DivX and XviD were once popular for standard-definition videos, like ripped DVDs, but are mostly outdated these days, so I wouldn't use them to rip your own DVDs. Handbrake, our favorite DVD ripper and video encoder, supports three video codecs (which you can see under the "Video" tab) and two containers (which you'll find under "Output Settings"). H.264, which Handbrake uses by default, will give you the best quality, though if you don't care about quality, MPEG-4 will probably compress faster.

As for containers, both MKV and MP4 support high quality H.264 video, but in general we prefer MKV for almost everything, since it has more features, supports higher quality audio, and is open source. The one downside of MKV is that it isn't as well supported by certain programs and devices. So, if you're putting these videos on your iPad, Apple TV, or Xbox 360, for example, you'll want to go with the more widely supported MP4. If you're watching them in VLC, PotPlayer, XBMC, or another video player that supports MKV, then MKV is the way to go.

That's a lot of information to throw at you in a few paragraphs, but like we said—despite how big and confusing the world of video is, a lot of those codecs are outdated, and the vast majority of the time, you'll just be choosing between MKV and MP4. If you want a more detailed comparison, check out Wikipedia's Comparison of Video Codecs, Comparison of Container Formats, and its entry on MPEG for more info on all the different variations of the MPEG standards of video compression.

Sincerely,
Lifehacker

Photo remixed from Péter Gudella.