Use chroma keys

A challenging part of creating a good chroma key is shooting the chroma key video, and in particular, using a good, well-lit background that provides a uniform color to remove. A wide variety of specialized chroma key background options are available, from chroma key paint that includes highly reflective additives to chroma key cloth or paper sheets. Additionally, it is important to use the best camera you can access and avoid using a highly compressed video format such as DV or MPEG-2.

For the following examples, this woman will be keyed over a street scene. The light stands will be handled in Finalize the key.

Viewer showing chroma key foreground video

Apply the chroma key effect

  1. In the Timeline, add the foreground clip (the chroma key clip with the color you want to remove) to the primary storyline.

  2. Drag the background clip (the clip you want to superimpose the chroma key clip over) so that it is connected below the foreground clip in the primary storyline.

    Timeline showing background clip connected to chroma key clip

    For more information about connected clips, see Connect clips to add cutaway shots, titles, and synchronized sound effects.

  3. Select the foreground clip in the Timeline, and click the Effects button in the toolbar (or press Command-5).

    Effects button in toolbar

    Tip: For best results, also position the playhead at a point within the foreground clip that shows the maximum amount of the color to be keyed.

  4. In the Effects Browser, select the Keyer effect.

    Tip: Type “keyer” in the Effects Browser’s search field to quickly find the Keyer effect.

  5. Do one of the following:

    • Drag the effect to the Timeline foreground clip to which you want to apply it.

    • Double-click the effect thumbnail to apply it to the selected clip.

The Keyer effect automatically analyzes the video to detect a green or blue dominant color and configures itself to remove that color. If the resulting key is not right or you would like to improve it, you can adjust the chroma key effect.

Adjust the chroma key effect

The following steps assume you have applied the chroma key effect.

  1. In the Timeline, select the foreground clip with the Keyer effect, and open the Video inspector.

    Controls for modifying and improving the Keyer effect appear.

  2. If the Select tool is not the active tool, choose it from the Tools pop-up menu in the toolbar (or press A).

    Select tool in Tools pop-up menu
  3. To improve the key using controls in the Viewer, use the Refine Key and Strength controls to do any of the following:

    • To identify areas of the foreground clip that might still have some of the chroma key color showing: Click the Sample Color thumbnail image in the Video inspector and draw a rectangle in the Viewer over the area where the chroma key color needs to be removed.

      Note: By default, the Keyer effect applies spill removal, which causes any leftover fringing of the blue- or green-screen background color you’re making transparent to appear as gray. To see the original color, set the Spill Level parameter to 0%.

      Sample Color tool being used in Viewer to clean up chroma key

      To improve the key, you can drag the rectangle to adjust its position or drag its corners to change its size, and you can drag additional rectangles over any areas with the chroma key color still showing.

      Tip: Select Matte (the center button) in the View area in the Video inspector to see the matte that the chroma keyer is creating. This can make it much easier to see areas that are not keying well.

    • To refine any difficult areas, such as hair and reflections: Click the Edges thumbnail image in the Video inspector, draw a line across the difficult area in the Viewer (with one end in the area to keep and the other in the area to remove), and drag the line’s handle to adjust the edge softness.

      Edges tool being used in Viewer to adjust edge softness

      You can use the following keyboard shortcuts to work directly in the Viewer:

      • To make a Sample Color adjustment: Draw a rectangle while holding down the Shift key.

      • To make an Edges adjustment: Draw a line while holding down the Command key.

      • To delete a Sample Color or Edges adjustment: Click a Sample Color rectangle or Edges line while holding down the Option key, or select the control and press the Delete key.

    • To choose a different color if the Keyer effect chose the wrong color: Set the Strength parameter to 0 (to override the automatic initial color sampling). Then use Sample Color to choose the color to remove. Select Composite (the left button) in the View area to see the foreground clip combined with the background clip.

    • To adjust how strongly the Keyer matches a color in the foreground image to the default chroma key color: Use the Strength slider to adjust the tolerance (core transparency) of the Keyer effect’s automatic sampling. The default value is 100%. Reducing this value narrows the range of color sampled, resulting in less transparency in the keyed image. Increasing the Strength value expands the range of color sampled, resulting in more transparency in the keyed image. The Strength parameter is useful to retrieve areas of semitransparent detail such as hair, smoke, or reflections.

  4. To help fine-tune the key, use the View options:

    Video inspector showing View controls
    • Composite: Shows the final composited image, with the keyed foreground subject over the background clip. This is the default view.

    • Matte: Shows the grayscale matte, or alpha channel, that’s being generated by the keying operation. White areas are solid (the foreground video is opaque), black areas are transparent (the foreground is not seen at all), and varying shades of gray indicate varying levels of transparency (the background video can be seen mixed with the foreground video). Viewing the matte makes it easier to spot unwanted holes in the key or areas that aren’t transparent enough.

    • Original: Shows the original, unkeyed foreground image.

  5. To further refine the matte, use the following controls:

    • Fill Holes: Increasing this parameter value adds solidity to regions of marginal transparency within a key. This control is useful when you’re satisfied with the edges of your key, but you have unwanted holes in the interior that you can’t eliminate via the Strength parameter without ruining your edges.

    • Edge Distance: Lets you adjust how close to the edge of your keyed subject the effect of the Fill Holes parameter gets. Reducing this parameter value brings the filled area of the matte closer to the edge of the subject, sacrificing translucency at the edges. Raising this parameter value pushes the filled area of the matte farther from the edge. Too much edge distance can result in unwanted translucency within parts of the subject that should be solid.

  6. To suppress any of the background color that is appearing (spilling) on the foreground image, adjust the Spill Level control.

  7. To reverse the keying operation, retaining the background color and removing the foreground image, select Invert.

  8. To mix the keyed effect with the unkeyed effect, adjust the Mix control.

For information about making advanced chroma key adjustments, see the following instructions.

Make advanced chroma key adjustments

The following controls are available for use in difficult keying situations or for fine-tuning specific problems:

  • Color Selection: These controls are meant to be used after you begin creating a key using automatic sampling or the Sample Color and Edges tools. (However, you can skip those tools and create a key using Manual mode, described below.) The graphical Chroma and Luma controls provide a detailed way of refining the range of hue, saturation, and image lightness that define the keyed matte.

  • Matte Tools: These controls are for refining the transparency matte generated by the previous sets of parameters. These parameters don’t alter the range of values sampled to create the keyed matte. Instead, they alter the matte generated by the Keyer effect’s basic and advanced controls, letting you shrink, expand, soften, or invert the matte to achieve a better composite.

  • Light Wrap: These controls are for blending color and lightness values from the background layer of your composite with the keyed foreground layer. Using these controls, you can simulate the interaction of environmental lighting with the keyed subject, making it appear as if background light wraps around the edges of a subject.

The following steps assume you have applied the chroma key effect.

  1. In the Timeline, select the foreground clip with the Keyer effect, and open the Video inspector.

    Controls for modifying and improving the Keyer effect appear.

  2. Click Color Selection to reveal the following controls:

    Color Selection controls in Video inspector
    • Graph: Provides two options to set how the adjustable graphs in the Chroma and Luma controls are used to fine-tune a key:

      • Scrub Boxes: Select to limit the Chroma and Luma controls to adjusting softness (edge transparency) in the matte you are creating. In this mode, you cannot manually adjust tolerance (core transparency), which is determined by the Keyer effect’s automatic sampling, plus any Sample Color rectangles you’ve added in the Viewer. (To increase matte tolerance, add more Sample Color rectangles or adjust the Strength slider.)

      • Manual: Select to use the Chroma and Luma controls to adjust the softness (edge transparency) and tolerance (core transparency) in the matte you are creating. Make sure the Strength slider is set to a value greater than 0 before you switch to Manual mode; otherwise the Chroma and Luma controls are disabled. When you switch to Manual mode, the Refine Key tools and Strength slider become disabled, but samples you’ve made with those controls continue to contribute to the matte.

      Important: When you switch to Manual mode, it’s best not to switch back to Scrub Boxes mode. For best results, begin keying an image using the Sample Color and Edges tools in Scrub Boxes mode. Switch to Manual mode afterward if you feel it’s necessary to refine your matte using the Chroma and Luma controls. However, if you switch back to Scrub Boxes mode, you may experience unexpected combinations of additionally sampled and keyframed values that might be difficult to control.

    • Chroma: Drag the two graphs in this color wheel control to adjust the isolated range of hue and saturation that help define the keyed matte. The selected mode governs which graphs in the color wheel are adjustable. The outer graph controls the softness (edge transparency) of the matte you’re creating, and can be adjusted in either Scrub Boxes or Manual mode. The inner graph controls tolerance (core transparency), and is only adjustable when in Manual mode. Drag any side of either graph to expand or contract the graph’s border, which adds to or subtracts from the range of hue and saturation contributing to the key. In Manual mode, you can also drag inside the tolerance graph to adjust its overall position in the color wheel. To the left of the color wheel, a small graph displays the slope of chroma rolloff, the relative softness of matte edges in regions most affected by the Chroma control. Dragging the Chroma Rolloff slider (described below) modifies the shape of this slope.

      Tip: It’s possible to zoom in to and pan around the Chroma control to more precisely adjust the graphs. To zoom in to the Chroma control, move the pointer over the color wheel, and, holding down the Z key, drag to the left to zoom out or to the right to zoom in. To pan in the Chroma control, hold down the H key and drag in the color wheel in the direction you want to move it. To reset the zoom and recenter the Chroma control, move the pointer over the Chroma control and press Shift-Z.

    • Luma: Drag the adjustable handles in this grayscale gradient to modify the isolated range of the luma channel (the range of lightness and darkness) that also helps define the keyed matte. The upper handles (which appear only in Manual mode) adjust the tolerance (core transparency) of the luma channel’s contribution to the key. The lower handles adjust the softness (edge transparency) of the luma channel’s contribution to the key. The Graph mode governs which handles are adjustable. In Scrub Boxes mode, you can adjust only the lower softness handles, which modify the range of lightness and darkness affecting the edge transparency of the matte. In Manual mode, you can also adjust the upper tolerance handles, which modify core transparency within the luma channel of the matte. By default, the slope of the left and right sides of the Luma graph has a slight “S” curve. You can modify the shape of the curve by adjusting the Luma Rolloff slider (described below).

      Note: The luma softness handles may extend past the outer boundaries of the Luma control. This is due to the floating-point precision of the Keyer effect and is expected behavior. To reveal and move out-of-bounds handles, drag the slope line of the Luma graph.

    • Chroma Rolloff: Use this slider to adjust the linearity of the chroma rolloff slope (displayed in the small graph to the left of the Chroma control). Chroma rolloff modifies the softness of the matte around the edges of regions that are affected most by the Chroma control. Lowering this value makes the slope of the graph more linear, which softens the edges of the matte. Raising this value makes the slope of the graph steeper, which sharpens the edges of the matte.

    • Luma Rolloff: Use this slider to adjust the linearity of the luma rolloff slope (the ends of the bell-shaped luma curve displayed in the Luma control). Luma rolloff modifies the softness of the matte around the edges of regions that are affected most by the Luma control. Lowering this value makes the slope between the upper and lower handles in the Luma control more linear, which increases edge softness in the matte. Raising this value makes the slope steeper, sharpening the edges of the matte and making them more abrupt.

    • Fix Video: Select this checkbox to apply subpixel smoothing to the chroma components of the image, reducing the jagged edges that result from keying compressed media using 4:2:0, 4:1:1, or 4:2:2 chroma subsampling. Although selected by default, this checkbox can be deselected if subpixel smoothing degrades the quality of your keys.

  3. Click Matte Tools to reveal the following controls:

    Matte Tools controls in Video inspector
    • Levels: Use this grayscale gradient to alter the contrast of the keyed matte, by dragging three handles that set the black point, white point, and bias (distribution of gray values between the black point and white point). Adjusting the contrast of a matte can be useful for manipulating translucent areas of the key to make them more solid (by lowering the white point) or more translucent (by raising the black point). Dragging the Bias handle right erodes translucent regions of the key, while dragging the Bias handle left makes translucent regions of the key more solid.

    • Black, White, Bias: Click the disclosure triangle in the Levels row to reveal sliders for the Black, White, and Bias parameters. These sliders, which mirror the settings of the Levels handles described above, allow you to keyframe the three Levels parameters (via the Add Keyframe button to the right of each slider). Keyframing the Black, White, and Bias parameters may yield a better key, one that adapts to changing blue-screen or green-screen conditions.

    • Shrink/Expand: Use this slider to manipulate the contrast of the matte to affect matte translucence and matte size simultaneously. Drag the slider left to make translucent regions more translucent while simultaneously shrinking the matte. Drag the slider right to make translucent regions more solid while simultaneously expanding the matte.

    • Soften: Use this slider to blur the keyed matte, feathering the edges by a uniform amount.

    • Erode: Drag this slider right to gradually increase transparency from the edge of the solid portion of the key inward.

  4. Click Spill Suppression to reveal the following controls:

    Spill Suppression controls in Video inspector
    • Spill Contrast: Use this grayscale gradient to adjust the contrast of the color being suppressed, using Black and White point handles (and corresponding sliders). Modifying spill contrast can reduce the gray fringing surrounding a foreground subject. The Black point handle (on the left side of the gradient control) lightens edge fringing that is too dark for a successful composite. The White point handle (on the right side of the gradient control) darkens edge fringing that is too light. Depending on how much spill is neutralized by the Spill Level slider, these controls may have a greater or lesser effect on the subject.

      Spill Contrast controls in Video inspector
      • Black, White: Click the disclosure triangle in the Spill Contrast row to reveal sliders for the Black and White point parameters. These sliders, which mirror the settings of the Spill Contrast handles described above, allow you to keyframe the Black point and White point parameters (via the Add Keyframe button to the right of each slider).

    • Tint: Use this slider to restore the natural color of the keyed foreground subject. Because the Spill Suppression controls eliminate blue or green spill by desaturating subtle blue or green fringing and reflection on the subject, the Tint slider lets you add hues to restore the natural color of the subject. Overdoing this parameter results in over-tinting the subject with the complementary color of the hue being suppressed—magenta if green, and orange if blue.

    • Saturation: Use this slider to alter the range of hues introduced by the Tint slider (when the Tint slider is used at moderate levels).

  5. Click Light Wrap to reveal the following controls:

    Light Wrap controls in Video inspector
    • Amount: Use this slider to control the overall light wrap effect, setting how far into the foreground the light wrap extends.

    • Intensity: Use this slider to adjust gamma levels to lighten or darken the interaction of wrapped edge values with the keyed foreground subject.

    • Opacity: Use this slider to fade the light wrap effect up or down.

    • Mode: Use this pop-up menu to choose the compositing method that blends the sampled background values with the edges of the keyed subject. There are five modes:

      • Normal: Evenly blends light and dark values from the background layer with the edges of the keyed foreground layer.

      • Lighten: Compares overlapping pixels from the foreground and background layers, and then preserves the lighter of the two. Good for creating a selective light wrap effect.

      • Screen: Superimposes lighter portions of the background layer over wrapped areas of the keyed foreground layer. Good for creating an aggressive light wrap effect.

      • Overlay: Combines the background layer with the wrapped areas of the keyed foreground layer so overlapping dark portions become darker, light portions become lighter, and colors become intensified.

      • Hard Light: Similar to the Overlay composite mode, except that colors become muted.

Animate the chroma key effect

To compensate for changing conditions in the foreground clip, you can make Sample Color and Edges adjustments at multiple points in the clip.

The following steps assume you have applied the chroma key effect.

  1. Place the Timeline’s playhead at the start of the clip.

  2. Use Sample Color and Edges (described above) to create a good chroma key.

  3. Move the Timeline’s playhead to a point later in the clip where the lighting or background conditions change, resulting in the chroma key no longer being acceptable.

  4. Use Sample Color and Edges to once again create a good chroma key.

  5. To add additional adjustments at other playhead positions, repeat steps 3 and 4 as needed.

  6. To move the playhead between each adjustment point you add, use the Jump to Sample arrows.

When you play the clip, the Sample Color and Edges settings smoothly change from one sample point to the next. For even greater control, you can add keyframes for most of the other settings in the Keyer section of the Video inspector. For more information about working with keyframes, see Video animation overview.

Note: Keyframes for the chroma and luma graphs in the Color Selection controls appear only in the Video inspector and not the Video Animation Editor in the Timeline.