Ask LH: What's The Difference Between All These Video Formats?

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. A container is the file format which can use multiple different codecs -- such as DivX or x264 -- to compress a certain standard of video -- such as MPEG-4 or H.264, respectively -- into a hard-drive friendly amount of space. Here's what you need to know about both codecs and containers, and what that means for the videos you rip yourself.

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 30GB or 50GB of space -- which is a lot for a normal person to download or store on their hard drive. So we 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 we prefer to codec packs). Some examples include:

  • FFmpeg (which includes formats like MPEG-2, the format in which DVDs are stored, MPEG-2 Part 3, which you know of as MP3s and MPEG-4, which is what Apple uses 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 couple of minutes.

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
  • Mastroska (which uses the extension MKV)
  • MP4 (which has been popularised by Apple in the iTunes Store)
  • 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 (DivX's open source counterpart) are popular for standard-definition videos, like ripped DVDs, but is mostly outdated, so I wouldn't use it to rip your own DVDs. Handbrake, our favourite 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, MKV and MP4 are pretty similar, but in general we prefer MKV for almost everything. 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 you only really need to concern yourself with a few. 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.

Cheers Lifehacker

Got your own question you want to put to Lifehacker? Send it using our contact tab on the right.


Comments

    For the apple TV owners,
    Another handy utility is FastMKV2MP4 (http://nuclearbit.blogspot.com.au/)
    If you have an MKV file with x264 codec this can swap the container to MP4 with out have to re-encode the content.
    A much faster process.

    Beware also if downloading torrents containing MKV files. This seems to be the most popular torrent delivery method for junk files and viruses...

    Only bother with those if you trust the source and the torrent has received positive feedback (assuming you're using a search site).

    ffmpeg isn't a codec...

Join the discussion!