Join Chad Perkins for an in-depth discussion in this video Stabilizing shaky footage, part of After Effects CS5 Essential Training.
- View Offline
In this chapter, we are going to look at stabilizing motion in order to stabilize shaky footage, such as that scene here. This is a handheld shot, which often has this camera shake, and sometimes it's a desirable look and sometimes it's not. What we are going to do is make this stable by having After Effects go in and track the motion here. So, in this movie, that's we are going to do. We are going to stabilize this. But in the remaining movies in this chapter, we are going to look at what you can do once After Effects has actually followed or in other words tracked an object in your scene.
It's amazing what you could do with motion tracking. So, let's go ahead and go to the Window menu at the top and open up the Tracker. It's just called Tracker here. That opens up the Tracker panel. We can't do anything with it, because like so many other things in After Effects, we need to motion tracking in the Layer panel. So, double-click the layer to open this footage in the Layer panel. Now in the Tracker, we have two choices. We can track motion, or we can stabilize motion. Again, the process of doing these is identical.
It's the same thing. But we are going to start with Stabilizing Motion. So, I am going to click Stabilizing Motions. And then we get this little gizmo here that consists of three things. We have an outer box, an inner box and a little plus. The plus is really the key point. That's what generates the data. And then this inner box is what we call the feature region. We want to put whatever After Effects is going to follow in this box. So, I am going to zoom out and see my footage and I might even want to scrub in time and see something that I can follow throughout the course of the shot.
I am looking for something that has motion that is indicative of the motion of the hand-held shots. So, if I had a bird flying, unless I wanted to track the bird itself, I wouldn't want to track that, because that wouldn't help stabilize the background shot. Likewise, I want to find something with good contrast. If I zoomed in here, if I grab like one of these shrubs over here in this group of shrubs, that would not be a good track because After Effects would lose track of it, no pun intended. So, what I am going to do is move my cursor to the inside of the feature region box.
I'll get a move icon. I want to click and drag this over to this little lamppost or something, whatever this is. As you can see, when I am clicking and dragging, I get kind of like this zoomed-in view of what that's going to look like. That's about where I want it. And so, I am going to let go and actually zoom in. I am going to resize my feature region here and maybe click and drag, move this around, and that's about right. We want to make sure that we get all of the thing that we want tracked and we want to make sure that maybe we leave a couple of extra pixels around the edges as well.
I don't need too much extra stuff here. That looks about right. And then this outer box is called the search region. What we want to do is want to make the search region as big as it needs to track this from shot to shot. So, if from one frame to the next, this object is going to jump way over here to the right side of where my mouse is freaking out over here. Then what I want to do is make my search region that big. But we don't need to make this as big as the object will move over the course of the entire shot, just as big as it will move from frame to frame.
And as I am moving this around here, we could see that it doesn't really move too much from one frame to the next. So, we don't need a feature region that big. Now, another issue is that you see that I actually created the track when my Current Time Indicator was at 4 seconds and 16 frames in. That's fine. You could actually go in and start tracking from any point in time. We could actually track this backwards, and we could track it forwards as well. So, you basically want to get to whatever frame that the object that you are tracking is the most clear.
Now, in my case here, I don't want to actually track backwards and forwards, because that would just be little bit tedious. So, I am going to hit the Home key and then just click and drag and move from the center of the feature region back into place and everything will just kind of move as is. So, that looks pretty good. And now I am going to go back to my Tracker panel. Again, I am making sure that I am in the Layer panel here. And then, in the Tracker panel, I am going to click this right button, which is Analyze Forward. And as I click that, it will start moving around. Now, you'll notice that these search and feature regions are moving in tandem with this object that we are tracking.
It's moving and it's shaking and that's good. That's what we want. What you don't want to happen is for this stuff to kind of drift off to the side. If that does happen, come back to the Tracker immediately and stop it. Press the Stop button. Everything that you've done already will still be there. But then what you'll need to do is back up in time and then adjust the search and feature regions and then come back and analyze forward again. So, a lot of times when you are doing tracking it's just constant like stop/ start, stop/start thing where you are constantly stopping and adjusting and then going back and fiddling with it to make sure you get a good track.
And if you are done, it's the end of the work area. And as I'm dragging around, I see that there is constant movement and if it looks as if the boxes are following the layer, then that's good. That is a good track. That's what we want. Now, so far in the process, all we've done was we had After Effects track the motion. That all that's happened. If we were to go back to our composition now and look at the original layer, we'd see no difference whatsoever. What we have to do now is apply the stabilization data to our layer.
So, what we do here is we can go to Edit Target, and we really don't have a choice. We can only apply the motion to our current layer. I'll click OK. And then, come down at the bottom of the Tracker panel and if you're not seeing this, if it's squished like this, you might need to resize the panel. But go ahead and click the Apply button. You'll then get a tiny pop-up saying Do you want to Apply the Dimensions in X and Y or just X or just Y? We want X and Y for stabilization. I am going to go ahead and click OK. And then it takes us back to our composition.
The first thing you'll notice is that there's a lot of blank space around the edges of every frame. And that's because After Effects has to actually move the layer on every frame in order to make this object that we were having in track stay in the same place. So, it's a very unusual look because as we scrub here, it used to be that the frame itself was staying in the same spot and the content was moving around. Now it's the opposite, the content is staying in the same spot, but the frame is moving around. So, one of the things that's kind of cool about High Definition Video becoming more in style, I guess, is that we are dealing with big frame, big footage.
So, what we could do, if this were an HD clip, we could put it inside of a smaller clip. Let's say the footage was originally 1920x1080 pixels. What we could do is put that inside of a 1280x720 size composition and it would be perfect and it would crop off these edges. We could also scale this layer up. We can press S and then scale this up so we are not seeing any of those black bars. But the problem with that, of course, is that we lose image quality by doing that. But that sometimes is a necessary evil in order to stabilize footage.
So, now I'll press the Home key, zoom into 100%, and we'll do a RAM Preview here to see what we have. Well, it's definitely much different than it was before. We are still getting a little bit of jitter around the top edge here. But overall, we have an amazingly stable shot where there was a very jerky shot before.
- Understanding the After Effects workflow
- Precomposing footage
- Explaining the basics and beyond of animating
- Creating glows, patterns, textures, and more with effects
- Color correcting footage
- Working with text
- Manipulating video playback speed
- Masking objects and shape layers
- Removing backgrounds with keying
- Compositing multiple pieces of footage
- Integrating After Effects with the rest of the Creative Suite