Eight Things You Need to Know About Video Compression

Eight Things You Need to Know About Video Compression

Corrections: edits, updates, and corrections May 2012. Oh, and looks like there are NINE things.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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).
  6. Most lossy codecs allow you to trade off lossiness for file size. Less lossy means a bigger file.
  7. 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.
  8. 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.
  9. 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).
The simple message is this:
  • 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.
You can support WMP and QuickTime by using a codec that is available for both (QuickTime Pro is very good at producing cross-platform files; use its Movie to MPEG4 settings). With Flash you have several good codecs to choose from, but the better the codec, the later the version of Flash you require.

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:
Hi,
that is a excellent compilation of movie format facts. :smile: I just missed one point I often get asked. And that is alpha channel support. Maybe you add a point about alpha channel support which is very important for compositing work.

Bye,
Martin
 
Save Format Answers

Thanks so much for the thorough descriptions for saving animations. So many choices and After spending days on an animation (and a night of letting my macbook render) I wanted to make the right choice.
 
The one line summary is you should save rendered animations in lossless format (PNG or TIFF) to start with because if you're going to spend hours or days rendering something, why save it in a lousy format?
 
Saved for IPOD

I tried several of the saves but missed the png. Yikes! However I LOVE the look of the ipod save.

I have been taking my work into imovie to add sound and titling would you recommend better software to handle the editing? Can't afford the "professional" type.
 
iMovie lacks a vital capability for working with 3D -- compositing (putting one thing on top of another with transparency). This is (or was until iMovie '08) probably its key differentiator from Final Cut Express. Unless you basically plan to render everything in your 3D package and just cut stuff together, iMovie will leave you frustrated.

Unfortunately iMovie has really hurt the low end video editor market on the Mac, so there's not a lot of good cheap alternatives around. zs4 is free, but not seeing much in the way of updates, and it's a half-arsed port from Linux. Its UI is horrific.

QuickTime Pro ($30) lets you do basic compositing. If you plan your projects well it is perfectly functional, although not exactly intuitive to work with.

There are plugins for iMovie that provide basic compositing support. E.g. Stupendous Software has a mask/compositing plugin for $25 and eZedia's plugin suite costs $50... I haven't used either, and can't vouch for either.

Mien Software's MediaEdit ($80) from its feature list seems like it might be just the ticket, but I happen to know the programmer and would not recommend it just on that basis. (Its UI is pretty shocking too.) Its forums are pretty barren and the few posts show it has fairly tragic bugs (again, as expected).

The pro options are basically
  • Apple Final Cut Pro ($1300)
  • Adobe After Effects ($1000)
  • Adobe Premiere ($800)
  • Final Cut Express ($200)
While Final Cut Express may seem expensive, it's probably a better deal than MediaEdit ($80) or iMovie '08 ($80 for iLife) + $25/50 plugin on the grounds that it works well and the cheaper alternatives probably don't. If you're really pressed for cash, get QuickTime Pro and learn to live with its limitations.
 
Editing in Imovie

Yes, I actually do a lot in imovie. Cutting timing, titling adding sound etc. What I don't like about the version of imovie I have is that it has a loosy low quality formats to chose from. The so called full version failed to save for me . I talked to my son tonight and your evaluations matched. Coming to the same conclusion that Final Cut Express might be best.

So I will look into it.

Thanks
 
Norkross is a realistic option (unlike MediaEdit). Thanks for mentioning it.

The developer has posted here before and if I remember correctly he exchanged product keys with Martin. I have to say the latest version is a big improvement but development seems to be quite slow IMO.
 
NorrKross Movie

I checked it out a bought it. For $59 I felt there was more to gain then lose. It has enough similarities to imovie so the learning curve won't be too crazy. Sometimes I grow weary of everything you get needing study before you use it.

I'll let you know how it works for me.
 
I checked it out a bought it. For $59 I felt there was more to gain then lose. It has enough similarities to imovie so the learning curve won't be too crazy. Sometimes I grow weary of everything you get needing study before you use it.

I'll let you know how it works for me.

Cool. I do use it at home sometimes but I've got CS3 Production Premium at work which is very good (but very expensive). Enjoy and keep us posted as to your results.

Andrew
 
Back
Top