Deshaker

Action video is often lacking clear persistent references to stabilize video with – they either are not present in the frame for very long, or often compressed out of frame as the codec is trying to spend most of its bandwidth on moving objects in the shot.

Deshaker, a plugin for Windows program VirtualDub, with its capability to find and track multiple visual references (literally hundreds of them) automatically from frame to frame is the king of action video stabilization. (It works on Linux, too, see below).

Blender is an open source 3D creation tool that can help ensure your videos remain stable. Deshaker is a video stabilizer for. Create your account / Login. You must be logged in to submit changes.

Deshaker works in 2 passes – analysis and stabilization. During pass 1, a log file is created that contains correction numbers necessary for each frame.

This file could be used in Blender as a source for transform track. Here is how:

Creating Deshaker Log

  1. Export video from Blender, audio is not necessary. It’s OK to use 50% render resolution (IMPORTANT: make sure to use the same resolution during Deshaker log import).
  2. Run VirtualDub.exe with Deshaker plugin installed in VirtualDub’s “plugins” folder
  3. Enable Deshaker with Video > Filters > Add > Deshaker
  4. Set or note location for log file, click OK – OK
  5. Open Blender video made in step 1
  6. I like to right-click and reduce input (left) video window to 25% at this point
  7. Make sure Video > Full Processing Mode is set
  8. Run analysis by invoking File > Save as AVI and setting some dummy file name. This file is discardable.
  9. Use Deshaker.log file for next step:

Using Deshaker Log in Blender

  1. Install one of 2 plugins from https://github.com/sergem155/blender-deshaker-log-import . There are 2 versions, using different stabilization algorithms (more below, but “damper” version is working well, “sinc” version is experimental).
  2. Import the plugin into Blender: File > User Preferences > Add-ons > Install from File
  3. Right-click the video (movie) track to stabilize. (It might make sense to make a metastrip out of the composition first.)
  4. IMPORTANT: make sure to use the same render resolution % used to render file for Deshaker analysis, as the log numbers are divided by that %!
  5. Import Deshaker log: File > Import > Import Deshaker log
  6. To speed things up a little, in Graph Editor, set interpolation type: Key > Interpolation Type > Linear
  7. Now you can scrub through video and see the Deshaker tracking data applied

Example output

Simple damper algorithm – the distance from center is reduced by 10% in each frame:

Music is Skeewiff – Blue Crystal (feat Rayna)

The black bars are kind of large, I’ve done a couple of attempts to reduce them, using a digital filter to remove low frequency motion from stabilization movement and remove “DC bias” building up. I still like simple damper better, but maybe I wasn’t playing with settings long enough, or windowed sinc’s ripples were acting up, and another algo would have been better.

Windowed sinc filter (17 points) – remove all motion < 1Hz, but with less steep roll-off:

Raw video without stabilization, for comparison:

Other Cool Features of Deshaker

I implemented just motion. Deshaker can also do adaptive zoom, rolling shutter rubber panning effect correction and can paint black bars with contents of previous frames, to name a few. If you’d like to code that, be my guest, the code is open.

What About Manual Correction?

Stabilizer

It would have been awesome to put a second transform track and correct the movement a bit, but sadly, Blender’s transforms are fully applied and cropped between strips, so you get a crop upon crop:

I also tried to put the sequence as a source strip in another scene’s sequence, with a smaller viewport. While this is possible, the strip is scaled to the second composition’s size, even with image offset option turned on, so it is, unfortunately, useless too:

Running VirtualDub on Linux

It works very nice:

  1. Install Wine Windows Emulator
  2. Install MP4 Windows codec https://sourceforge.net/projects/x264vfw/files/latest/download
  3. Enable vcrun2005 in winetricks (Wine utility)
  4. Download and unpack VirtualDub
  5. Download Deshaker and put Deshaker.vdf into virtualdub’s plugin folder
  6. Run virtualdub.exe

Update

There was a bug (sorry) in the code that was shifting all transforms 2 frames back, that is now fixed in github. (And once again, make sure to import the log with the same render resolution % you used to export it).

As I mentioned earlier, VirtualDub has become a big part of our production pipeline, and it’s largely due to the power of Gunnar Thalin’s excellent plugin Deshaker. Deshaker is the best image stabilization tool I’ve ever used. I’ve gotten slightly better results with the 3D tracker SynthEyes, and Avid’s built-in stabilizer is more workflow-integrated, but there’s nothing that can touch it in terms of the combination of power, speed, automatability… and of course, price.

It also has features that I haven’t seen anywhere else, like the ability to detect and repair the distortions that can come from cameras with a rolling shutter. It can handle interlaced video, which a lot of tools can’t, and it has the ability to reconstruct images to prevent edge flicker, which a lot of tools don’t. It even has scene detection built in so you can deshake footage that’s already been edited together (although this is obviously not ideal). Take a look at a very simple scene below. Even minimal stabilization adds a tremendous amount of production value.

As you can see, it’s best at taking out intermittent high-frequency shakes; the unavoidable fast jerks that you get when trying to handle a tiny consumer camera. If I cranked up the smoothness settings (which are adjustable on every axis, including zoom), it would be even more stable, plus I could isolate the area that I want tracked to just the sky, so the rippling ocean waves aren’t confusing the plugin. This is the only problem with Deshaker – it is so configurable that almost any shot can be properly stabilized, but it’s not automatic enough to get the perfect results every time when batch processing a whole drive full of clips.


However, I have managed to come up with base settings that give decent results for the kind of shooting we’ve been doing with the HV20, and I adjust them for the light conditions of each set. Each shot could be tweaked further for a better result, but for the most part I’m happy with what I get by applying the same presets to an entire directory of clips, and each time I adjust the presets to accommodate a new set, I learn better how to use Deshaker to its full potential. Everything is adjustable, from every aspect of the tracking process to the individual controls for correcting the image and compensating for frame edges, an area where it really shines.

Click The 'Deshaker' Link In My Earlier Post. That's From The Source Of The Plugin.

This unstabilized shot is pretty smooth for handheld, but the pan could be a lot more consistent and it would be better to keep the rider in the center of the frame. Unfortunately, stabilizing the