When you're working with computers all day, you'll quickly start to realize they are prone to problems. Artists working in a digital world have to balance their creative side with a technical know-how to overcome when things go wrong. With today's media-driven technologies, just about every type of digital artist will need to work with or handle video files at some point. While the concept of video playback may seem simple, understanding how computers handle videos is the first step to knowing how you can fix them when things go wrong. And sooner or later things will go wrong.
Containers and Codecs
All video files are made up of two key components: A container and a codec. Of these, the container is the most visible to you on a computer because it's identified by its extension. For example, a file with an .mov file extension is a video file that has the QuickTime container extension.
What's not so readily visible is the codec. A codec is the driver for how the container format is decoded by the program. There may be hundreds of codecs that are available for each container type and without the correct codecs installed on your computer, it won't know how to open the video file properly.
To get a better idea of how containers and codecs work together, let's look at a metaphor in the real world. A simple tin can have any number of things inside of it. It is, very literally, a versatile container that could hold anything from food, oil, paint or even compressed gasses. The label on the outside is how you know what its contents are and, by extension, what type of container it is. Depending on the type of container is probably going to determine how you'll open the can. For example, you probably won't try to pry open a can containing compressed gasses in the same way you would a can that contains food.
Just knowing what's inside isn't quite good enough. You'll need to know what to do with the contents. For this, many tin cans have some simple directions for what to do with its contents printed directly on the label. It could be anything from instructions on how to open the can to a recipe for the contents once you have it open.
This is essentially how a computer handles video files. The file extension is a label that tells the computer what container type the video file is. By knowing the container type, the computer knows how it needs to open the file. For instance, an .mov file might open in QuickTime's native player whereas an .avi file could open in Windows Media Player.
But just like knowing the container type for the tin can isn't enough in the real world, a computer needs more than just knowing what type of container a video file is. That's where the codec comes in. The codec is basically the directions for how to play the video once it's opened.
Identifying Containers and Codecs
The easiest way to identify the container format for any given video file is to show the file extension on your computer. Once you've done that, the file extension will tell you what the container type is.
As mentioned previously, codecs aren't as easy to see. In most cases, you'll want to go to the properties of the video file in your video player. The exact steps are going to vary depending on your player. For the sake of this example, we'll use the VideoLAN Client (VLC) player because it can let you see codecs and works on a wide range of operating systems. With VLC, once you open the video file you can go to Tools > Codec Information to see what codec was used for the video.
Common Container Formats and Their Codecs
The biggest things that will go into picking your container format are going to be the operating system you're on, the codecs you want to use (since some codecs only work with specific containers) and, of course, the final delivery method where you want to the video to be played.
The .mov file format is the native format for QuickTime. Because of this, it's very popular in and can be seen coming mostly from an Apple environment. To playback an .mov file outside of an Apple device, it's a great idea to have the free QuickTime player installed. Because it is a proprietary format developed by Apple, some of Apple's products can take advantage of features that aren't available elsewhere. For example, when exporting out of Final Cut Pro to an .mov file format you can embed things like subtitles or chapter marks directly into the file.
While QuickTime .mov files can support uncompressed files, they are more commonly seen using either a light compression like the Animation codec to take advantage of alpha directly in the video or using an MP4 codec like H.264 for great quality preview renders at a lower file size.
Of course there is a Windows alternative to the Apple environment format. That alternative is the .avi container format which, as you could probably guess, was developed by Microsoft and is most prevalent in the Microsoft environment. While an .avi file can be rendered uncompressed, you'll find the uncompressed .avi files tend to be bloated. This makes them way too large for sharing. However, these large files can be great for editing inside of a tool like Premiere Pro.
An .avi file is a container format with arguably the widest range of codecs that can be used with it. Because of this, if you ever have difficulty playing back an .avi file it's a good idea to check the codec that was used and make sure you have that codec installed on your system.
When you think of MPEG, your mind probably jumps straight to .mp3 files. Actually, the common music format .mp3 are just one of the container formats that fall under the umbrella of MPEG (Moving Picture Experts Group) formats. While you could spend countless hours learning about the various MPEG formats, the most common container formats specified by MPEG you'll probably come into contact with when working with video are .mpeg (or just .mpg) and .mp4, the latter of which we'll talk about in more detail next.
The most common use for .mpeg files is on either DVDs or Blu-Rays. Because they are a lossy format, meaning they lose data when rendered, it's never a good idea to have your original source videos be .mpeg files. Instead, only use .mpeg files when your final format is going to be either a DVD or Blu-Ray. Keep in mind that depending on its use, there are multiple file extensions that an .mpeg file could show up as. For example, an .m2v file would be the video compression found on a DVD (an .m2a file is, as you probably could guess, the audio compression for a DVD) whereas an .m2ts file is the container format for a Blu-Ray.
Although we've already taken a look at the MPEG format, it's worth pointing out the .mp4 container format separately. With the recent onslaught of mobile devices, there has been a growing number of mobile devices that need to be able to play video. That compounded with the decision by Adobe to stop Flash development for mobile devices has really pushed everyone into the same direction for video on the web. That direction is .mp4 with an H.264 codec.
An .mp4 container format can be played back within a Flash video player or with the HTML5 video specification on a wide range of desktop and mobile devices. This configuration of .mp4 with H.264 is actually the recommended format for most video content delivery sites such as YouTube and is also what we use here at Digital-Tutors to stream to mobile devices.
The most common issue you'll come across when working with video files will come from not having the proper codec(s) installed. As previously mentioned, it's vital for a computer to have the correct codec installed so it knows what to do with the video file once it's opened. For example, if you were to try playing back an .avi file you know has both audio and video but only the audio plays, the chances are good the proper codec isn't installed.
Most codecs can be downloaded for free on the web, for example through a codec pack, but unfortunately many of them come from less-than-reputable sites, so always exercise caution whenever downloading codec packages.
Finding the Format That's Right for You
There is no magic one-size-fits all format that will work in every situation. There are just way too many ways that videos can be played back these days to be able to have that sort of easy solution. However most of these various playback methods will have some sort of standard put in place that you should adhere to. Since video formats are primarily used for final delivery, when it comes to video formats the key to finding what's right for your project is often found in knowing how your video will be delivered.
Before rendering out your final videos, take the time to research what the standards that are used for the methods that your videos will be played back. For example, if you're going to be delivering the video to the web then the combination of MP4 and H.264 will be the best way to go. Do you have a preferred combination for container formats and codecs? Let us know in the comments below.