Determine Which Codec to Use





Determine Which Codec to Use

Knowing how you plan to use or distribute your video will help determine which codec you should use.

When talking about digital video, you need to be clear whether you are talking about the DV format or digital video in general. Digital video covers a wide range of technologies, including DVDs, cell phones that can record and play video, streaming video on the Internet, and even television broadcasts via satellite and cable. Every form of digital video requires the use of a codec.

More often than not, when talking about editing digital video, the conversation is about DV. The DV format generally includes DVCAM. It does not include DVD.


Understanding Codecs

A codec is a compression/decompression algorithm that helps reduce the amount of storage, and computer horsepower, required to reasonably use video on a computer. Since uncompressed video takes up a lot of disk space and requires a lot of computer power, codecs have been created to help play video on a range of devices. Basically, a codec enables a device such as a computer or DVD player to play audio/video content. There are hundreds, if not thousands, of audio/video codecs available.

To overcome some of the frustration created by competing codecs, the number of codecs, and the fact that some hardware/software works with one codec and not another, various groups have attempted to create standards. Many of the standard codecs are also associated with video formats (sometimes called containers). For example, DV is both a codec and a format.

Some of the standards have been successful, primarily those set by the Moving Pictures Expert Group (MPEG). For example, the DVD movies you rent and purchase are encoded with the MPEG-2 standard, which is published by MPEG. The official MPEG website is located at http://www.chiariglione.org/mpeg/.

Can you imagine if each movie studio used a different codec for their DVDs? You might have five different DVD players in your house! Standards are a good thing for both producers and consumers.


Codecs are a vital part of delivering digital video. Every codec is targeted at a certain use, although some target multiple uses. For example, Avid editing systems have their own codec and are targeted to editing only on an Avid system.

Figure provides a compact list of the more common codecs and their typical uses, as well as their typically associated file format extensions.

Table Common codecs, their recommended use, and file extensions

Codec

Used for

File format extension

MPEG-1

video CD

.mpg, .mpv, .m1v

MPEG-2

HDV; DVD; professional acquisition

.mpg, .mpv, .m2v

MPEG-4

Internet streaming and download; consumer acquisition; computer playback

.mpg, .mp4

DV

Professional and consumer acquisition and editing; tape playback

.dv

3GPP/3GPP2

Cellular phone playback

.3gp/.3g2

H.264 (a.k.a. AVC, MPEG-4 Part10)

Playback of Standard and High-Definition video via Internet; HD-DVD; satellite distribution

.mp4, .264

VC-1

Playback of Standard and High-Definition video via Internet; HD-DVD; satellite distribution

Undertermined at the time of this writing


Knowing where your video will be seen will help determine the codec you should use. According to Figure, if you plan on delivering a video to a cell phone, you should use the 3GPP codec. While a 3GPP encoded movie might play on a computer, the quality of the image will be much lower than an MPEG-4 encoded video, which is targeted at such playback.Figure shows the resulting files sizes, and Figure shows a variety of codecs set side by side and

Images in print versus those on a television or computer appear differently and much smaller. The images presented here are for reference only.


Table Resulting file size for 20-second video clip

Codec

File size

DV

63.3 MB

MPEG-1

2.4 MB

MPEG-2

8.2 MB

MPEG-4

2.8 MB

3GPP

172 KB


Unfortunately, some questions start to arise when you plan on delivering to a computer. Whether via streaming video, Internet download, or CD-ROM, there are many applications available to play back video content. Many of them use proprietary codecs and most are not compatible each other. The major playback applications are QuickTime, Windows Media, and Real One.

DV and MPEG codecs, side by side


Understanding the Major Video Players

QuickTime Player, Windows Media Player, and Real One Player are all applications that use codecs to play audio and video content and they are all available for both Macintosh and Windows computers. Each one has its benefits and drawbacks. Real is the only one that is available and supported on Linux.

The majority of the time, the videos that these applications are able play aren't compatible with each other (what else is new?). If one of these applications tries to open a video file that has been encoded for another player, the video file most likely won't open. This detail can be frustrating both as a consumer and as a producer. Figure shows the major media players, and the common file extensions.

Table Major playback applications and their common file extensions

Playback application

Common file extension

QuickTime Player

.mov, .qt

Windows Media Player

.wmv, .asf

Real One Player

.rm, .ram


Much of this can become confusing, frustrating, and annoying, even if you've been immersed in digital video for years. To make it even more complicated, the landscape is continually changing. Fortunately, it is somewhat difficult to get yourself stuck, because you can usually convert one format and/or codec of video to another by transcoding [Hack #29], should you need to do so.

QuickTime.

If you plan on using the more robust capabilities of the QuickTime architecture, such as interactive sprites [Hack #72], you will be required to deliver a QuickTime format file and your viewers will have to use the QuickTime player to view it. The QuickTime format offers a lot of different codecs out of the box, and many third-party vendors have added their own as well. You can download QuickTime at http://www.apple.com/quicktime/download/.

Some of the more prominent codecs include Sorenson (good for Internet video), Pixlet (good for high-quality video), and Photo-JPEG (good for low-resolution editing). If you choose a codec that is obtained from a third party, such as On2's VP3 (http://www.vp3.com/vp3/quicktime/index.shtml; free, open source), your viewers will be required to download and install it as well. For the most part, QuickTime will handle this detail for them.

QuickTime is installed along with the iTunes music application. If your viewers have installed iTunes, they have also installed QuickTime by default. There is also an undisputed rumor that iTunes uses QuickTime to create the interface to the iTunes Music Store (see comments at http://weblogs.mozillazine.org/hyatt/archives/2004_06.html).


QuickTime is an interesting beast, because it encompasses much more than audio/video creation and playback. Although the majority of people think of QuickTime as a media player only, it can be used it to create 3D scenes, truly interactive movies, and even utilities such as calculators. It is a robust technology with a vast and deep assortment of capabilities, which seem to be a hidden secret inside Apple.

Windows Media.

Windows Media is the default media format for computers running Microsoft Windows. The format (now in Version 1.0) has improved exponentially since Version 7. It is also the basis for the VC-1 codec used in Internet, DVD, Standard and High-Definition, and satellite distribution of video. You can download Windows Media Player from Microsoft at http://www.microsoft.com/windows/windowsmedia/default.aspx.

The focus for Windows Media has been on audiovisual content and it is noticeable in the quality of the video it produces. Due to its focus, Windows Media does not offer much in the way of interactivity features, although it does offer chapter tracks [Hack #49] and the ability to open URLs [Hack #84]. If you plan on delivering to a majority of Windows viewers, Windows Media is a safe bet.

Real.

Real was a golden child during the Internet boom of the late 1990s. Since then, it has begun to take a back seat to both QuickTime and Windows Media. Part of the slide might be attributable to the former cost of delivering Real-based content. However, if you plan on delivering to the widest possible audience, including Linux users, Real is the format of choice.

In mid 2002, Real announced it was going to give away the source code to its server, codec, and player products. The project is called Helix (http://www.helixcommunity.org)and at the time of this writing, has almost 75,000 registered users. Helix is able to handle both Real video and QuickTime video.


You can download Real One Player from http://www.real.com.

Choosing a Codec

So, what in the world should you do? If you are planning to distribute your movie on a DVD [Hack #79], you don't need to look much further than the MPEG-2 codec and a program to burn your movie to disk. But if you plan on delivering via the Internet, whether streaming or for download, your choice becomes more difficult.

As a ground rule, you should stick to standards when possible. For example, use MPEG-4 for videos you are going to distribute online. MPEG-4 videos should be playable on all of the players.

Here are a few questions to help narrow your selection:

  • Do you have access to a streaming server?

  • If so, which formats does it support?

  • Do you have an interactive element within your movie?

  • Are all of your viewers using a specific platform?

Answering these questions should yield some insight to your requirements. If your viewers are using Macintosh, choose QuickTime. If they are using Windows, choose Windows Media. If you don't know, try both and see which one you prefer. For example, look at which provides a better image. Or ask yourself, which is easier for you to produce and distribute?

Using an Alternative

There are a few alternatives to the mainstream players and codecs. Although the alternatives muddy the landscape even more, they also provide viable options. If your viewers are willing to download a new player and a new codec, these alternatives are good choices for online video distribution.

The players.

The two video players gaining the most momentum are VLC (http://www.videolan.org/vlc/; free, open source) and MPlayer (http://www.mplayerhq.hu/ free, open source). Both VLC and MPlayer are the equivalent of a video Swiss Army knife, because they seem to open a majority of video files available on the Internet. They are also able to play DVDs and accept streaming video. VLC is available for Macintosh, Windows, and Linux. MPlayer is available for Macintosh and Linux.

The codecs.

Three codecs gaining the most momentum are DivX (http://www.divx.com; free), XviD (http://www.xvid.org; free, open source), and 3ivx (http:/ /www.3ivx.com; $6.95–$19.95).

All three codecs provide excellent quality video for the bandwidth they require, and all are variations of the MPEG-4 standard. They are all available on Macintosh, Windows, and Linux. The major difference between the three is the fact that DivX and 3ivx are much easier to approach from a user's standpoint, as their installation is uncomplicated.

In the end, your choice is just that: a choice. It is personal and your viewers will either find a way to play your content, especially if it is compelling and entertaining, or they won't. If you want to cater to the widest possible audience, keep it simple and use internationally agreed upon standards, such as those published by the Moving Pictures Expert Group (MPEG), the Society of Motion Picture and Television Engineers (SMPTE), and the International Organization for Standardization (ISO).


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows