What you'll need
Open the rotoscoping.aep project file in Adobe After Effects. Double-click the shark.mp4 layer in the Timeline to open it in its own Layer window.
In order to separate the shark from the background, you need to define the edges of the shark in the first frame of the footage. Click the Roto Brush tool.
With the Roto Brush tool selected, define the areas of the footage that you want to keep. Change the view level to fit the entire shark's body in the frame. Use the brush to paint along the interior of the shark’s body. A magenta segmentation boundary appears around the shark, indicating the foreground object to be separated from the background.
After defining the shark’s body, use the Roto Brush tool to refine any edges that are not perfect. Press the Alt/Option key on your keyboard and notice that the brush tool changes from a green circle to a red one.
Hold Alt/Option while painting to define areas of background that you want removed. Pay close attention to areas around the shark’s fin where the initial selection is not perfect. It is important to spend as much time as needed to make your first selection as precise as possible.
Once you’ve defined your foreground selection, use the Effect Controls panel to refine the edge further.
First click the Toggle Alpha Boundary icon below the footage to preview the shark against a black background.
Now open the Effect Controls panel and find the options listed under Roto Brush Matte. You can get good results by increasing the Feather value, reducing Shift Edge to a negative amount, and adjusting the Reduce Chatter percentage to help smooth the edges.
Now that you’ve defined the mask for the first frame, you need to step through the rest of the frames in the sequence to make sure the mask is precise. After Effects uses a combination of techniques to automatically calculate the edges of the object that is defined in the first frame, and applies it to the following frames as best as possible. For best results, step through the frames and make manual corrections when necessary.
First click and drag the Roto Brush span (the dark gray bar) to increase its length, so it takes up the full length of the footage.
Next, open the Preview panel and click Next Frame to advance the footage by one frame. If you notice any areas where the edge of the mask needs to be refined, use the Roto Brush tool to make the corrections, adding foreground or subtracting background as necessary. Follow this same step for all the frames in your footage.
When you are satisfied with the selection boundaries throughout the entire footage, click Freeze in the lower-right corner of the Layer window to save the boundary information.
After that process is finished, switch back to the Composition window.
To create the composite footage, you will need to add an image behind the shark footage. Drag background.jpg from the Project panel to the Timeline, just below the shark.mp4 layer.
Select the shark.mp4 layer and use the bounding box handles to resize and rotate the shark so it fits the scene to your liking.
To make a convincing composite, the shark will need some color correction to help match the background. Select the shark.mp4 layer in the Timeline and choose Effect > Color Correction. For this footage, a number of different effect layers are needed to correct the footage.
Add a Curves layer, a Hue/Saturation layer, a Photo Filter, and a Brightness & Contrast effect layer. Experiment with the values to help remove some of the blues and greens from the shark. Removing some saturation and adding some warm tones will help it match the color and lighting of the background landscape.
When you’re satisfied with how things look, click the Play button in the Preview panel to play your finished composition.
Contributor: Hugo Germain