It used to be so easy to start out movie making - you'd buy an 8mm or Super8 camera; or if you were really industrious, a 16mm camera and shoot and edit your movies.
In the 1980s, shooting and editing movies got only slightly more complicated with the introduction of VHS, VHS-C and Betamax. You could read a two page article and know the differences between competing video formats. When video went digital though, everything went out the window. Suddenly there was a bewildering array of video formats - .wmv, .asf, .rm, .mov, .mpeg, for compressing files, - and on top of that, many of these standards had their own substandards (MPEG-1, MPEG-2, etc.) How's anyone supposed to keep it straight?
Containers and Codecs
Possibly one of the most confusing things about digital video formats is the idea that there's a "container" and "codec" - You might think it's enough to make you yearn for the days when you could just put a tape in the camera and start recording, but you'd be wrong. The plethora of video formats mean that whatever type of video production you're doing, there's a good way to make it happen. Twenty years ago everybody was watching movies the same way - either on a screen via a projector, or on a television set. Today many, many more options exist and people are taking advantage of them all - from high-end HD video with surround sound shown in a top of the line home theater, to video streaming from a cellphone - video is everywhere and having a grasp of the various formats will ensure that your video gets where it needs to in the best way.
An Analogy
Trying to figure out exactly what containers and codecs are can be a little bewildering because it's a very technical subject. You can think of containers as a type of publication: a hardback book, a glossy magazine, a newspaper, a pamphlet, a gum wrapper - all of which can contain words and other things like photographs, or cartoons, and yet each one works in a different way. Think of the codec as the way of displaying the information you want in your publication. You can, for example, print War and Peace on Bazooka Joe bubble gum wrappers, but it will take thousands and thousands of them and nobody will want to read it that way; in the same way you can put your vacation footage on an uncompressed DV format, but you won't be able to stream it over the web. Similarly, you likely want your copy of War and Peace to be beautifully bound in hardback, but that's not the proper container for a takeout menu someone's going to shove in your mail slot. Words with drawings could properly be placed in a comic book, or a hardback book, or a newspaper, but the images in an art catalog or high-end fashion magazine require heavy-weight glossy paper to reproduce properly. Every video application has a proper codec and container. To add one more layer of complexity: both codecs and containers go in and out of style - so a format which was popular a few years ago, may be something few people are using today.
Usually, when video data is compressed some of it is lost. Video compression software works by looking for redundancies in a frame (such as one bit of blue sky next to another bit of blue sky) and representing the redundancies together. At very high rates of compression this becomes obvious, but at lower rates it's difficult for people to notice. There arises a desire in every movie maker to try to use lossless formats, which preserve all the original data, but the compression ratios aren't good enough (yet) to make them practical. Choices at the moment are to use the highest quality compression available for your intended purpose and to have multiple versions of your files for multiple uses (i.e. one file for web-streaming, another for disk-based distribution, another for standard definition DVD, another for Blu-ray, etc.).
Edit and Distribute in the Highest Quality
The highest quality video format is going to be the format you captured your video in. While digital files do not degrade in quality during copying, every time they are compressed with a "lossy" compression they lose data, so converting your uncompressed DV formatted files even into a high quality MP4 will result in a loss of quality. While it's necessary to compress files in order to be able to share them, you should avoid re-compressing any more than you have to. Keep your master files in the original format; edit, and create versions at whatever sizes necessary - but always from the originals. Don't burn a DVD from a file that's already been compressed into a low resolution file for streaming over the internet, instead create a separate, high resolution, file from your editing software. A lot of the work in deciding how to compress video files can be done by your video editing software. Most consumer editing software today will have presets for various methods of distribution the software's video compressor will use, such as DVD or even iPhone video, - your DVD burning software could automatically know which format to use in order to make a DVD that will play on home theaters.
Containers
We'll take a look at some containers and then at some codecs. A video's file extension usually refers to the container. A few containers have codecs that they almost always use and other containers are often used with many different codecs.
Audio Video Interleave (.avi)
Developed by Microsoft and released with Windows 3.1 way back when false teeth were still made out of wood, AVI files have been a work horse of digital video. Although its popularity has been waning, lots of legacy video in AVI can be found all over the web. More recently, AVI has been abandoned for Microsoft's WMV (Windows Media Video).
One of the most maddening things about AVI today is that the format doesn't allow for specifying an aspect ratio, so a 16:9 AVI video may start displaying at 4:3 - this is less of a problem if your player allows you to manually select aspect ratios. If you're watching in the non-pro version of QuickTime though, you'll have to learn to live with people being unusually narrow.
Advanced Systems Format (.asf)
ASF is a proprietary Microsoft container that usually houses files compressed with Microsoft's WMV codec - to make things confusing, the files are usually designated .wmv and not .asf. The ASF container has the advantage over many other formats that it is able to include DRM (Digital Rights Management), a form of copy protection.
QuickTime (.mov or .qt)
QuickTime was developed by Apple and supports a wide variety of codecs. It's a proprietary format though and Apple decides what it supports.
Advanced Video Coding, High Definition (AVCHD)
AVCHD is a very popular container for data compressed with the H.264 - it comes to us through a collaboration between Sony and Panasonic as a format for digital camcorders. It's a file based format, meaning that it's meant to be stored and played back on disks or other storage devices (such as compact flash drives or SD cards). It supports both standard definition and a variety of high definition variants from 720 to 1080p. The latest version (AVCHD 2.0) also supports 3D as well as some high frame rates.
Flash Video (.flv, .swf)
Flash was originally created by a company called Macromedia which was acquired by Adobe in 2005. Flash has been around for a while and comes in multiple versions, some better than others. Older Flash video often uses the Sorenson codec, newer Flash uses H.264. It's an extremely widespread container format used for streaming video across the web. Its major downside is that it will not play on iOS devices such as iPads or iPhones, a conscious decision made by Apple CEO Steve Jobs who famously called Flash "buggy" and blamed it for problems with the Apple Operating System. Jobs opted to skip Flash support in the belief that the HTML5 standardization of video display would solve streaming problems. (HTML5 and the way it handles video are beyond the scope of this article, but you can read about it here: http://www.w3schools.com/html/html5_video.asp
Codecs that are Also Containers
As if things aren't confusing enough, some containers have codecs with the same name.
MPEG-1
MPEG-1 is used almost exclusively for Video Compact Disks (VCD), which are extraordinarily popular in some parts of the world but never caught on in the U.S. - the video quality is substantially lower than DVDs.
MPEG-2 (H.262)
MPEG-2 is a container format, but there is also a codec of the same name, which most people call H.262, so that it's not so confusing. Though a world where we call something H.262 is already more confusing than it ought to be. MPEG-2 is used for DVDs and pretty much nothing else with the exception of broadcast High Definition Television (HDTV).
Codecs
Windows Media Video (.wmv)
Once it was realized that the Internet was a delivery vehicle for things like video, people started trying to come up with ways to share video that wouldn't take up a lot of bandwidth and disk space. One of the big advances was the idea of "streaming video" - where your computer downloads only a part of a video and begins to play while the download continues - this means you don't have to wait two hours for a movie to download before you can start watching. Over the years the WMV format has grown to include support for high definition 720 and 1080 video. To make things complicated, files that end in .wmv are usually stored in an .asf container.
H.264
Not only do you need to call the MPEG-2 compression codec H.262, you have to keep from confusing it with H.264, which is used to compress Blu-ray disks as well as lots of web video. One of the very nice things about H.264 is that you can use it at very low and very high bitrates. The H.264 will send highly compressed low resolution video across the web and then happily encode your high definition movie at super high bitrates for delivery to a High Definition television. This is a very common codec for camcorders and digital video cameras. Its container is AVCHD.
Switching Between Formats
It's possible to convert video from one format to another by using a video format converter such as the Kigo Video Converter, which is available for both Macintosh and Windows for $40. If you do transfer your old AVI files to more popular MP4 files, remember that re-compression causes degradation, so don't delete the originals, archive them somewhere.
What's the best video format?
While there isn't one "best video format", there are best video formats for particular jobs. Things to be aware of when choosing a video format, apart from the intended audience, (Will they be watching video streaming over the Internet? Do they have a fast connection? Do they have a DVD player? Do they have a Blu-ray player?), are the longevity of the format and how widespread it's adoption. Flash, for example, is a very popular video format and its distributor, Adobe, will probably be around for a while. On the other hand, at the moment Flash doesn't play on Apple's popular iPad or iPhone. Currently, a good bet for a forward-looking, high-quality, versatile video format is H.264, aka, MPEG-4/AVC (Advanced Video Coding), though it really needs a better name. H.264 is supported by a number of important players including Microsoft, Apple and Adobe, though in early 2011 Google dropped support for H.264 from its Chrome browser citing the desire to use only open-source (i.e. non-patented, royalty free) standards.