Camera Smoothing in After Effects
1 Introduction
Instead of stabilizing a shaky camera movement completely it is in many cases better to just smooth out high-frequency jitter. Apart from artistic decisions this has several reasons:
- A stabilized clip (position/rotation/scale) will have to be filtered constantly. This results in a blurry image which is less noticable when there's still some camera movement left.
- Even worse, if you're stabilizing interlaced footage, some parts of your image might start flickering because the resolution is just too low for the tracker to do exact subpixel positioning.
- If your footage has motion blur due to your camera's shaky movement, it will look out of place when stabilized.
- Stabilizing your footage means losing resolution because of those black borders creeping in.
- A shaky camera move is completely impossible to stabilize because you'd lose the move. The image will be pushed out of the frame sooner or later too.
This article covers After Effects 6.5 but is of course also applicable to other packages. In fact, this article is based on Steve Wright's book "Digital Compositing For Film and Video" (Focal Press, 2002). The only requirement is some kind of way to smooth a tracker's path. If there's no proper scripting functionality maybe there's a way to "bake" a smoothed copy of the tracker's path. You'd have to redo part of the process when you redo your tracking.
2 Tracking and Smoothing
The first step is very similar to using the built-in stabilize functionality of the tracker. Drag your clip into a new composition and open the tracker panel. Due to the way the script works it is recommended that you start tracking at the first frame of your composition. Trim your layer accordingly if you want to skip into the clip.
Select a suitable pattern to track and off you go. If your camera is panning you will have to switch to another pattern during the process as your original marker leaves the frame. You can do this by holding down the ALT key while you reposition your tracker. Take great care to select a new pattern which is at the same distance from the camera as your old one.
Once the tracker has finished, do not apply the data. Instead, close the tracker's panel. Reveal the tracker's key frames by pressing "U" as well as the position property by pressing "Shift-P". Add the following script to the layer's position property. The first line will vary depending on your composition and which language version of After Effects you're using. So either adjust the "XXX" parts or drag the pickwhip tool to the tracker's attach point property:
That's all. Here are some ways to fine-tune the smoothed movement:
- The composition's first frame is being used as a reference point. You may, however, adjust valueAtTime() to suit your needs.
- To adjust the amount of smoothing, change the width parameter first, then play with the number of samples (an odd number is recommended).
- Instead of applying this script directly to the clip layer, a parented null object may also be useful. This way you're free to scale and reposition the clip to get rid of black borders.
3 About the Author
Stefan Ihringer is a freelance motion graphics and VFX artist currently located in Stuttgart, Germany. His portfolio includes trade show work for Daimler-Chrysler and Lexus as well as TV commercials and corporate movies. Take a peek at bildfehler.de.