Eight Things You Need to Know About Video Compression
Corrections: edits, updates, and corrections May 2012. Oh, and looks like there are NINE things.
Addenda
JPEG2000 supports lossless compression (at maximum quality) and supports alpha-channels ("Millions+"). In general it offers superior bandwidth to PNG but at a considerable cost in CPU load. If it were hardware accelerated it might be well worth using.
It's also worth noting that RAW / HDR video is now entering the mainstream. The Nikon D800 ($3000) outputs uncompressed video, and the new Blackmagic Cinema Camera ($5000) shoots RAW video (12-bits per channel). (The Blackmagic camera literally uses SSD drives as its "film".)
QuickTime appears not to support TIFF as a codec option for video, so use PNG (it's better anyway, generally producing smaller files even than TIFF with lzw compression). Note that TIFF does support 16-bit per channel images though (but then so does Targa).
Corrections: edits, updates, and corrections May 2012. Oh, and looks like there are NINE things.
- A codec (compressor/decompressor) determines how a sequence is compressed. A file format is a separate thing (just like you can insert a JPEG into different word processor files). MOV, WMV, FLV, MP4 are file formats. MJPEG, MPEG2, Sorenson, H264 are codecs. QuickTime allows you to use some file formats as codecs for videos (e.g. PNG, TIFF, JPEG). In general, Windows Media Player can read MOVs and QuickTime can read WMVs, but they have a different set of codecs. Neither can read FLVs, and Flash can't read MOVs or WMVs.
- Some codecs are designed for delivery to end-users and not for editing or compositing. These codecs tend to be significantly lossy, especially in terms of dynamic range, introduce artifacts into the image, and are difficult to "scrub" (they're designed to be viewed forwards at normal speed). You should only use them for final delivery, not for creating files for use in a production pipeline (e.g. by a video editor). This includes pretty much any codec associated with MPEG (which, confusingly, is used to refer to both file formats and codecs), Sorenson, H264 (which is an MPEG4 codec), and Cinepak.
- Most codecs are lossy, i.e. they remove information to save space. JPEG (a still picture codec) and H264 (a video codec) are both lossy.
- Many codecs use inter-frame ("temporal") compression, i.e. they store frames as deltas relative to a past or future keyframe. Such codecs tend to be best used for final delivery, since they do not allow lossless editing. The reason many video cameras use MJPEG is that while it uses more space than AVCHD or H264, it does not use temporal compression, so you can delete a series of frames without affecting the frames you keep.
- Some codecs are lossless, i.e. they save everything you throw at them. PNG (a still picture codec) is lossless. Only extremely high end video cameras offer lossless compression (the new — as of May 2012 — Nikon D800, at $3000, offers uncompressed HD video output, but you need a separate recorder). This is because HD video (24fps x 1920 x 1080 x 32-bit) consumes 200MB per second, which is enough to bring a high speed RAID to its knees).
- Most lossy codecs allow you to trade off lossiness for file size. Less lossy means a bigger file.
- Some modern codecs (e.g. H264, MJPEG) are nearly lossless at high quality settings, making them suitable (in some cases) for passing data through a pipeline.
- Some codecs are highly asymmetric (in general this means they take far longer to encode than to decode during playback) making them unsuitable for rapid iterative work (e.g. test renders). Most codecs designed for final delivery (e.g. anything related to MPEG, such as H264) are highly asymmetric.
- Most codecs (lossy codecs especially) do not support alpha channels. For alpha channel support it's best to compress video using a lossless image codec, such as TIFF or PNG (so each frame is stored as a losslessly compressed image with alpha channel in tact).
- If you want to create a very high quality video, suitable for use by a video editor, or for archival purposes, use a lossless codec (such as PNG) or a high quality lossy codec with no interframe compression at a high quality setting (such as MJPEG). Because PNG and MJPEG are not highly assymetric, they're also suitable for test renders.
- If you want to create a video for final delivery, create an archival quality version first, and then experiment with the codecs at your disposal to get the best quality vs. bandwidth vs. compatibility result you can.
Addenda
JPEG2000 supports lossless compression (at maximum quality) and supports alpha-channels ("Millions+"). In general it offers superior bandwidth to PNG but at a considerable cost in CPU load. If it were hardware accelerated it might be well worth using.
It's also worth noting that RAW / HDR video is now entering the mainstream. The Nikon D800 ($3000) outputs uncompressed video, and the new Blackmagic Cinema Camera ($5000) shoots RAW video (12-bits per channel). (The Blackmagic camera literally uses SSD drives as its "film".)
QuickTime appears not to support TIFF as a codec option for video, so use PNG (it's better anyway, generally producing smaller files even than TIFF with lzw compression). Note that TIFF does support 16-bit per channel images though (but then so does Targa).
Last edited: