Search EventDV

2010 Awards Show
2009 All-Star Team
2008 All-Star Team
2007 All-Star Team
2006 All-Star Team

Streaming Media Producer
Streaming Media


Copyright © 2004 -
Information Today, Inc.

Tutorial: Creating Masks in Adobe After Effects
Posted Jan 31, 2006 Print Version     Page 1of 1

In wedding and event videography we have many opportunities to express our creativity, and one of them is by the use of masks. Masks are outlines, or paths, that modify a layer's Alpha Channel. In other words, masks can "cut" parts of your video out so that other video or images can show through. In After Effects, a mask belongs to a specific layer, but each layer can contain multiple masks.

Creating Masks

(Figure 1)
figure 1
Masks are generally created by using the Pen Tool the tool in the After Effects Toolbox that looks like a fountain pen. Select this tool (or press its shortcut, the letter G), click on the Composition window (monitor), move the cursor a little bit, and click again, and you will see a line that connects the dots that represent where you clicked (Figure 2).
figure 2

Click around the part of the video that you wish to keep. After you have finished, click in the same spot as your first dot, and the mask will close. By default, everything on the outside of the shape that you created will disappear. You have just created a mask!

Of course, there are other ways of creating masks in After Effects, like using the Rectangular Mask Tool or the Elliptical Mask Tool, but for now, we will concentrate on creating masks using the Pen Tool.


When you select the Pen Tool, check the little box that appears on the bottom left-hand side of the screen, called RotoBezier. Now that you have selected this option, the curves will be determined automatically as you click to make your shape. RotoBezier is a fast and easy way to make your curves look natural, but you must be careful because sometimes the curves do not go the way that you need them to go.

The example that I am using is a couple's first dance at a wedding reception. I am using a mask to blur the background and leave only the couple in focus. To achieve this effect I must "carve" the background out of the video, leaving only the couple.

The carving process is as follows:

1. Create a new Project in AE (File > New > New Project).

2. Import the footage that contains the first dance into the Project window (File > Import > File).

3. Drag the video clip onto the New Comp icon so that a new Comp will be created. This will ensure that the newly created Comp will have the same settings as the video clip.

 4. In the Timeline, double-click the video clip so that it opens in its own Layer window.

5. Select in and out points where you would like for the clip to start and end (Figure 3)
figure 3.

6. Trim the Comp to match the new in and out points. To accomplish this, in the Timeline, press the O key to go to the out point. Then press the N key to select an end point. Then right-click on the Work Area and select Trim Comp to Work Area (Figure 4)
figure 4

Masks, Masks, and More Masks

Now that we have selected our in and out points and trimmed our Comp, it's time to create our mask. Select the Pen Tool from the Tools window, or press the letter G. You will see that your cursor turns into a little pen. Make sure that the RotoBezier box is checked. All you have to do now is click around the couple (or whatever happens to be inside your mask) until you close the path. Automatically, the background will disappear and show the Comp background color.

I find it very distracting to have the background disappear while I am still working. It is much better for me to see the path and also see the background while I work. To keep both the background and path visible, select the layer in the Comp window and press the letter M (for mask). This will show you the mask that you just created.

From the drop-down menu, change the transparency from Add (the default) to None (Figure 5) so that you can see not only the mask, but also the background. We will change this setting later; we are only keeping the background visible for the time being so that we can work with a clearer idea of what's going on.
figure 5

The main difference between creating masks in video and still images, of course, is that you will almost always be masking objects (or, in this case, people) that move as the video plays. Our mask won't work very well if we lose the couple as soon as they move. For the mask to move when the couple moves, we need to keyframe the mask shape, as follows:
• Press the I key to go to the first frame of your video.
• Select the Mask Shape property.
• Turn the Time-Vary Stopwatch on, clicking on the little stopwatch icon to create the 1st keyframe as shown in Figure 6.
figure 6.

Now, here's where the tricky part comes. We need to move these points so that the couple will be always selected. The best way to do this is to keyframe the first frame (which we already did), and then keyframe the last frame. Next, move the points appropriately and then go to one second from the beginning and one second from the end and add keyframes there, continuing until you've covered the entire sequence in this way. Toggling this way between keyframes is a more effective way of animating the masks—much faster, indeed, than going frame by frame (Figure 7)
figure 7.

So, to reiterate:
• Keyframe first frame
• Keyframe last frame
• Adjust the mask's vertex points
• Keyframe at one second in the Timeline
• Keyframe end minus one second
• Keyframe at two seconds in the Timeline
• Keyframe end minus two seconds, etc.

Make sure you adjust the mask's vertex points at every keyframe so that the mask will adjust itself over time. If you need to go in between seconds later on, you can do so. Following these steps will make your keying a more pleasant experience. This is important considering that adding keyframes second by second to animate your mask is almost as much fun as watching grass growing or paint drying.

Animating a mask is not a fast process, and it is certainly not one for the impatient artist. This will take a while to do, and it will take longer to do if it is your first time using masks, or even using the Pen Tool. But don't despair—it gets faster with time, and soon you'll be an expert path creator.

There are some tools that you can use to speed up the animation process a bit. One is the Smart Mask Interpolation Tool, available in the Pro version of After Effects.

Blurring the Background

After you have finished carving your background away from the couple, do the following:
• Go back to the Add mode for the mask transparency.
• Duplicate the layer (select it and press Ctrl+D).
• Select the bottom layer.
• Press the letter M.
• Select the mask (there should be only one—to select it, just click on it).
• Delete it.

Now you can see that we have deleted the mask, so that we can see the background again. However, things are not quite as they appear. You aren't seeing the background of the top layer—you are, in fact, seeing the background of layer on the bottom. This is a different layer, one that you can process separately from the layer on the top.

There's one more thing left to do: Select the topmost layer and press the letter F on your keyboard. This will open the feathering properties for the mask, and you'll be able to adjust these numbers to add the correct amount of feathering to the mask.

Now it is time to process the bottommost layer. In this dance sequence, all I did was add a small amount of fast blur to the bottom layer, and that was it.

Next, I went under Composition > add to Render Queue, and rendered this Comp to a file. I imported this file into Premiere Pro and integrated this video sequence into the rest of my first dance footage (Figure 8)
figure 8.

So, to reiterate:
• In After Effects, create a new project
• Import footage
• Drag footage clip onto new Comp icon
• In Timeline, double-click on Layer
• Layer window will open
• Select in and out points
• Trim Comp
• Select the Pen Tool (press the letter G)
• Create a mask around the shape that you wish to keep
• Select the Timeline
• Press the letter M to show the mask
• Change the transparency options of the layer to None
• Go to the first frame of the Comp
• Create a keyframe for mask shape
• Go to the last frame of the Comp
• Adjust the points of the mask so that they cover the parts that you wish to keep
• Go back to one second
• Adjust the points of the mask so that they cover the parts that you wish to keep
• Go to the end minus one second
• Adjust the points of the mask so that they cover the parts that you wish to keep
• Go to two seconds
• Keep on going this way until the mask transforms properly as the video plays
• Adjust points in between seconds as needed
• If you have After Effects Professional, you may want to use the Smart Mask Interpolation option to streamline the animation process
• Duplicate the layer
• Delete the mask from the bottom layer
• Change the transparency setting for the mask on the top layer to Add
• Add a feather to the mask by pressing the letter F to access the feathering options
• Process the layer in the bottom
• Render the video and incorporate into your master program.

As always, incorporate your own taste and workflow into how you use this technique in your own projects, and have fun!

EventDV Spotlight is now:
more info
more info

Print Version   Page 1of 1