Digital Video Formats

    ...Akkana Peck

Introduction and Disclaimer

I am not an expert in video formats.  I wrote this page because I was having trouble getting the information, and couldn't find any good explanations of video formats on the web.  The information here is gleaned from reading pages I found via google searches (references to some of the useful sites I found are given at the bottom).

This page is severely out of date. Most of it dates back to December, 2004. Mpeg4, in particular, has changed a lot since then and those changes aren't reflected here.

This is a work in progress.  If you find errors, please let me know.

What's a Video Format?

Video formats are confusing because most video files have at least two different types: the container, and the codec(s) used inside that container.

The container describes the structure of the file: where the various pieces are stored, how they are interleaved, and which codecs are used by which pieces.  It may specify an audio codec as well as video.

A codec ("coder/decoder") is a way of encoding audio or video into a stream of bytes.

To make life even more confusing, some names, such as "mpeg-4", describe both a codec and a container, so it's not always clear from context which is being used.  You could have a movie encoded with an mpeg-4 codec inside an avi container, for example, or a movie encoded with the Sorenson codec inside an mpeg-4 container.

The Linux file program is a fast way to find out the container format of a video file.

You can use the mencoder program (part of mplayer) to tell you the container and video codec of a file (you'll have to wade through a lot of other output).

For mpeg files, you can find out the audio codec with mpginfo, part of the mpgtx package.  For other formats, try
mplayer -identify -frames 0 filename | grep ID_

Common Container Formats:

AVI (.avi): Most commonly contains M-JPEG (especially from digital cameras?) or DivX (for whole movies), but can contain nearly any format (not Sorenson).  Sometimes you'll see a reference to the "fourcc": this is a four-character code (such as "divx" or "mjpg") inside the AVI container which specifies which video codec is being used.

Quicktime: Most often used for the locked Apple Sorenson codec, or for Cinepak (free), but can also hold other codecs such as mjpeg, etc.

WMV (.wmv): More or less MPEG4; can contain nearly any codec, including several Microsoft spinoffs of MPEG-4 which vary in their freedom and licensing requirements.

ASF ("Advanced Streaming Format", .asf): a subset of wmv, intended primarily for streaming: an early Microsoft implementation of an MPEG4 codec.

Common Codecs:

MPEG ("Moving Pictures Expert Group"): three video formats, MPEG 1, 2, and 4.
MPEG-1: Old, supported by everything (at least up to 352x240), reasonably efficient.  A good format for the web.
MPEG-2: A souped-up version of MPEG-1, with better compression.  720x480.  Used in HDTV, DVD, and SVCD.
MPEG-4: A family of codecs, some of which are open, others Microsoft proprietary.
MPEG spinoffs: mp3 (for music) and VideoCD.

MJPEG ("Motion JPEG"): A codec consisting of a stream of JPEG images.  Common in video from digital cameras, and a reasonable format for editing videos, but it doesn't compress well, so it's not good for web distribution.

DV ("Digital Video"): Usually used for video grabbed via firewire off a video camera.  Fixed at 720x480 @ 29.97FPS, or 720x576 @ 25 FPS.  Not very highly compressed.

WMV ("Windows Media Video"): A collection of Microsoft proprietary video codecs.  Since version 7, it has used a special version of MPEG4.

RM ("Real Media"): a closed codec developed by Real Networks for streaming video and audio.  Maybe also a container?

DivX: in early versions, essentially an ASF (incomplete early MPEG-4) codec inside an AVI container; DivX 4 and later are a more full MPEG-4 codec..  No resolution limit.  Requires more horsepower to play than mpeg1, but less than mpeg2.  Hard to find mac and windows players.

Sorenson 3: Apple's proprietary codec, commonly used for distributing movie trailers (inside a quicktime container).

Quicktime 6: Apple's implementation of an MPEG4 codec.

RP9: a very efficient streaming proprietary codec from Real (not MPEG4).

WMV9: a proprietary, non-MPEG4 codec from Microsoft.

Ogg Theora: A relatively new open format from Xiph.org.

Dirac: A very new open format under development by the BBC.

There are many others; this document does not attempt to list them all.

References

Advanced Video Compression - Part 1 and Part 2.  A most excellent overview.
Codec/Container Table -- The page is partly in French, but the table is in English.
Linux A/V (Co)Decs -- says it's out of date, but a useful table nontheless, showing containers, codecs, and players which support them.
FAQ of AVI MPEG Video Converter
FourCC list of video codecs

Still Image Formats for the Web
Linux Information
Shallow Sky Home
Contact Akkana