User Guide Cancel

Keying

  1. After Effects User Guide
  2. Beta releases
    1. Beta Program Overview
    2. After Effects Beta Home
  3. Getting started
    1. Get started with After Effects
    2. What's new in After Effects 
    3. Release Notes | After Effects
    4. After Effects system requirements
    5. Keyboard shortcuts in After Effects
    6. Supported File formats | After Effects
    7. Hardware recommendations
    8. After Effects for Apple silicon
    9. Planning and setup
  4. Workspaces
    1. General user interface items
    2. Get to know After Effects interface
    3. Workflows
    4. Workspaces, panels, and viewers
  5. Projects and compositions
    1. Projects
    2. Composition basics
    3. Precomposing, nesting, and pre-rendering
    4. View detailed performance information with the Composition Profiler
    5. CINEMA 4D Composition Renderer
  6. Importing footage
    1. Preparing and importing still images
    2. Importing from After Effects and Adobe Premiere Pro
    3. Importing and interpreting video and audio
    4. Preparing and importing 3D image files
    5. Importing and interpreting footage items
    6. Working with footage items
    7. Detect edit points using Scene Edit Detection
    8. XMP metadata
  7. Text and Graphics
    1. Text
      1. Formatting characters and the Character panel
      2. Text effects
      3. Creating and editing text layers
      4. Formatting paragraphs and the Paragraph panel
      5. Extruding text and shape layers
      6. Animating text
      7. Examples and resources for text animation
      8. Live Text Templates
    2. Motion Graphics
      1. Work with Motion Graphics templates in After Effects
      2. Use expressions to create drop-down lists in Motion Graphics templates
      3. Work with Essential Properties to create Motion Graphics templates
      4. Replace images and videos in Motion Graphics templates and Essential Properties
      5. Animate faster and easier using the Properties panel
  8. Drawing, Painting, and Paths
    1. Overview of shape layers, paths, and vector graphics
    2. Paint tools: Brush, Clone Stamp, and Eraser
    3. Taper shape strokes
    4. Shape attributes, paint operations, and path operations for shape layers
    5. Use Offset Paths shape effect to alter shapes
    6. Creating shapes
    7. Create masks
    8. Remove objects from your videos with the Content-Aware Fill panel
    9. Roto Brush and Refine Matte
  9. Layers, Markers, and Camera
    1. Selecting and arranging layers
    2. Blending modes and layer styles
    3. 3D layers
    4. Layer properties
    5. Creating layers
    6. Managing layers
    7. Layer markers and composition markers
    8. Cameras, lights, and points of interest
  10. Animation, Keyframes, Motion Tracking, and Keying
    1. Animation
      1. Animation basics
      2. Animating with Puppet tools
      3. Managing and animating shape paths and masks
      4. Animating Sketch and Capture shapes using After Effects
      5. Assorted animation tools
      6. Work with Data-driven animation
    2. Keyframe
      1. Keyframe interpolation
      2. Setting, selecting, and deleting keyframes
      3. Editing, moving, and copying keyframes
    3. Motion tracking
      1. Tracking and stabilizing motion
      2. Face Tracking
      3. Mask Tracking
      4. Mask Reference
      5. Speed
      6. Time-stretching and time-remapping
      7. Timecode and time display units
    4. Keying
      1. Keying
      2. Keying effects
  11. Transparency and Compositing
    1. Compositing and transparency overview and resources
    2. Alpha channels and masks
    3. Track Mattes and Traveling Mattes
  12. Adjusting color
    1. Color basics
    2. Color management
    3. Color Correction effects
    4. OpenColorIO and ACES color management
  13. Effects and Animation Presets
    1. Effects and animation presets overview
    2. Effect list
    3. Effect Manager
    4. Simulation effects
    5. Stylize effects
    6. Audio effects
    7. Distort effects
    8. Perspective effects
    9. Channel effects
    10. Generate effects
    11. Time effects
    12. Transition effects
    13. The Rolling Shutter Repair effect
    14. Blur and Sharpen effects
    15. 3D Channel effects
    16. Utility effects
    17. Matte effects
    18. Noise and Grain effects
    19. Detail-preserving Upscale effect
    20. Obsolete effects
  14. Expressions and Automation
    1. Expressions
      1. Expression basics
      2. Understanding the expression language
      3. Using expression controls
      4. Syntax differences between the JavaScript and Legacy ExtendScript expression engines
      5. Editing expressions
      6. Expression errors
      7. Using the Expressions editor
      8. Use expressions to edit and access text properties
      9. Expression language reference
      10. Expression examples
    2. Automation
      1. Automation
      2. Scripts
  15. Immersive video, VR, and 3D
    1. Construct VR environments in After Effects
    2. Apply immersive video effects
    3. Compositing tools for VR/360 videos
    4. Advanced 3D Renderer
    5. Import and add 3D models to your composition
    6. Import 3D models from Creative Cloud Libraries
    7. Image-Based Lighting
    8. Extract and animate lights and cameras from 3D models
    9. Tracking 3D camera movement
    10. Cast and accept shadows
    11. Embedded 3D model animations
    12. Shadow Catcher
    13. 3D depth data extraction
    14. Modify materials properties of a 3D layer
    15. Work in 3D Design Space
    16. 3D Transform Gizmos
    17. Do more with 3D animation
    18. Preview changes to 3D designs real time with the Mercury 3D engine
    19. Add responsive design to your graphics 
  16. Views and Previews
    1. Previewing
    2. Video preview with Mercury Transmit
    3. Modifying and using views
  17. Rendering and Exporting
    1. Basics of rendering and exporting
    2. H.264 Encoding in After Effects
    3. Export an After Effects project as an Adobe Premiere Pro project
    4. Converting movies
    5. Multi-frame rendering
    6. Automated rendering and network rendering
    7. Rendering and exporting still images and still-image sequences
    8. Using the GoPro CineForm codec in After Effects
  18. Working with other applications
    1. Dynamic Link and After Effects
    2. Working with After Effects and other applications
      1. Export After Effects project as Premiere Pro project
    3. Sync Settings in After Effects
    4. Creative Cloud Libraries in After Effects
    5. Plug-ins
    6. Cinema 4D and Cineware
  19. Collaboration: Frame.io, and Team Projects
    1. Collaboration in Premiere Pro and After Effects
    2. Frame.io
      1. Install and activate Frame.io
      2. Use Frame.io with Premiere Pro and After Effects
      3. Frequently asked questions
    3. Team Projects
      1. Get Started with Team Projects
      2. Create a Team Project
      3. Collaborate with Team Projects
  20. Memory, storage, performance
    1. Memory and storage
    2. How After Effects handles low memory issues while previewing    
    3. Improve performance
    4. Preferences
    5. GPU and GPU driver requirements for After Effects
  21. Knowledge Base
    1. Known issues
    2. Fixed issues
    3. Frequently asked questions
    4. After Effects and macOS Ventura
    5. How After Effects handles low memory issues while previewing

Keying introduction and resources

Note:

When a background is not of a consistent and distinctive color, you can’t remove the background with keying effects. Under these conditions, you may need to use rotoscoping—the manual drawing or painting on individual frames to isolate a foreground object from its background. (See Rotoscoping introduction and resources.)

About keying: color keys, luminance keys, and difference keys

Keying is defining transparency by a particular color value or luminance value in an image. When you key out a value, all pixels that have colors or luminance values similar to that value become transparent.

Keying makes it easy to replace a background, which is especially useful when you work with objects too complex to mask easily. When you place a keyed layer over another layer, the result forms a composite, in which the background is visible wherever the keyed layer is transparent.

You often see composites made with keying techniques in movies, for example, when an actor appears to dangle from a helicopter or float in outer space. To create this effect, the actor is filmed in an appropriate position against a solid-color background screen. The background color is then keyed out and the scene with the actor is composited over a new background.

The technique of keying out a background of a consistent color is often called bluescreening or greenscreening, although you don’t have to use a blue or green screen; you can use any solid color for a background. Red screens are often used for shooting non-human objects, such as miniature models of cars and space ships. Magenta screens have been used for keying work in some feature films renowned for their visual effects. Other common terms for this kind of keying are color keying and chroma keying.

Difference keying works differently from color keying. Difference keying defines transparency with respect to a particular baseline background image. Instead of keying out a single-color screen, you can key out an arbitrary background. To use difference keying, you must have at least one frame that contains only the background; other frames are compared to this frame, and the background pixels are made transparent, leaving the foreground objects. Noise, grain, and other subtle variations can make difference keying very difficult to use in practice.

Keying effects, including Keylight

After Effects includes several built-in keying effects, as well as the Academy Award-winning Keylight effect, which excels at professional-quality color keying. (See Keying effects and Matte effects.)

For information on the Keylight effect, see its documentation in the folder in which the Keylight plug-in is installed, or on the Foundry website.

Note:

Though the color keying effects built into After Effects can be useful for some purposes, you should try keying with Keylight before attempting to use these built-in keying effects. Some keying effects—such as the Color Key effect and the Luma Key effect—have been superseded by more modern effects like Keylight.

The Key Cleaner and Advanced Spill Suppressor effects are most effective when applied together, in that order, after a keying effect like Keylight. 

Use the Keylight + Key Cleaner + Advanced Spill Suppressor animation preset (located in the Image-Utilities presets folder) to apply all the three effects. The Advanced Spill Suppressor effect is turned off by default to allow you to sample the key color in the Keylight effect or if the footage does not have any color spill to be removed. For more information, see Key Cleaner and Advanced Spill Suppressor effect.

Note:

Keep in mind that generating a high-quality key can require the application of multiple keying effects in sequence and careful modification of their properties, especially if the footage was shot without considering the requirements of the compositor.

Shooting and acquiring footage for keying

  • Light your color screen uniformly, and keep it free of wrinkles.

  • Start with the highest-quality materials you can gather, such as film that you scan and digitize.

  • Use uncompressed footage (or, at least, files with the least possible amount of compression). Many compression algorithms, especially the algorithms used in DV, HDV, and Motion JPEG, discard subtle variations in blue—which may be necessary to create a good key from a bluescreen. Use footage with the least color subsampling possible—for example, 4:2:2 rather than 4:2:0 or 4:1:1. 

Robbie Carman and Richard Harrington provide an excerpt on the Peachpit website from their book Video Made On A Mac that demonstrates how to plan, shoot, key, and composite a greenscreen shot.

Tips for keying with After Effects

  • Use a garbage matte to roughly outline your subject so that you don’t have to waste time keying out parts of the background far from the foreground subject. (See Use a garbage matte.)
  • Use a hold-out matte to roughly protect areas that are of a similar color to the background from being keyed out. (See Use a hold-out matte.)
  • To help you view transparency, temporarily change the background color of the composition, or include a background layer behind the layer you are keying out. As you apply the keying effect to the layer in the foreground, the composition background (or a background layer) shows through, making it easy to view transparent areas. (See Composition settings.)
  • For evenly lit footage, adjust keying controls on only one frame. Choose the most intricate frame of the scene, one involving fine detail such as hair and transparent or semitransparent objects, such as smoke or glass. If the lighting is constant, the same settings you apply to the first frame are applied to all subsequent frames. If lighting changes, you may need to adjust keying controls for other frames. Place keyframes for the first set of keying properties at the start of the scene. If you are setting keyframes for one property only, use Linear interpolation. For footage that requires keyframes for multiple interacting properties, use Hold interpolation. If you set keyframes for keying properties, you may want to check the results frame by frame. Intermediate keying values may appear, producing unexpected results.
  • To key well-lit footage shot against a color screen, start with the Color Difference Key. Add the Advanced Spill Suppressor effect to remove traces of the key color, and then use one or more of the other Matte effects, if necessary. If you are not satisfied with the results, try starting again with the Linear Color Key.
  • To key well-lit footage shot against multiple colors or unevenly lit footage shot against a bluescreen or greenscreen, start with the Color Range key. Add the Advanced Spill Suppressor
    and other effects to refine the matte. If you are not completely satisfied with the results, try starting with or adding the Linear Color Key.
  • Using the Key Cleaner and the Advanced Spill Suppressor effect in sequence is the best way to go about applying Keying effects.  You can use the Keylight effect in combination with the Key Cleaner and Advanced Spill Suppressor effects in that order on a layer using the Keylight+Key Cleaner+Advanced Spill Suppressor animation preset in the Image-Utlities folder under Animation Presets. The Advanced Spill Suppressor effect is turned off by default to allow you to sample the key color in the Keylight effect or if the footage does not have any color spill to be removed. For more information, see Key Cleaner and Advanced Spill Suppressor effect.
  • To key dark areas or shadows, use the Extract Key on the Luminance channel.
  • To make a static background scene transparent, use the Difference Matte Key. Add the Simple Choker and other effects as needed to refine the matte.
  • After you have used a key to create transparency, use Matte effects to remove traces of key color and create clean edges.
  • Blurring the alpha channel after keying can soften the edges of the matte, which can improve compositing results.

Use a garbage matte

A garbage matte (or junk matte) removes unneeded portions of the scene, resulting in a rough area that contains only the subject that you want to keep. When you are working with a poorly lit or uneven color screen (for example, a bluescreen or greenscreen), sketching a garbage matte around the subject can greatly reduce the amount of work that you have to do in keying out the background. However, if you spend a lot of time making a perfect garbage matte that exactly outlines the subject—essentially rotoscoping—you lose the time-saving advantage of keying.

  1. Create a mask to roughly outline a subject.
  2. Apply one or more keying effects to mask out the remainder of the background.
  3. Apply Matte effects as necessary to fine-tune the matte.

Use a hold-out matte

Use a hold-out matte (also known as a hold-back matte) to patch a scene to which a keying effect has been applied.

A hold-out matte is a masked-out portion of a duplicate of a layer that you have keyed. The duplicate is masked to include only the area of the image that contains the key color that you want to preserve as opaque. The hold-out matte is then placed directly on top of the keyed layer.

Example of using a hold-out matte
Example of using a hold-out matte 

A. Original bluescreen image. The background for the number is also blue. B. After keying, the background for the number is also transparent. C. Hold-out matte containing the part of the image you want to remain opaque D. When the hold-out matte is placed on top of the keyed image, the background for the number is now opaque. 

  1. Duplicate the layer containing the color screen.
  2. Apply keying effects and Matte effects to the original layer to create transparency.
  3. On the duplicate layer, create masks to mask out everything in the image except the area that you want to preserve.
  4. Make sure that the copy (the hold-out matte) is positioned directly on top of the keyed layer.
    Note:

    Don’t change Transform properties of only one of the layers after making the duplicate; keep the layers moving together. Consider parenting one to the other. (See Parent and child layers.)

Get help faster and easier

New user?