Sunday, March 4, 2012


With HD camera's at super affordable prices (heck even my iPhone does 720p video!) more people than ever are breaking into filmmaking and testing the limits of what can be done.

Nothing seems more common or desirable than the Green (or blue) screen shot.

The concept seems simple enough. Record your talent with a green screen behind them. Then simply use After Effects, or Final Cut, to remove the green (a process calling "keying") and replace it with Rome, Paris, or the Starship Enterpise...

Unfortunately, in practice, this is much easier said than done with issues like, poke through, choppy hair, pixilated edges, and green spill plaguing many would be epic shots.

I'm no stranger to sub-optimal keys. I've made my fair share of mistakes. Fortunately I've learned a lot from them. Recently I've been accused of having green screen super powers. I'll let you in on a little secret... It's true. I'm actually from a planet called Krypton.

Seriously, the trick to clean keys can be summed up in the following main points, in their order of importance:

When Filming...
  1. Use a camera that preserves as much color data as possible
  2. Make sure to use a proper *even* lighting setup during the shoot
  3. Always double check your shots in a monitor you know is properly calibrated before you start filming (CAMERA LCD VIEWPORTS LIE!)
In Post:
  1. Use the source footage from the camera whenever possible
  2. Unless you shot in raw (4:4:4). Always color correct LAST
  3. Use garbage masks
  4. For complicated keys don't try to get a one size fits all key. Break the key into smaller sections and key each section seperately
  5. When you are happy with your key watch it using the "Alpha Channel" view to make sure you haven't missed anything.
  6. Each green screen shoot is unique. Be ready to scrap your key and try again (sometimes several times) to get that perfect key.
For some of you the bullets above will suffice. For those of you wanting more detail and some real world examples, keep reading.

Filming Points Explained...

Point 1: Use a camera that preserves as much color data as possible
Not all cameras are created equal. You can have perfect lighting and the best tools and still end up with bad keys. Expecially when filming with consumer grade (non-professional) cameras. Yes, I am also talking about DSLR's like the Canon 5D Mark III.

The problem isn't resolution, framerate, or megabits. The problem is Chroma Subsampling.
If you have control over what camera you'll be using for your shoot. I strongly encourage you to view this excellent video on the topic.

The bottom line is, you are attempting to pull off an effect that relies heavily on accurate and complete color data. Many consumer grade cameras (and even some pro cameras) make severe compromises with the color data they store, which means before you even shoot a single frame you may already be at a disadvantage.

Point 2: Proper Lighting
There are two main problems with lighting that can make keying problematic.
  • An unevenly lit green screen
  • Lack of a proper "key light" or they are sometimes called a "hair light"
The best way to get even lighting is to use properly placed soft boxes aimed at the green screen. With seperate Key, Fill, and Backlighing (sometimes refered to as "spill" or "hair" lighting) for your subjects.

The purpose of the backlight is to aim it at the talent from behind to reduce and counteract any green that may be spilling onto the talent.

This is refered to as a "Five Point Lighting" setup and you can learn about it in great detail here.

The important thing to remember here is that even if YOU can't see green spill, the camera might. Which brings us to...

Point 3: Always Use a Properly Calibrated Reference Monitor

Always double check your shots with a properly calibrated monitor before you start shooting. DO NOT RELY ON THE CAMERA'S LCD VIEWPORT! THEY ARE TOO SMALL AND OFTEN LIE!

For monitor calibration I suggest using a pair of THX glasses. You can buy them for 5 dollars. While the THX glasses are not strictly required. I find I get better results when I use them.
You can use any THX certified DVD or BluRay movie to calibrate (it's usually in the "Setup" submenu of the movie). I always calibrate my monitors using the THX optimizer included with Disney's Cars (Single-Disc Widescreen Edition).

You can use other movies of course. The important thing is always do your calibration with the same movie. Don't calibrate one monitor with Cars and another with Wall-E. You will get different results.

Ideally the reference monitor should be calibrated to match (as closely as possible) the workstation that will be used to do the post work. This has the added bonus of reducing the amount of color correction you may need to do in post. Getting it right the first time, in camera, is often the best approach.

Postwork Points Explained:

Point 1: Use the Source Footage From the Camera

If you are using a consumer grade camera, or a DSLR you are already at a disadvantage (see Filming Point 1). The last thing you want to do is risk loosing even more color data. Know the format of your source video and if you must re-encode it for distribution to your keyers try to use a lossless compression codec with the same color spacing as your original footage.

If you are on a MAC and working with other MAC or PC users use Pro-Res whenever possible.

If you are on a PC and working with other PC users use Lagarith it's a lossless codec with decent compression.

If you are on a PC and working with other MAC users use PNG image sequences!

AVOID USING H264 (unless it's your source footage). H264 is a finishing codec which means most of the color data you need to do proper color correction and keying is discarded in order to keep file sizes small.

Point 2: Unless you shot in RAW (4:4:4) Always Color Correct Last

Remember accurate and complete color data is king. Color correction (adjusting brightness, contrast, and changing color tones, can turn a simple key into a nightmare.). If you need to tweak the color of a clip to get a better key, that's a different story! But do not attempt to give your footage it's "final look" until after your keying and compositing is complete.

If you shot in RAW (4:4:4) using something like the RED or Black Magic cameras then color correction can be done at any stage. As long as you keep the re-rendered footage at 4:4:4. That last 4 is your best friend.

Point 3: Use garbage masks

It's a good idea (and sometimes your only hope) to use garbage masks to remove things that just won't key cleanly, but still need to go. This can eliminate problem areas around frame edges or sections where the keying isn't perfect due to an unevenly lit screen, creases in the fabric, or to remove tracking markers that may have been used.

Premiere Pro refers to it as a "Garbage Matte".

In After Effects you can simply use Masks.

For the really adventurous with After Effect 5.5 you can try using RotoBrush. When it works it's pretty sweet... When it doesn't... it can actually be more work than rotoscoping. There's a pretty good video tutorial here.

In worst-case-scenarios you may find yourself needing to use garbage masks as more than cleanup. In cases where clean keys are just not possible you may find yourself needing to go frame by frame using very tight masks with pixel precise accuracy to remove sections of footage that you'd originally intended to key.

Given this scenario, Masks in After Effects are more versatile. For shots with camera motion you can use the amazing Tracker2Mask by MamoWorld. A video tutorial for Tracker2Mask can be found here. This plugin has saved my bacon on otherwise impossible keys.

Points 4 & 5: Break Difficult Keys Into Smaller Simpler Keys and Preview Using the Alpha Channel

Keys often become difficult when lighting is uneven, or when something in the scene has better contrast than other things.

For example. In the shot below the talent on the left has wild wispy hair and a white shirt. The talent on the right has crisp hair and a dark blue shirt. Adding to the challenge is the fact that the green screen lighting is slighly uneven (the right side is slightly brighter than the left), and the footage has already been color corrected.

If we tried to key the entire frame all at once we'd get the following result:

At first glance the problem with this key may not be obvious. Look at the female talents hair (to the left). Notice how part of it is getting lost by the key. Now look towards the bottom near the ticker. Notice the noise. This is data left behind by the key. If you still can't see the problems don't worry. There is an easy way to make problems with your key clear.

On the keying effect there should be an "Output Setting". Change it to "Alpha" or "Alpha Channel". Now you should see something like this:

Solid black areas are areas that will become completely transparent. Solid white areas are areas that are completely unaffected by the key. Anything that is not solid black or white are remnants of a dirty key and will show up in your final composit. Notice that the key is a bit dirty near the female talent's hair and towards the bottom of the frame.

While we may be able to clean up the bottom area with garbage masks the hair will remain a problem that garbage masks will not be able to help.

If we back the key off a bit we will get more problem areas like the bottom. Meanwhile the talent to the right, already has a perfect key.

In this situation the best strategy would be to break the shot up into two halves. If we concentrate on locking down a key for the left half of the footage and then locking down a seperate key for the right half we are likely to get a cleaner overall key.

Using After Effects we can duplicate the layer (Control-D) and create a mask to cut out the left half.
In Premiere Pro we could also use the "Crop" effect.

Next we key the footage until it looks right.

Then we do the same thing for the right hand side.

The end result is a much cleaner key in the final composit.

We can verify this by looking at... you guessed it. The Alpha Channel:

Notice the hair is keyed but without loosing the finer portions, and the keying of the bottom area around the female talent is no longer dirty.

Point 6: Every Green Screen Screen Shot is Unique

There are no easy "this always works" approaches. Be ready to experiment with a variety of techniques in order to get that perfect key. Sometimes it will take 2 or 3 failed attempts.

If you own the Adobe Creative Suite (4, 5, or 6) it's worth noting that you have more than one keying option available to you! After Effects uses Keylight the swiss army knife of keying. Premiere Pro provides Ultra Key. While Ultra Key does not have nearly as many tunable parameters as Keylight, and keying in Premiere means your garbage masking ability is severely limited, I have encountered a handful of cases with DV DSRL footage where Ultra Key gave me a clean key with far less effort than Keylight.

Lastly, you need to understand that depending on how the footage was shot and delivered a perfect key may be impossible or impractical.
In those cases it may be best to find yourself a keyer who was born on the planet krypton and gets a funky high from the Earth's yellow sun. Boy I bet your friends would all be stunned...