www.dpreview.com
www.dpreview.com

Video compression, codecs and transcoding

Uwe Steinmueller | Video Capture | Published Aug 31, 2011

Video compression: your friend and enemy

Video compression is clearly our friend because without a lot of compression we would have a very hard time handling the massive data we get from a 1080p video stream. Think of two mega pixels per frame at 24, 30 or 60 frames per second (translates to 48, 60 or even 120 mega pixels data per second). On the flip side, video compression reduces the possible image quality we can get. It is good to better understand how we deal with the implications of compressed data. It is kind of like the difference between Raw and JPEG images for still cameras, though with video the compression is a lot stronger. That said, it's important to consider that when we watch a movie, the moving image is rarely analyzed as critically as still images

Overall video compression is about the trade-off between:

Video Compression Details

Because the data is digital some non-destructive algorithms are also used, but we don't need to worry about them because they have no influence on the image quality.

Here are the different techniques commonly used to get the video stream down to a manageable data volume:

GOP compression structure shoowing one I and two P frames per group of pictures.

Here is the catch:

Longer GOP structures (e.g. 15 long) are more efficient but can be also more problematic because the full I-frames many frames apart.

GOP sequences are very powerful to reduce data but also may show limitations for some fast action. Overall the results are quite impressive. Think that your Blu-ray disks use the same basic methods but also use much more sophisticated encoding software then the camera's real-time encoders.

Video Codecs

Codecs are software that enable your devices (Camera, Editor, Player) to perform video encoding and/or decoding (think video compression and de-compression). Obviously your Blu-ray player needs only to decode a video stream. All these Codecs are based on standards (often de-facto company standards).

All video streams are embedded in multimedia (video) containers. It is a common misconception that .AVI (Windows) and .MOV (Quicktime on Macs) already define what kind of video format it is. These containers include information which Codec is used in the file. If your system does not have the proper Codec installed the movie won't play.

H.264

H.264 is one of the most important HD Codecs used today. H.264 is part of the MPEG-4 AVC standard. H.264 is used on:

Video Codecs used during the Video Production Workflow

There are mainly three steps during the production of video:

Codecs used during Video Capture

We want to use a codec that captures the highest quality possible balanced with the data volume our cameras can handle. Here are some codecs used in HDSLRs and pro video cameras.

MJPEG

Simple Codec that is not very efficient in terms of a good balance of size and quality (non GOP Codec).

MPEG-4 AVC/ H.264

H.264 uses a GOP encoding method. This is not really a top recording format. The proper domains for H.264 are the output and player devices. This said H.264 is quite a usable compromise for getting reasonable quality in relative small files. Canon HDSLRs use this codec in a .MOV container.

AVCHD

Also a GOP based Codec. Used by Panasonic GH1/2, GF1, AF-100, TM700 and also the Sony NEX-5 and VG10. It is very important to check the bit rates used. The GH1 uses by default 17 Mbit/s and this leads to artifacts called 'Mud' (severe loss of detail in low contrast areas). Going up to 24 Mbit/s already improves the quality (used in VG10, GH2 and AF100).

Actually AVCHD (standard by Sony/Pansonic and also used on some consumer video cameras by Canon) at it's core uses the same H.264 Codec. The main difference is the packaging (container) of the data.

AVCHD Structure on card/disk

AVCHD is a format created for consumer camcorders. The structure actually mimics the basic structure of Blu-ray. Some TV sets and Blu-ray players can play these clips directly from the SD-Cards. For editing only the .MTS files in the STREAM folder are needed. They actually contain a H.264 video stream (some tools like ClipWrap on Macs can re-wrap these streams to .MOV without changing any data).

On Windows the MTS files are supported natively with the Windows Media Player. On Macs Quicktime does not render MTS videos. Best to use a program like VLC (free) or Toast 10 Titanium (commercial product) to play MTS clips on Macs.

Professional Recording Codecs

Codecs used during Video Editing

During the editing process you want to preserve the data quality. Any quality lost during recording cannot be rescued but the data you got should not be degraded even more. GOP compression Codecs are not ideal for video editing although some editors seem to work fine with them. It is much better to use non GOP Codecs like the Apple ProRes Codec family for editing. We always transcode (read below) our clips from GOP Codecs to high quality non-GOP versions like Apple ProRes. This results in a much better handling of the video during editing but also adds an extra step in our workflow.

Transcoding

Transcoding is the process of converting a video stream from one Codec to a different one or just to downsample the video. Transcoding to a lower quality (higher compressed Codec) should only be done as the last step to target your output device (Internet or Blu-ray). Editing in 720p is often easier on your computer system than using full 1080p. Even if we edit at 720p we still always shoot full 1080p footage because this shows lower artifacts (like moire and aliasing) and also allows us to use full 1080p if needed.

If we record using H.264 or AVCHD in our cameras we transcode the footage to 720p Apple ProRes. This way we have a way smother editing process than using H.264 directly. We only convert part of our footage that we intend to use for editing because the file sizes get quite a bit bigger.

Tools we use for transcoding:

Video Codecs for output devices

For the final rendering of your video for your target devices the H.264 compression Codec often will be used for both the Internet and Blu-ray.

Conclusion

In video compression there is no free lunch and you have to pick your poison. Overall the solutions available work very well and not everybody works in Hollywood. We follow the following workflow in our personal work:

Further learning

This is an edited and updated version of an article first published on Digital Outback Photo. You can read the original article here, or check out the 220 page ebook (currently on offer at $19.95) 'Mastering HD Video with your DSLR' by by Uwe Steinmueller & Helmut Kraus here.

© 2010, www.dpreview.com & Uwe Steinmueller.