In the February 2010 issue of Videomaker, we featured an article asking, What is a CODEC? Due to the subject's complexity the piece was only able to scratch the surface of a subject that to many, is a vast well of technical mumbo-jumbo. This article presents a codec "state of the union" as it were, a revisit of some of the basics as we dig just a bit deeper into this ever-growing topic. We'll explore the variety of codecs available within two distinct families, Apple ProRes and the MPEG family. We'll also look at effective media management through the use of these codecs, and more. Just know that this is a subject on which volumes can, have been and should be written. This article is simply meant to whet your appetite and answer some of those pesky questions you often have regarding which codec is right for you. However, before we get into the details, let's revisit the definition of a codec.
What It Is
The word codec is really the combination of two words: coder and decoder which, by the way, is exactly what they're designed to do. Codecs simply encode and compress streams of data for storage or decompress streams of data for playback or editing. Because digital video represents a huge amount of data, codecs are an essential component of the modern day process of video production, yet they're something that many of the most seasoned pros know little about. Let us shed a bit of light on the current state of codecs and how you can maximize their potential in your future productions.
Getting From There to Here
Digital video begins its life in the form of a codec. You've probably heard the term "native" which is used to describe the format that your camera records to and stores the digital data. Sometimes however, the "native" compression is not optimal for editing, usually because the data is just too large or clunky for your computer to process at speeds necessary for a fluid workflow. Therefore, your media needs to be transcoded or compressed into a lower bit rate or one that conforms to your end user's viewing and listening needs. Bit rate refers to the number of bits of information that are processed during a specific unit of time. In video that unit of time is always determined in seconds, i.e. bps (bits per second) or Mb/s (megabits per second).
When you compress a file for later use you do so using lossless data compression or lossy data compression. Lossless data compression means that you are reducing the size of the file by replacing a recurrent sequence of data with a symbol. Doing so means you can decompress that same file and restore it to its original state without the loss of the file's information or overall quality.
Lossy data compression permanently takes away some data, allowing the file to be reduced in size and unfortunately, quality. Think of a "pixilated" photo or a blocky video. That is "lossy" data compression and it does not allow for decompression. It's a bit like squeezing toothpaste from a tube, you can't put it back.
Now there are all sorts of applications available to compress your video and audio data for future use. Almost all editing software comes complete with compression tools enabling you to test out a variety of codecs. There are also a ton of tools available for download but most of them come at a cost. However, one popular transcoding tool that has gained in popularity and is offered for free is a tool called MPEG Streamclip from Squared 5 srl. This is a robust tool with a seemingly endless menu of settings for transcoding your data. MPEG Streamclip, by virtue of its price alone, is a great tool for testing various compression settings and seeing which ones work best for you, your devices and your end users.
The Most Common Codecs
While the list of usable codecs is about as long as your arm, there are codecs that can be categorized as "most commonly used" among professionals and hobbyists alike. The following list outlines a couple of those codec families and some information detailing the specific applications of each.ProRes Codecs
When Apple decided to dive into the world of video and film post-production they developed a unique Apple umbrella codec with five different versions to suit almost any editor's specific needs.
- Apple ProRes 4444 - For those wanting full resolution color mastering in RGBA (Red, Green, Blue, Alpha), the ProRes 4444 is a fantastic codec. ProRes 4444 slightly compresses the color channels but the difference is almost indistinguishable. This is also a great codec if you're working with alpha channels since it supports everything from SD to 4K resolution.
- ProRes 422 (HQ) and ProRes 422 - Both of these codecs work well with 1920x1080 60i video and handle a 4:2:2 or 4:2:0 color space respectively (no alpha channel) without difficulty. The major difference between the two is that (HQ) has a target data rate of close to 220 Mbps while regular ProRes 422 can only handle as much as 145 Mbps.
- ProRes 422 (LT) and ProRes 422 (Proxy) - If you're wanting to view video using the original acquisition frame rate, aspect ratio and frame size - (LT) and (Proxy) are suitable choices. The major difference between the two is in their data rate. Using ProRes 422 as the standard, (LT) is about 70 percent of the 422 data rate while (Proxy) is around 30 percent and geared for offline workflows. These compressions result in smaller file sizes and are considered good for work-in-progress files. Most Final Cut Pro editors utilize the ProRes 422 (HQ) and the ProRes 422 because they're still able to maintain decent resolution and the 4:2:2 color space is actually closer to what the human eye is able to register. Therefore, the difference between 4:4:4 and 4:2:2 , while technically large, is not so prominent with respect to how we see color.
The MPEG Family:
In that What is a CODEC? feature, we reviewed several compression schematics from the MPEG family, MPEG-1, MPEG-2, MPEG-4 or H.264 and so on. Each one is different and each has its own advantages and disadvantages. So, how do you know when to use which one - and why?
- MPEG-1 is a codec that is accepted across a variety of distribution channels, meaning, it is compatible with most hardware-based and software media players. Because it has a low bit rate compressing with MPEG-1 allows you to fill several hours of media on a DVD at fairly high quality.
- MPEG-2 is a full-frame compression at 720x480 - NTSC and 720x576 - PAL. It is a popular compression standard for DVD distribution rather than streaming via the Internet since it requires a high bit rate to maintain picture quality (somewhere between two and nine Mb/s). Many encoders will allow you to adjust the bit rate to accommodate the amount of media you want to store or play on a DVD. For instance, if you're working with a 4.7GB DVD, an average bit rate of 3.5Mb/s would allow for close to 120 minutes of space whereas a higher bit rate of say, 6Mb/s would allow for around 80 minutes of play time.
- MPEG-4, also known as H.264 is a continually developing codec, especially with the advent of MPEG-4 Part 10 which provides four times the frame size at a given data rate as does MPEG-4 Part 2 which has blossomed in the world of Internet viewing. Because it uses a one-pass variable bit rate (VBR), MPEG-4 maximizes output for mobile devices such as laptops, smartphones and more.
Want to know more?
As stated near the beginning of this article, this is a topic on which volumes of information has been and will be written. There is so much to digest, understand, and explore that we can once again only scratch the surface. No matter which codec you're using, we urge you to take time to test the ones that work best for your most common applications. Just like with anything in life, the more you explore, the more you practice, the more you utilize compression tools in your video, the more familiar you will become with their individual design and intent.
Sidebar: Calculate File Size
At first, attempting to calculate a compressed file size is a bit like asking you to look into a crystal ball. But rest assured - there's a formula for determining just how many bits or bytes your compression will be. You can calculate using either bits or bytes.
Here's just a bit of information to refresh your memory:
- Megabits processed per second may be written as Mb/s.
- kb/s is the abbreviation for kilobits per second
- There are eight bits (b) in a byte (B).
- There are 1,000 kilobytes in a megabyte, and a kilobyte is 1,000 bytes, so a megabyte is 1,000,000 bytes.
As for how to calculate length of a compressed file you can employ the following formula:
For bytes, employ this formula:
x = length of media (seconds)
y = bitrate (kilobits per second) x 8
z = resultant file size (kilobytes)
(x * y) / 8 = z
*NOTE: You divide the multiplied result of x times y by 8 since there are 8 bits in a byte.
Now, like all good adopters of the digital age, if you don't feel like doing the math - use a calculator! You can calculate your file sizes by using a tool from Digital Rebellion, the video space calculator. It's a simple but extremely helpful tool.
Chuck Peters is a 3-time Emmy award-winning writer and producer. He is currently VP of Production at KIDMO/Rivet Productions.