Motion tracking is one of the more fun features of Cinelerra. Using motion tracking, you can add effects to moving objects in a video. It can be ridiculously difficult to use and requires some playing around to get it working properly.
Step 1: Set up Video Track
Get a video that has a moving object that you wish to track. It is much, much better if the object is drastically different than other objects in the video. Get your clip on its own video track and make sure that keyframes are turned off. Go to a frame that you want to use as a reference frame to track your object.
Step 2: Set up Motion Effect
Add the Motion effect to the track. Set Action to Do Nothing. Calculation should be Save coords to /tmp. Turn on Draw vectors. Set to Track single frame and enter the current frame number. Settling speed should be 0 and Maximum absolute offset should be 100. Translation search steps should be at least 1024. Enable Track translation and disable Track rotation. The Draw vectors option draws some boxes in the Compositor and a point in the center. Adjust the Block X and Block Y until the center point from the Draw vectors is on the center of the object that you want to track. Adjust the Translation block size until the width and the height are restricted to the width and the height of the object to track. Adjust the Translation search radius until this box covers all of the area on the video you want to search for the object, but try not to include any extra.
The effect will compare each frame the frame listed in Frame number. It will look for the object in the Translation search radius. To see the effect work, switch the Action to Stabilize Subpixel. Go to the next frame . Cinelerra should move the frame until your object is back into the center of the box. A vector should be drawn in place of the center point showing the direction of motion. The effect can take some fine tuning if you did not choose a good enough Translation block size, or if the frame chosen as the reference frame isn’t good enough.
Play back the entire clip and look for areas that may need some fine tuning. Make as many adjustments as you can so that the Motion effect can do its job accurately. Once the playback is complete, you can use Load coords from /tmp to play back the remembered coordinates.
If your clip has some poor lighting conditions, you may want to add a brightness/contrast effect above the Motion effect. Turn down the contrast until all the lighting appears even. Getting the Motion effect to work under these conditions can be easier since it won’t get confused by lighting variations across your scene. After the Motion effect has done its job, switch the Calculation to Load coords from /tmp and then disable the Brightness/Contrast effect. The Motion effect will then be able to play back what it has calculated when the Brightness/Contrast was helping it out.
Step 3: Use Track to Pin Image to Moving Object
Disable all the effects on your video track. Add a second video track. Copy everything from the first video track to the second video track and call it Background Video. Name the first video track the Motion Video. Add a third track and place a picture on it and call it Image. Go to the Motion effect’s controls on the Motion Video track. Change the Master Layer to Top, disable Draw Vectors, and set Action to Track Subpixel. Re-enable the Motion effect on this track. Disable playback of the Motion Video track.
Right-click on the Image track and Add effect. Under the Shared effects column, add the effect Motion Video: Motion. Use the camera automation in the Compositor to place your Image track directly over your object to track.
Now your Image should track to the object from the Motion Video. You have shared the Motion effect between the Motion Video track and the Image track. When the Motion effect is shared like this, only one of these tracks can be enabled for playback. To get around this, you made a copy of the Motion Video and call it Background Video which has no active effects. The Image Track is tracked to the object from the Motion effect and then the Background Video is played beneath it.
See the Secrets of Motion Tracking for more information.
Example of Motion Tracking