The typical situation when using tracking is when we need 2 or more layer objects to move in sync with each other. Typically we have a base or background video layer that may need to be stabilized due to camera shake. Then we will have another layer on top of that which may need to match the movements of the base video layer. In other situations we may have an object moving across the screen that needs other elements to follow it. The layers that follow the movements of other layers are not only video or graphics, but can be Replicators, Particle Emitters, or Filters.
In this article I will use basic Stabilize and Match Move behaviors, but once you see how they work I encourage you to experiment with applying them to other situations in creative ways. I'll add some additional information at the end.
In our example, we have a shaky hand-held shot of a sign. We need to replace it with a sign made in another graphics application. The CGI sign needs to stay framed between the sign posts perfectly. First we will stabilize the shaky footage a little bit, then superimpose our CGI sign on to it so that it matches the movements of the original video footage. Thus, our CGI sign layer must be above my original video footage in the Layers pane.
We will highlight the bottom video layer in the layers pane, then use Command-2 to open the Library tab. From there we can click on Behaviors in the top left hand pane, then click on Motion Tracking in the top righthand pane. Below you'll see 4 Behaviors listed: Analyze Motion, Match Move, Stabilize and Unstabilize. Click each one and watch its preview at the top of the Library pane. It's pretty obvious what each one does. I'll explain these an other tracking options at the end of this article.
With Stabilize selected, click Apply to add it to the bottom video layer. With this Behavior highlighted in the Layers pane, use F2 to open the Behaviors tab of the Inspector. The first thing to do is be sure only Position is selected in the Adjust parameters. Dark gray is selected, light gray is deselected for these buttons. Leave everything else at default settings for now.
Below the Adjust parameter buttons is the Tracker: Add button. Click it to add one Track Point to our video clip. You'll see a red circle with a crosshairs at the center of the Canvas. Be sure to use Shift-Z to see the whole image frame in the Canvas. Drag that point to a suitable target in the video image. As you drag it, you'll see the area around it magnified, as well as the magnified area showing in the Tracker Preview box of the Inspector. You can add up to two tracking points, but use one to start with. Only use two if you have very problematic footage and need to track more than one Adjust variable (position, scale, rotation).
A suitable target area should have sharp contrast, and have defined edges as much as possible. You'll also want to be sure it's an area that remains in frame for the duration of the clip. If the only usable areas do not stay in frame, there is a way to handle them, which I will cover a little later.
Usually the default settings along with using only the Position for the Adjust parameter will work with a single tracking point. Press the Analyze button just below the Source setting, and the behavior starts building a tracking keyframe database. You'll see each frame keyed as a dot on the tracking line in the canvas, and in the timeline.
There may be occasions where you'll want to adjust some other parameters manually. Most often this will only be the Borders and Method parameters. Changing Borders from Normal to Zoom will enlarge the clip so that no black borders are seen around the edges. By default Method is set to Stabilize which will attempt to make the image as static as possible. When changed to Smooth, it will only attempt to smooth out shaky movement and is best used if the camera pans across a shot. The Smooth setting also adds smoothing adjustment sliders for Translation, Rotation, and Scale. Only increase Scale if the camera actually zooms in or out of the shot.
We can now apply a Match Move behavior to our CGI sign layer. In the Type parameter for tracking with the Match Move behavior there are two settings; Transform and Four Corners. Transform is a two-point tracking method that lends itself to attaching a layer object to a source clip that is a different shape, or you wish to turn on/off the Adjust parameters of Position, Scale, Rotation.
We will walk through the Four Corners method in this tutorial. This method automatically turns on all three Adjust parameters and uses four tracking points. Since we're matching the movement of a rectangular sign to another rectangular sign, this works best.
Simply drag each of the four corner tracking points to edge tracking locations. I have hints that may help with selecting tracking points towards the end of this tutorial. Be sure the tracking locations of the source clip beneath have good contrast and clear edges. Click Analyze to create the final tracking.
If you need to apply a mask to the object the Match Move behavior is applied to it's very easy. Only after the Match Move behavior is applied to the layer, Analyzed and completed, you can use the Rectangle Mask tool (Option-R) to draw and adjust your mask. Once you have the mask applied and adjusted, preferably on frame one of the clip, with the Mask highlighted in the Layers pane, go to the Library tab (Command-2). Then navigate to the Behaviors, then to the Shape category, and add a Track Points behavior to our Mask.
In the Behaviors tab (F2) grab the original Match Move behavior you applied to the object itself, then drag and drop it into the Source image well of the Mask's Track behavior. Now the mask's position and shape will precisely follow the object's tracking. We're done! We stabilized our original shot, covered the sign with a CGI sign, and masked it, all matching the movements of each together. What we did was very basic so let's look briefly at some other commonly used tracker control options that may come in handy in other situations.
However, there are other Tracker Control Options...
Depending on the type of effect you want to get, the Transform parameter, when using Four Point as your Match Move Type, gives you two options: Attach To Source does exactly that, it attaches your object precisely to the source. For example, if you're matching the movement of a box to a specific end of a line, Attach will keep the box perfectly attached to the end of that line, no matter how much it rotates or changes position, following the line's axis point.
If you want your object to simply act like the source, Mimic will have the box rotate on its own axis in place as the line rotates. This parameter can offer some very interesting ways for one object to follow exactly or simply react in a similar manner to the movement of another.
If you're applying a tracking behavior and you must use points that temporarily go behind other object in the source clip, or go out of frame, the Tracker Offset check box will help you out. It's very simple to use. If you click Analyze and your tracking point disappears behind another object in the video clip, or goes off screen, the analysis process stops. When this happens, use the left arrow key to move one frame at a time to the frame just before the analyzer lost the tracking point.
You will see a warning icon at the lower right of the Canvas When you see the exact frame it lost, go one frame before (to the left) of that frame. Check the Offset Track check box, then drag your tracker in the Canvas to a new point to track. Click Analyze again and the process will pick up at that frame, track the new point from that frame forward, and simply add the new tracking data to the existing data from the original point. You end up with one continuous uninterrupted track, as it adds the data from the changes together in one single string.
The two Auto-Zoom parameters, Auto-Zoom and Auto-Zoom Mode, do not effect tracking points or how they are analyze. They only affect how you visually see the zoomed-in area when you are dragging tracking points around the Canvas. Their purpose is only to make it visually easier for you to work. Auto-Zoom determines how much zooming in takes place: none, 2x, 4x, 8x. Auto-Zoom Mode determines what you see. Normal shows you a blown-up video of the actual video. Contrast shows you desaturated contrast of the image. Edge shows you black and white pixels that help highlight where sharp edges can be found (since contrast and edge sharpness are the two most valuable aspects of a good tracking point).
Motion can actually suggest areas to use as tracking points. They may or may not be wonderful areas to use, but in a good, clear video clip it can really help when no good spot is blatantly obvious (or you just want to compare notes with Motion). Hold the Option key down while you click and drag inside the Canvas. Motion will show a variety of suggested tracking points. Drag the mouse to one and the cursor will snap to it.
Aside from the three tracking behaviors we actually worked with here, there is also the Analyze Motion behavior which simply creates tracking data to be used by other behaviors applied to other layers, filters, behaviors and masks. The Unstabilize simply adds shakiness.
I'd also like to clarify what we saw in step 5: We used a Shape behavior called Track Points. Know that this behavior can be applied to any shape which includes paint strokes and masks. This is used in order to create new tracks, or reference the tracking data of other layer objects. For example, if you have something moving across your video shot, use this to track a matte of that object, then filters added will only be inside that mask. Or to have a paint stroke follow the motion path of another layer object.
Finally, we have a very interesting tracking Parameter Behavior available only to the Position controls in the Inspector's Properties tab. It's simply called Track. Right-click the Position title and from the pop-up menu go to Add Parameter Behavior and choose Track. This will apply tracking data from another layer object or from another tracking behavior to either a single, or any combination of X, Y, Z parameters for the position or the anchor point of that layer object. Note that this will only track these points and not skew, rotate, or anything else. This can add a great deal of creative options.
For example when used with a Link parameter behavior (see the user manual for more info) on other layers, we can achieve some very complex interactions in our animations. Imagine having a HUD type overlay for a Science Fiction shot, robot POV style. If we track movement the robot is seeing, animations of his HUD readouts can correlate with actual motions taking place in the scene he is viewing. That's an example for a whole other tutorial. But you see where I'm going, the creative options for using motion tracking are endless!
This is by no means a comprehensive course on tracking in Motion, but should give you the basic tools, techniques and a greater understanding of just how deep Motion's tracking abilities are. The general overview of the Stabilize and Match Move behaviors should give you enough to get started with the most practical and useful of these options.