PUTTING IT ALL TOGETHER: CODECS - PART 2
Heath Firestone
Issue: November 1, 2007

PUTTING IT ALL TOGETHER: CODECS - PART 2

Last month, in Part 1 of this article, we discussed the basics of compression, including Long GOP vs. I-frame, and Discrete Cosine Transform (DCT) vs. wavelet compression. Now we will cover which common codecs use these forms of compression and how that ultimately affects quality and workflow.

DCT-BASED CODECS

MPEG-2 is the industry standard, being used in DVDs, a lot of digital broadcasts, HDV, Sony's XDCAM cameras, and is the basis behind a lot of the codecs in the market. It is a very good, very solid codec, though it is not optimized for lower data rates.

MPEG-2 comes in a lot of different varieties, and its Long GOP version may be the most widely-used codec in the industry.

MPEG-4 is a more efficient codec than MPEG-2, in terms of being able to provide higher quality at the same bit rate, especially at lower data rates, for which it is optimized. The primary drawbacks come from the additional processing required to encode and decode the files. Also, being in the early days of its release to the production world, many programs either don't yet support the codecs natively, or are still working out reasonable workflows.

Although there are many variants of the MPEG-4 format, the most popular and widely used version in the industry, is MPEG-4 Part 10, also known as H.264.

Panasonic's next-generation of professional cameras will be switchable between DVCProHD and AVC-Intra (I-frame version of H.264), initially at 50Mbps, and later at 100Mbps. The 100Mbps version has been said to provide near D5 quality compression.

Both Panasonic and Sony already have AVCHD (Long GOP version of H.264) consumer cameras on the market, using 6, 9 and 13Mbps data rates. Interestingly, these files, which are virtually identical to Blu-ray disc and HD DVD H.264 files, can be transcoded and burned directly from some DVD authoring applications that support the HD formats, without having to be re-encoded. There are claims that the 13Mbps version of AVCHD is comparable in quality to the 25Mbps HDV codec.

DV's codec is a limited resolution and frame rate, intraframe DCT-based standard definition codec. It is fixed at a 25Mbps data rate and supports 720x480 for NTSC and 720x576 for PAL. The Chroma Subsampling is 4:1:1 for NTSC and 4:2:0 for PAL. This is a good, basic codec, though it has limitations including having limited color sampling, which makes it a poor choice for compositing applications.

HDV uses MPEG-2 Long GOP, using the same tapes and runtimes as DV, but is a high definition format with resolutions of 1440x1080 and 960x720. It is the most widely used consumer and prosumer HD format, and produced the first non-professional high definition cameras to penetrate the market. HDV uses 4:2:0 chroma subsampling, and has a 25Mbps data rate for 1080i and 19.7Mbps date rate for 720p. The GOP structure also varies depending on frame rate, generally using a 15-frame GOP for 1080 60i/30p/24p, 12-frame GOP for 1080 50i/25p, as well as 720 50p/60p, and six-frame GOP for 720 24p/25p/30p. It has also been around long enough to have universal support in all major editing applications, though most programs convert the Long GOP files into an editable Intraframe format.

XDCAM HD (MPEG-2 Long GOP 35 & 50) is currently available in the 35Mbps variety (switchable to 18 and 25Mbps), with a 50Mbps version due out in the near future. Sony chose to stick with the older, but venerable MPEG-2 staple, but using Long GOP encoding. In many ways, this is quite similar to HDV, including having 1440x1080 resolution and 4:2:0 subsampling on the 35Mbps models, but with advantages of higher data rates, professional lenses and better CCDs. The 50Mbps versions however, will have 2/3-inch image sensors and 4:2:2 subsampling.

The advantages of being based on MPEG-2 is in the compatibility with existing programs, and that it doesn't require a great deal of processing power to encode or decode, though it does take more than its intraframe counterpart.

DVCProHD is Panasonic's 100Mbps HD codec based on its DVCPro codec, but scaled up to HD resolutions. Initially found on Panasonic's VariCam, it has also made its way into Panasonic's P2 cameras. The codec is 4:2:2, with resolutions ranging from 1280x1080 for 1080 60i, 960x720 for 720p, and 1440x1080 for 1080 50i. The codec has been around for many years and is one of the most widely used and supported HD codecs.

DNxHD is Avid's codec, designed to allow editing at HD resolutions with minimal generational loss without the required drive space and bandwidth needed for uncompressed HD editing. It is also designed to provide maximum performance by being a non-processor-intensive codec. It can be used as either a high-quality, visually-lossless alternative to uncompressed HD, or to allow for realtime mixed-format editing, where all formats would be converted to DNxHD. Ikegami's Editcam records to DNxHD at 145Mbps (the 1080 8-bit variant). Avid also offers a 1080 10-bit 220Mbps version, as well as a 36Mbps offline proxy version.

Apple incorporated its ProRes codec as a solution for providing near-uncompressed-quality HD video at data rates on par with uncompressed SD video. ProRes is similar to DNxHD in data rates, with standard quality (145Mbps 8-bit 4:2:2) and high quality (220Mbps 10-bit 4:2:2). Apple notes that ProRes differs in that it uses variable bite rate (VBR) encoding, allowing complex frames more bandwidth than simple frames.

WAVELET-BASED CODECS

MJPEG2000 is primarily being used in digital cinema applications, though it is likely we will see variants in the production world in the not too distant future. In the meantime, it is generally the codec most people associate with Wavelet technology.

RedCode is one of the first production applications of wavelet compression for use in acquisition. It uses a linear, 12-bit compression, driven in-camera by a realtime hardware engine. RedCode is a variable bit rate intraframe codec, initially slated to record 27MBps in RAW mode at 4K resolution, which translates to roughly 216Mbps, which will store around 4.75 minutes of footage on an 8GB compact Flash media card, or over two hours of footage on the RedDrive.

Working with Final Cut Pro, a future release will support editing natively in RedCode, though the software codec will require eight-core machines to handle a 2K virtual proxy (partial decode) edit. After the edit, RedCine will create a pull list to access the original 4K files, which will be used to do color correction and DI work, and then to output to the appropriate output format, whether this is standard 1080 24p, or uncompressed, full resolution image sequences.

CineForm developed the first widely used Wavelet codec for the post world, which was originally used as a way of converting the uneditable MPEG-2 IBP compressed HDV, into an editable I-frame video file. Although CineForm offered their feature rich Aspect HD plug-in for Adobe Premiere Pro, both Premiere Pro 1.5.1 and Sony Vegas 6 and 7 licensed the codec in order to handle HDV editing. While not used as an acquisition format itself, it converts 19.7-25Mbps IBP videos into variable 80-120Mbps wavelet based I-frame videos.

CineForm now offers several versions of their codec to handle higher quality full resolution HD footage at 10 bits, from 125-160Mbps, and their CineForm RAW, which handles resolutions as high as 4K, at data rates up to 280Mbps.

THE TRUTH

The world of production codecs is complex. There are a great deal of theoretical assumptions and variables, which effect different codecs in different ways. While some codecs clearly outshine their competition under certain circumstances at certain data rates, the differences in quality become more difficult to discern at the upper end of the scale as we near visually lossless quality.

While Long GOP has significant space savings with minimal loss in quality under most circumstances, it is also susceptible to artifacting when too much changes in the span of a few frames, and dropouts can end up affecting multiple frames instead of just one, since other frames may be referencing that frame. Wavelet codecs, on the other hand, avoid blocky artifacts found in DCT-based codecs, but instead lose definition along edges. And of course, the codecs which provide better quality compression at lower data rates do so at the expense of requiring considerably more processing power to code and decode.

COMPRESSION & RE-COMPRESSION

Although these codecs are approaching visually lossless, none of these codecs is actually lossless, as is the case with uncompressed footage. What this means is that, although we won't see the difference between a compressed image and one that is not, there are differences. These differences can be compounded over generations of re-compression, which can become noticeable. Fortunately most editing applications don't recompress footage unless they have to, instead referencing the original footage when creating a new video file, unless an effect is applied. Being digital, direct copies have no generational loss, so the only time there is generational loss is when a re-compression is applied.

THE THEORY

It is important to note that many of these codecs have yet to make their way into the production world, so doing direct comparisons isn't possible. Also, because of the basic nature of each of the codecs, certain codecs will have advantages in different circumstances, the reality of which will be determined through actual field trials. The good news is that codecs are getting better, processors are getting faster, and the images cameras are producing are more and more impressive. 

THE X FACTOR

While codecs have a direct impact on the look of the footage being compressed, doing direct comparisons of footage obtained by two cameras using different codecs is actually less definitive than it might seem because the image quality and properties are affected by a number of variables associated with each camera, including resolution, lens, image sensors, and internal pre-compression processing and settings.

FINAL THOUGHTS

The good news is that new cameras and codecs are providing increasingly impressive picture quality, with greater resolution, improved functionality and cross-platform compatibility, and are yielding amazing results, all while reducing the costs associated with entering the high definition production world.

Heath Firestone is a producer/director specializing in high definition production and advanced 3D compositing