Deshaking Helmet Camera Footage

ettingsOne nice thing about helmet cameras is that they enable people to capture video of their favorite activities.  One downside, however, is that many activities are by their nature very ‘bumpy’, and therefore produce bumpy video footage.  It is therefore sometimes very helpful to ‘deshake’, or stabilize, your video footage before producing and sharing your video.

Many modern video editors have image stabilization filters built in.  In my experience, these filters don’t do a very good job for helmet camera footage – they are primarily aimed at shakiness from a hand held camera.  Nevertheless, it may be better than nothing.

I prefer to use a more powerful tool called VirtualDubVirtualDub is a free application that runs on a Windows PC.  It supports a wide variety of video filters and options, but I intend to focus on a free plug-in to VirtualDub called Deshaker.  Download and install both of these programs following the instructions given on their websites (use the embedded links).  These websites also provide user guides to help you better understand the tools.

NOTE: VirtualDub will not accept MP4 compressed video footage, so it is necessary to transcode to a format that it will handle.  For GoPro footage, the easiest tool would be GoPro Cineform Studio.  This will convert your footage to a less compressed form and saved as an AVI file.

Here are the steps I follow to stabilize footage taken with my GoPro HD Hero2.

1. Launch VirtualDub.

2. Load the Deshaker parameter file.

Before you can properly use the Deshaker plug-in, you need to set a number of key parameters.  The Deshaker website talks about each setting.  The tool is really quite powerful, but it was not really designed for helmet camera footage nor fisheye lens distortion.  Nevertheless, I have found that it works quite well.

To get you started, you may want to copy my HD Hero2 settings to your computer.  Feel free to play with the settings to meet your specific needs.  Once you find something you like, save the settings for future use.

From the “File” menu, select “Load processing settings…”.  Navigate to your saved settings file and allow it to load.

3. Verify a few settings (at least the first time you use the tool).

Select “Video->Compression…” and verify that your codec of choice is selected.  You will probably want to use the same codec that you use to transcode your helmet camera footage.  In my case, that would be the GoPro Cineform codec.  If the codec you need is not in the list, see the VirtualDub website for instructions.

Select “Audio->Interleave…” and ensure that the audio preload is set to 500 msec.  The deshaking process offsets the audio track from the video track.  This settings realigns them.

4. Open your source video file.

Select “File->Open video file…” and browse to your transcoded source AVI file.

5. Change the display size to fit your screen.

You may find that the input video display window is too large to fit within the VirtualDub window.  Simply right-click on the video window and select a size that works for you.  Do the same for the output window.  I generally use 50% for both windows if my source is 1280×720.  You should now have a window that looks something like this:

VirtualDub screen grab

VirtualDub screen grab

6. Select “Pass 1”.

Select “Video->Filters…” then double-click on the Deshaker filter in the list.  This should open up a window that looks like this:

Deshaker settings

Deshaker settings

This shows all of the Deshaker settings that you can play with.  Notice that it even provides some degree of correction for the rolling shutter effect.  See the Deshaker website for the proper value to use with your camera.  If it is not listed there, instructions are provided on how to measure it.

I have played with many of these settings, but not all of them.  My settings should give you a good starting point, but I suspect further optimizations are possible.  Remember to save the settings once you find ones you like.

Ensure that “Pass 1” is selected.  It takes two passes to deshake your video.  The first pass analyzes the video, while the second pass actually applies the correction.

7. Play the video.

Now play the video by hitting the output play button in the lower left corner (the one with the little “o”).  The video will play in the left window (very slowly) while the right window shows you the analysis that is taking place, as shown here:

Deshaker motion vectors

Deshaker motion vectors

The darkened region around the perimeter indicates portions of the video that are excluded from the analysis (as per the settings).  I ignore the perimeter because the fisheye distortion is so severe out there.

The red vectors indicate something moved too quickly in the scene, so that region will be ignored.

The white vectors show the direction and magnitude of movement of various objects within the scene.  This is how the tool tries to determine if the movement is a bounce or intentional camera movement.  For example, if you hit a bump while riding your bike, the camera will likely pitch up and down rapidly.  This rapid change in direction indicates a bounce.

To compensate for this, the video image can be slid in the opposite direction of those vectors in order to keep objects in the scene from bouncing around.  While this may seem simple, it is really a hard problem to solve – especially for highly dynamic helmet camera footage.

8. Reset the cursor the beginning of the video.

Once pass 1 has completed, drag the play cursor back to the beginning (frame 0).

9. Select “Pass 2”.

Open up the Deshaker controls again (“Video->Filters…”).  Now select “Pass 2”.  When you close the parameter windows you should see a pop-up window indicating that it is deshaking your video.

10. Save your output file.

Now save your stabilized video clip (“File->Save as AVI…”).  Give your file a name.  I like to append “- ds” to the file name so that I know this file has already been stabilized.

Congratulations!  You are done!  Now go edit your stabilized video.

NOTE: It should be noted that you will loose some image resolution when you stabilize it.  Since the image needs to be slid up or down, or left or right, to stabilize it, you have to give up some of the perimeter pixels from the image.  VirtualDub will resize your video to its original size (ie, 1280×720), but some image sharpness will be lost.

Here is an example video that compares stabilized video with the original source material.  To me, the loss of resolution is well worth the improvement of smooth motion.

You may notice that in the stabilized footage the helmet visor is bouncing up and down.  This is an indication of how much the tool had to slide the image up and down in order to smooth out the image.  I try to mount my helmet camera so that I don’t see the helmet since this is somewhat distracting.

Here is another example showing that stabilized footage is even better for street riding videos.

Update: The process of stabilizing unfortunately looses some resolution, or image sharpness.  I have found that I can apply a “Sharpen” filter during the second pass of the Deshaker process to sharpen the image back up.  A setting of 48 seems to do a pretty good job.  This video shows the original GoPro footage (Hero 3 Black) on the left and the stabilized and sharpened video on the right.  Unfortunately YouTube and Vimeo recompress the video yet again, thereby thrashing the overall quality.  Watch it on YouTube at 720p60 in theater mode for best image quality analysis.

 

Advertisements

About gardinerfamilyadventures

A really great family!
This entry was posted in Video editing and tagged , , , . Bookmark the permalink.

7 Responses to Deshaking Helmet Camera Footage

  1. Pingback: HD Video Editing Workflow | Gardiner Family Adventures

  2. Howard Lawrence says:

    Great job.
    737

  3. Pingback: GoPro Hero3 Black – First Impressions – May 2013 | Gardiner Family Adventures

  4. Pingback: Cum să faci o stabilizare video pe GoPro Hero – nwradu blog

  5. Ed says:

    Actually Virtual Dub can open MP4 files through DirectShow plugin (File–>Open–>DirectShow Input Driver [as filetype]) so no need for transcoding.The final result can be encoded to x264 wfv right in Virtual Dub.
    The CMOS sensors has all the rolling shutter issue (Jello effect) so I bought a 3CCD camera for helmet footage, the overall result is better.
    Virtual Dub x64 has better performance while running Deshaker compared to x86 (32 bit).

  6. Ed says:

    Sorry for misguiding you.I bought a second hand Panasonic HDC-SD9 for 120$ and made a Do-It-Yourself rig to put it on the helmet.No jello effect but image quality is lower than a similar CMOS camcorder.See here http://forum.videohelp.com/threads/361501-Best-3CCD-HD-camcorder/page2 though I haven’t publish any helmet/bike footage yet, only car footage.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s