7 Sep ’08

Stabilizing camera movies


Have been making small movies with my photocamera this weekend, and put some effort into post-processing the movies. For some it was necessary to rotate the avi file by 90 degree, and for others some kind of image stabilization was very needed (I'm not a natural steady shot, which is interesting when you're shooting movies, handbows and crossbows). Doing these things is not as hard as may sound, and I've documented the howto here.



First - I had to download a number of programs, namely VirtualDub, Deshaker, some drivers to go with Deshaker, a video codec compressor called XviD, and an audio compressor called LAME. Install everything.

First off, how to rotate with VirtualDub is described on the internet on a few places. What you do is you open your video, go to Video, Filters, Add. Then select rotate, press `OK', select the angle of rotation you need and press OK again. After that, go to Video, Compression, select Xvid. If you are familiar with two-pass encoding you can press `configure' to configure that now (it's not that hard, but I'm not sure if it is worth the hassle on photo-camera clips), or just press `OK'. Now click File, Save AVI as, and select a new filename. Done!.

Deshaking things takes a bit more work, but as I got everything working in about 2 hours, it isn't that hard. There is a pretty good guide included with the Deshaker homepage. What I did, after some experimentation with settings was this: 1. open video, add the deshaker filter (in the same way as we added the rotation filter), select pass 1, click ok, press OK, and in the main screen of VirtualDub, click the `play output' button. Then go back to the filter menu and configure Deshaker for pass 2. There I selected 'adaptive zoom only' and the 'use the previous and future frames to fill border' options. The next steps were to encode the whole video as a new video (see above). This leaves you with a nicely stabilized video, but with a possible small delay in the audio (and a black screen the first x seconds that explains this delay. Write down the number of frames that this delay is!)

If you want to remove this black screen, an easy way is to reload the stabilized video as a new project into VirtualDub, then select `Direct stream copy' in both the video and audio menus, and then cutting away the the first x black screen seconds using the last two buttons on the bottom row of VirtualDub to designate where the output video should start and stop. This will take care of the visual part. Write down the info that is on the black screen somewhere (x frames, y milliseconds)

Next up is to realign the audio. In the File menu, there is an entry called `File Information' where you can see how much frames per second your movie is. The black screen you just cut away also contained some text with the number of frames that the black screen was lasting, and which you hopefully remembered to remember. Now you can go to Audio, Interleaving and delay the audio track by the appropriate number of milliseconds (i.e. 30 fps and a delay due to Deshaker of 30 means you have to delay your audio by 1000ms). That being done, just save the trimmer, unshaking, and audio-aligned avi!

Comments






Back to Wandering Thoughts
Me