Tutorial: Page (1) of 2 - 10/27/04 Email this story to a friend. email article Print this page (Article printing at MyDmn.com).print page facebook

A Guide to Using DeShaker

By John Meyer

Quick note for the impatient: If you already know about VirtualDub and dont want to read all this stuff, click on the link in the ?Downloading Programs section to download Deshaker, and then skip to the ?Basic Guide section to see what settings to use.

Now, on to the guide ?

You already know that your camera should be mounted on a tripod. Blair Witch Project and Bourne Supremacy actually made their audiences sick, not because of content, but because of camera motion. However, sometimes you dont have time to set up, lock down, and compose. You also may have to use amateur footage. For these reasons, you have probably wished you could motion-stabilize your video in post production.

You can purchase several software tools that stabilize video (Steadyhand from Dynapel, and Steadymove from a company called 2d3 are the two best-known commercial products). However, the one I have found works the best is a freeware utility called Deshaker. While Deshaker includes an excellent guide, the settings and setup can be a little intimidating. Since the program is so good, and since so many people in the Vegas forums have expressed an interest in using it, I developed this guide. I have written this with the Vegas user in mind, but people using other editing programs can use the guide as well, as long as you dont mind my occasional reference to a specific Vegas feature.

View two different examples of processed footage.



File 1: deshaker_secondprocess_before.wmv       deshaker-secondprocess_after.wmv
 
File 2: deshakeroriginal.wmv    deshaker-processed.wmv
 

Downloading the Programs
Deshaker is a ?filter that works with a freeware editing utility called VirtualDub. ?Filters are the same as fX plug-ins in Vegas.
 
Download Deshaker here:
http://home.bip.net/gunnart/video/Deshaker.zip
 
The authors own guide for the program is found here:
http://biphome.spray.se/gunnart/video/
 
In order to use this program, you need to download and ?install VirtualDub. Heres the link to that program: 
http://www.VirtualDub.org/download
 
To save AVI files from VirtualDub, I recommend you use some sort of codec. Unfortunately, the excellent DV AVI codec in Vegas cannot be accessed by any other program. However, you have three good options:
Download and install the free Panasonic codec from this site:
http://www.free-codecs.com/download/Panasonic_DV_Codec.htm
Purchase and install the MainConcept DV codec from here:
http://www.mainconcept.com/downloads.shtml
Download and install the free Huffyuv codec from this site:
http://neuron2.net/www.math.berkeley.edu/benrg/huffyuv.html
 
This last codec is not a DV codec, but is a lossless codec that also preserves a broader colorspace than DV. Vegas can read AVI files encoded by Huffyuv.
 
If you choose not to install a codec, you can save the file as an uncompressed AVI file. Be warned however, that uncompressed video takes 90 GB per hour, compared to 13 GB per hour for DV video.
Back to Top

Installation
VirtualDub does not include an installation program. You just open the zip file and copy all the files to some folder on your disk. I chose to copy them to the c:program filesvideo folder. Make sure you tell your unzip program to include folders in the unzip operation. Why? Some of the files need to be in their own folder, and this information is included in the zip file. In Winzip, you tell it to ?Use Folder Names. If you get an error message telling you that ?readme.txt already exists, then you definitely forget to tell your unzip program to create the folders contained in the zip.
 
Once you have copied the VirtualDub files, open the Deshaker.zip file and copy the ?deshaker.vdf file to the ?plugins folder created by the VirtualDub install.
 
You are now all set to start ?deshaking! Oh yeah, baby, this is gonna be fun!

Theory of Operation
You want theory? Well, in theory, you can motion stabilize video in Vegas. Open the pan/crop dialog for a video event. Step through that event one frame at a time. For each frame, look at the position of the video compared to the previous frame and use the pan crop windows left/right, up/down, and rotate controls to make the video ?line up with the previous frame.

This is exactly what Deshaker does.

Of course if you tried to motion stabilize video using the pan/crop tool in Vegas, it would take you hours to fix just a few seconds of video, and the results would still not be that good because it is very difficult to ?line up two frames of video.
Deshaker works its magic by using motion estimation algorithms (similar to what are used for MPEG2 encoding) to determine what has moved since the previous frame. This gets tricky, because movement can be caused by the camera moving in the operators hands; by the camera operator actually moving (in a car, on a dolly, or just walking); or by the subject of the video moving. The trick of stabilizing video ? both for the software, and for you the person setting the Deshaker controls ? is to figure out what movement is caused by unwanted shaking of the camera, and what movement is caused by the camera moving or the subject matter moving.

Running VirtualDub
This section of the guide is for those not familiar with VirtualDub. If you already know about this program, skip this section.

VirtualDub is a very simple video editor, but its main reason for being popular is that it provides a simple way to let people use an amazing array of ?filters that alter video, frame-by-frame. While some VirtualDub filters are duplicated in Vegas, many are not.

To run VirtualDub, double-click on the virtualdub.exe file in the folder you created during installation. If you are going to use this program frequently, right-click on virtualdub.exe, select ?Create Shortcut, and then drag that shortcut to your desktop.

Next, click on File -> Open Video File to open the AVI file you wish to stabilize. You can stabilize large AVI files that contain many scenes, but I generally prefer to work on AVI files that have just one scene.

The final step before actually doing the stabilization is to load the Deshaker filter. This is the same as clicking on the fX button for a Vegas event and then loading the fX. To load a VirtualDub filter, click on Video -> Filters. In the Filters dialog, click on the Add button. Look for the Deshaker plug-in, click on it, and then click on OK. You should now see Deshaker dialog.

Basic Guide
Now that you have your video clip loaded into VirtualDub, and you are looking at the Deshaker dialog, what do you do?

If you are really impatient, just read this one, short paragraph:

Change all the settings to match the above dialog, click on Pass 1 and go back to the main VirtualDub screen. Rewind and play to output. Return to the Deshaker dialog, click on Pass 2, go back to the main VirtualDub screen, and save the video.

If you want a little more information, read the following. If you need more help than this, go to the Advanced Setting section.

 Click on the big ?Pass 1&2 button at the top of the left column in the dialog box. Set the Source Pixel Aspect to ?Standard NTSC  (0.911) or ?Standard PAL  (1.094). If you are using some other type of video, then make the appropriate choice.
Change ?Video Type to ?Interlaced, lower field first if your video is DV. If your video is some other type, then make the appropriate choice.

Change the drive letter for the ?Log File. I dont like storing things in the root directory of my C: drive. The ?Log File will be used to store the X, Y, rotational, and zoom information for each frame of video in your clip.
Click on the big ?Pass 1 button. You can leave all the values at their defaults, but for better quality (but slower processing), change ?Scale to ?Full (most precise) and ?Use pixels to ?All (most robust). There is a significant speed penalty for doing this, and the results are often ?good enough with the defaults (which are Scale: Half, and Use Pixels: Every 4th).

Click on the big ?Pass 2 button.
Change the ?Destination pixel aspect to match what you set in step 1. Set the destination video size to 720x480 for NTSC DV video or 720x576 for PAL DV video.
Set ?Edge Compensation to ?None (large borders).
Put a check mark in ?Use previous and future frames to fill in borders. Dont change the default of 30 for the previous and future frames.

Set Motion Smoothness values of 3000 (NTSC). Set Zoom to zero (to turn it off). You can use larger values in order to make the motion smoother (Ive used settings up to 18,000), but the results may look somewhat artificial, and you may begin to see unwanted artifacts that make the video look like it was placed on top of a flag rippling in the wind on top of a flag pole.
Set all Max Correction Limits to 99.
Finally ? and this is important ? click on the big ?Pass 1 button (the one on top of the center column). 
 You can now click on OK to exit this dialog and then click on OK again to exit the Filters dialog.

The Deshaker plug-in now needs to play through the entire video in order to figure out what motion occurs from one frame to the next. During this first pass, it stores this information in the LOG file. To make this happen, press the rewind button in VirtualDub |<  to put VirtualDub at the first frame in your clip. Then, without doing anything else, press the play to output button.
>o Make sure you press the play to output button, the one with the little ?o next to it, not the play input button (the one with the little ?i" next to it).

The left side of the VirtualDub screen will show your video, and the right side will show the motion tracking algorithms at work. If your video is interlaced (which it probably is), you will see two screens at the right, one for the odd fields and the other for the even fields.

Pass 1 takes a long time. Be patient.

When Pass 1 has finished, dont touch any of the play controls in VirtualDub, and immediately open the Filters dialog again, click on the Deshaker plug-in, and then click on the ?Configure button. Since you have already configured Pass 2, all you need to do is click on the ?Pass 2 button, and then click on OK, and then on OK again in the Filters dialog.

Before you save the results, you need to choose the codec you want to use to save the resulting, stabilized video. Click on Video -> Compression, and choose the output codec you want. If you decided not to install a video codec, you can skip this step and the video will be save as uncompressed video, which will consume 90 GB per hour of video.

If you have used Virtual Dub for some other project, make sure ?Full Processing Mode is selected in the Video menu.
Once you have chosen a codec, you dont need to do this again until you quit and then re-start VirtualDub (see below about saving settings between sessions).
Now, click on the rewind |<  button again, and this time, save the results, using the ?Save As AVI option in the File menu. When you start the save operation, Deshaker will begin the second pass. This goes much faster than Pass 1.

When the save has finished, you will have a nicely stabilized video file that you can bring into Vegas. I usually put it on a track above or below the original video and then use the track solo or mute buttons to A/B compare to an external monitor. I line it up exactly with the original video, and I use then use the audio from the original video. Another excellent approach would be to add the video as a take. To do this, find the video event that is the original that you used as input to Deshaker and then use the right mouse button to drag the file from the Vegas explorer to the video event. You will get a pop-up asking giving you several options, and you can choose to ?Add as Takes. You can then press ?T on your keyboard while playing the clip to alternate between takes.

If you want to ?play around with various settings in Pass 2, you can run Pass 2 over and over again, without running Pass 1 again. This can be very useful if you want to experiment with different ?Motion Smoothness settings.


Page: 1 2 Next Page


Related Keywords:post production, DeShaker, VirtualDub , cleaning shaky video

HOT THREADS on DMN Forums
Content-type: text/html

@ Copyright, 2014 Digital Media Online, All Rights Reserved