Skip to Main Content

Indiana University Indiana University


Motion Tracking in After Effects

In our last After Effects training video, we felt pretty cool about using Corner Pin to get a piece of video to appear on a monitor within our video.

Then we hit play…

And we quickly discovered that though corner pin is an incredibly useful effect, once your video starts moving, it loses it’s utility very quickly.

This is where motion tracking comes in.  We have a couple of options for motion tracking in CS4.  After Effects has a built-in motion tracker, which we can access through the “Tracker” panel, and there is a helper application called “Mocha for After Effects” that is included in the Production Premium install (assuming you didn’t de-select it). We’ll explore both in this post.

With the power of Mocha motion tracking, you can accomplish results like this (low quality video):

Learn how to accomplish the results in the above video after the break.

Before we get started, here’s a few files if you might find handy as we go along:

The video used in our examples, with tracking points attached

Text file with tracking data from Mocha for left screen

Text file with tracking data from Mocha for right screen

Motion Tracking in After Effects

Tracking motion in After Effects is a reasonably straightforward proposition.  It works by tracking an object within your video, creating a motion tracking point in every single frame.  It can then translate these points into keyframes that can control various properties like position, scale, rotation, or even the 4 points needed for a corner pin of a specific object (assuming you have 4 points in the video to track).

To make this work, After Effects needs a point to track in the video.  Hopefully, whoever shot the video thought ahead, and put some specific tracking points in the shot while they were filming.  These can be anything that is visible in the video.  This could simply be a piece of paper attached to the location with a specific mark on it, or a sticker that can be easily removed, or even something that already exists in the video, like a button, or a mark of some kind.  Here’s an example from our video:

tracking-points
A video still, with tracking points marked in red.

We need to keep some things in mind with these points.

  1. The tracking point must contrast with the background – We need to make sure that the point is clearly visible in the background.  The more contrast we have, the easier tracking the motion will be.
  2. The tracking points must be visible throughout the entire video – If the tracking point goes off screen at any point, After Effects will not be able to track the video properly.
  3. If you want to track the scale, you need two tracking points, if you want to track a corner pin, you need 4 tracking points (in After Effects; we will see later, that in Mocha we don’t need this).
  4. Ensure that the points are located in such a way that the super-imposed video or graphic will cover up the tracking points – There’s nothing worse than doing all of your motion tracking, and then discovering that after putting your video in place, the tracking points are still visible.  There are healing tools in After Effects, but you’d need to heal them on every single frame in the video.
  5. Attach your tracking point as close to the location of the super-imposed video as possible.  If After Effects is tracking something on the opposite side of the screen, it might not accurately capture the location you want to track.

Unfortunately, in some cases, you might find that the video you’re working with doesn’t have these tracking points, or they go out of frame, and there might not be any natural points in the video to track.  In the example above, the buttons on the monitors could possibly work, but without those, we wouldn’t really have a good point to track.  So it’s best to plan ahead when you anticipate the need to motion track a video.

Let’s look at how to do motion tracking in After Effects in this video:

Motion Tracking in After Effects (~12 min)

Motion Tracking with Mocha

Mocha is an application that creates tracking points for After Effects.  While After Effects is perfectly capable of tracking motion, it has some limitations.  It’s biggest problem is that the tracker is based on points within the video.  If these points go out of frame, or are obscured in some way the track will be much more difficult to accomplish.

But Mocha does things differently.  Instead of tracking points, it tracks planes.  We can map out a plane in the video (like a video screen), and then Mocha can track it throughout the video, even if part of it exits the screen.  It also creates a much smoother track in many cases, since After Effects might be selecting slightly different locations on a point, and as a result, the superimposed video might jump around slightly, like we saw in the After Effects Motion Tracking video. Sometimes this might be acceptable; but especially for a video screen, the superimposed video should be as stable as possible.

In these cases, Mocha works much better, because it tracks a specific plane in the video.  Because of the larger area, it can make smoother transitions.  It can also use it’s perspective tracking to translate it’s tracking data into corner pin data, which will animate each corner individually.

If you want to try this out, the exercise files are located above, including the tracking data I used to achieve the video at the top of the post.  You can copy the contents of each file individually, and paste them onto a selected video in After Effects the way we see in the movie below.

Let’s see how to do motion tracking in Mocha in this video:

Motion Tracking with Mocha and After Effects (~14 min)

So there you have it.  You should now have a good sense of what is required to track motion using After Effects, and I hope that you can take the time to experiment with different kinds of tracks to see what is possible.


One Response to "Motion Tracking in After Effects" to “Motion Tracking in After Effects”

  1. Dave Says:

    First of, GREAT VIDEO!!!!! Went onto youtube and even gave you a five star rating :D First one too WOOOT :D

    Normally i am left a little flustered, but this was very clear. Not saying any of your other videos are worse. :D

    Just saying some other, from other people, aren’t helpful as it confuses you more, and leaves you two steps back.

Leave a Reply

Get Training Tips via RSS Subscribe to Entries feed or Read Comments via RSS Subscribe to Comments feed.