Join Chris Meyer for an in-depth discussion in this video Tracking with mocha-AE, part of After Effects Apprentice 12: Tracking and Keying.
- View Offline
The Motion Tracker built in After Effects is far from perfect, and in this shot we played around with earlier where we had to do a 4 corner pin perspective track, we had lot of problems with the track points jittering and moving, and which should be a stationary shot. But it is just because the tracker does really know that there's relationship between these four corners that the shot is in essence a solid plane or panel that needs to be held together. Well, for trickier shots like this, After Effects CS4 and later does come bundled with a far more advanced tracking system called Mocha.
Mocha is actually a standalone piece of software. There are some very thorough resources out there on how to use Mocha, but I want to give you just a quick example of the workflow for a shot like this. So it doesn't seem like a complete mystery the first time you open it. First I am going to go back to my MRI layer, my Composition here, I am going to remove the effects we had previously applied to it, turn off Keyframes for position, reset the Transformations, turn off Motion blur for now. Because instead I am going to corner pin this using data from Mocha.
When you installed After Effects, and I will switch back to the Finder, mocha is actually placed in a folder inside the same folder you will find After Effects. To launch it, just double-click it. I am going to go ahead and say Start. The user interface for Mocha AE CS 5.5 is slightly different than the UI for CS4 and CS5, but I am going to go ahead and use this newer version just to keep you up-to-date. I'll start a New Project, I am going to import my clip and choose that MRI computer clip we are tracking, I'll click Open.
Mocha will automatically analyze clip, see how many frames it is. It has picked up the frame rate correctly from the movie clip. You need to watch pixel aspect ratio, I don't always agree with the numbers Mocha comes up with. But in this case, D 1NTSC is indeed 0.90909 or 10 elevens. So this is the correct number. If your footage has fields or pull down, you need to remove those at this point, since this is a progressive scan shot, I am okay leaving Separate fields off, I am going to click OK.
In Mocha, rather than defining the four corners we want to track individually, the first thing we want to do is find a plane, some flat rigid surface, even if it is at a perspective, and define that instead, that is what Mocha should track. Mocha has both Bezier pen tools, similar to the masks you see in After Effects, or X-Spline tools. I am going to use those again just to give you exposure to something different that is in Mocha. I'll click this tool, and start clicking around the outlines of this monitor.
I'm being careful to pick just the front of the plane of this monitor. I don't want to go on and pick up part of this wall, this clipboard, anything else in the room, because they are not the same plane, and they are going to move with a different perspective, and that will throw Mocha off. I'll come back over to my original point, I see this little circle, click and now I have enclosed my surface that I want to track. X-Splines default to having rounded corners; I can pull them to sharpen them up. I can also right click on any corner and say, select all of my points in the spline, pull one corner and they all will tighten up.
I might move this corner a little bit more like that, there we go! You will see in the upper left Mocha has a very convenient magnifier to give more detail of what I'm doing. Mocha defaults to Tracking Position, Scale, Rotation, and also Shearing or Bending in the image. If the camera is changing perspective, during the course of the shot, for example, if the camera person was walking around this monitor, I'd want to enable that as well. But since the perspective stays pretty even on this shot, I don't need to turn this on.
There is rolled over to Small Motion, so I will switch that option just to get a more accurate track. And then all I need to do is literally, go ahead and analyze forward, just like in After Effects. Once I do this, Mocha will step through the individual frames and update that defined shape to go ahead and track this monitor. One thing you might have noticed already is we are not getting the degree of jitter we saw in After Effects while tracking this same surface.
I'll wait till the shot is done, there we go! And if I want to I can go ahead and drag this time indicator through the shot and now I have very smooth tracking. We'll press the spacebar to play forwards and backwards through the clip. Now this initial mask shape I created is not the corners where I want to put my brand new display, I need to define those separately.
This is what Mocha calls a Surface, what is the new Planer Surface that I want to place onto the shot. I am going to enable it, now you see that I have got this new blue rectangle. I'll drag one corner, and again in the upper left, you'll see I get a magnified view. Again, I want to encase as much of that bright blue display as I can, so that my new video will sit right on top of it, like so.
I can drag through to see how well that tracks or even better to check my work I can turn on this grid, which gives me an exaggerated view of just how well I'm tracking that plane. I'll turn on that grid. It has a division based on what I last added to. Previously in Mocha, these are buttons and how many grid elements there were, in this space. But now things such as how many grid spacings I am using, exist as a Menu item, up here in the upper right corner.
Here's my grid dividers. By the way, one thing about Mocha's UI which is different, is you don't scrub left and right, you rotate around to change parameters. Little odd at first but you will get used to it. I am picking a grid setting so that I have pink lines that fall pretty much on the outlines of this new monitor that I am putting in place, see if get anything closer here, yep, that's pretty good setting as well. I can close out if I want to. Now as I play through, this grid really shows me how tight or loose my track is.
In this case, it's really darn tight, I'm pretty happy with that track. Okay, next trick is getting this track into After Effects, because this is standalone application. To do that, I just need to click on this button, Export Tracking Data, Mocha has several choices, the one that I like is After Effects corner pin supports Motion Blur, this is just like what we saw in the previous example, where we applied the corner pin effect, but also animated the position of the layer, so that Motion Blur would work as well.
So I will select that option, and I can either Save a text file for later archiving, a good idea, or just copy it to the clipboard. I'll do so, I'll tab back into After Effects, select my brand-new footage, I am going to put on that monitor, just like before and paste. There is my track and it's much more solid than the previous track that After Effects came up with. From this point on, you can do the same thing I showed you earlier in this lesson, go ahead and use the Bezier Warp Effect, to bend this brand new video, to cover up those all edges of the monitor, and if you like apply additional color correction and other treatments to better blend this whole scene together.
Now by the way, Mocha put this brand new display right over the old display, quite often when you paste for Mocha, you will find your layers, little bit offset in space. That's because Mocha does not know how big your composition is compared to how big your new layer is. If you need to re-center your pasted layer over your track footage, just carefully scrub the anchor point to get the positioning that you want. Move it over there and move it up a little bit to give me a better coverage and that I can Command+Scrub or Ctrl+Scrub on windows to go and find increments.
That's a better composite and I can also enable Motion Blur, to add a little bit of blur to the footage to better comp it in. So this is a really quicky lesson on how to use Mocha. Again, far more detailed resources out there, steep learning curve, because it does indeed have a different user interface in After Effects, but if you expect to do a lot of tracking in the future, it's definitely worth learning.
The After Effects Apprentice videos on lynda.com were created by Trish and Chris Meyer and are designed to be used on their own and as a companion to their book After Effects Apprentice. We are honored to host these tutorials in the lynda.com Online Training Library®.
- Understanding motion stabilization and keying
- Performing a track
- Applying tracking to effects
- Keying with KEYLIGHT
- Replacing images
- Improving the composite
- Garbage masking
- Dealing with interlaced footage