Deshaker (Latest version: 3.1)

Deshaker is a video stabilizer for VirtualDub. It eliminates camera shakiness and makes panning, rotation and zooming smoother.

Features:

  • Stabilizes horizontal/vertical panning, rotation and zooming.
  • Works in 2 passes for optimal simulated camera motion.
  • Can use previous and future frames to fill in "black areas" caused by the stabilization.
  • Optional motion vector video output during first pass.
  • Lots of settings for the advanced user.
  • Human guidance is possible on a frame per frame basis.

Some external Deshaker links:

[français] The Deshaker manual (this page) and the John Meyer guide translated to French by Andre Milliner:
http://letransfert.xooit.fr/t215-Deshaker-traduction-en-Francais-de-la-DOC.htm

[español] The manual (this page) for an older Deshaker version translated to Spanish by Ramón Cutanda:
http://www.videoedicion.org/documentacion/article/deshaker-filtro-estabilizador-para-virtualdub

[english] A guide with some good advice for stabilizing bicycle video, by John Allen:
http://www.sheldonbrown.com/deshaker.html

 

Installation

Download Deshaker using either link below and place the vdf file in the VirtualDub plugin directory and (re)start VirtualDub.

(Keep in mind that many codecs etc. are 32-bit only and those can't be used in 64-bit VirtualDub. But 64-bit Deshaker will let you use all available memory, which comes in handy for the memory hungry Previous and future frames to fill in borders option. There's also a 4GB patch you can use on the 32-bit VirtualDub.exe file to be able to use more memory. I can't guarantee that everything in VirtualDub will still work after that, but I haven't seen any problems.)

I strongly recommend using VirtualDub version 1.9.9 or later for Deshaker version 2.5 or later.

If you have any problems or questions, please start by reading the FAQ below.

 

Source Code

Since 2022, Deshaker is open source, and can be found on GitHub.

 

The Short Guide

These are the minimum number of steps you must make in order to stabilize a video clip:

  1. Open your video clip in VirtualDub (menu: File/Open video file).
    (Tip: If VirtualDub can't open your video file directly, you can use AviSynth to open pretty much anything in VirtualDub. Also, there are several input plugins available for VirtualDub, like Virtualdub FFMpeg Input Plugin.)
  2. Add the Deshaker filter (menu: Video/Filters, click: Add, double-click: Deshaker).
  3. In the Deshaker configuration dialog that appears, select the correct Source pixel aspect and Video type. Also, if your camcorder has a CMOS sensor instead of a CCD sensor, check Camcorder has a rolling shutter, and if possible, find out the correct rolling shutter amount (see settings below). Then, click OK to close.
    (Note: Most modern cameras have a CMOS sensor.)
  4. Step through the video in some way. One way is to use File/Preview filtered in VirtualDub, which lets you see all processed frames, but is limited to a processing speed equal to the clip's framerate. To ensure maximum processing speed at all times, use File/Run video analysis pass instead. No useful video is created during this first pass, so there's no need to save the output video.
    (Note: If you use File/Preview filtered, it's important that the menu items Options/Drop frames when behind and Options/Sync to audio are unchecked.)
  5. Open the Deshaker configuration dialog again (menu: Video/Filters, double-click: Deshaker line), and select Pass 2 by clicking on it.
  6. Select a video codec (menu: Video/Compression) and encode the video the usual way (menu: File/Save as AVI).

The default settings will however result in black borders caused by moving the frames around to compensate for shaky video. There are various settings that can help limit the size of the borders, remove them completely or make them less ugly. Read about these pass 2 settings below. (The settings in question are Edge compensation, Previous and future frames to fill in borders and Extrapolate colors into border.)

 

The Long Guide

This section describes all the settings in detail.

The default parameter settings are chosen to work pretty good under most circumstances. However, you can always get better results by adjusting some settings. For example, some complicated clips might require that you change some pass 1 settings, or you will get jerky video. Also, you'll need to change some pass 2 settings if you want to take care of the black borders.

Remember that all settings have a purpose, or they wouldn't be there. Most people I hear from seem to use the default settings or change very few of them. And many clips I've seen from other users are far from as good as they could have been. I know the settings may seem a little hard to understand and maybe a little too many, but if you want perfect looking video you should at least try.

To understand these settings it is necessary for you to understand how the filter works, so here comes a brief description.

How the Filter Works

During Pass 1 the filter tries to find the panning, rotation and zoom that, when applied to the current frame, makes it look like the previous frame (almost). It does this by taking blocks of pixels in the two frames and finding the shift that makes them match as good as possible. First, to find the "big" motion, the frames are reduced a lot in scale and the initial shift is calculated from the whole (scale-reduced) frames. This shift is then fintuned in a scale twice as big and with four times as many blocks, and so on. Finally, we have the block shifts (or motion vectors) in the frames at 100% scale. The filter then tries to ignore motion vectors that appear on blocks belonging to moving objects, and draws them in red. The remaining (white) motion vectors are used for calculating the values (panning, rotation and zoom) for transforming the whole frame to look like the previous. Those values are then written to the log file.

At the start of Pass 2 the values in the log file are read and optimal camera motion is calculated based on the smoothness settings. The filter then transforms each frame of the video clip according to this motion.

The Settings

Setting (pass 1&2)

Description

Source pixel aspect

Tells the filter what pixel aspect ratio the source clip has. It's important that you set this correctly, or the rotation (for example) won't be made correctly. You may enter any value if you can't find the preset you're looking for.

If the video size is 720x480, 704x480 or 352x240, it's probably NTSC, and if it's 720x576, 704x576 or 352x288, it's probably PAL. The HD resolutions 1920x1080 and 1280x720 have square pixels.

Video type

Selects between progressive video and interlaced video (for input and output). If the video is interlaced you must also determine if the video has the first or last field on the first line. In general, DV uses lower field first and all other formats (including HDV) use upper field first. You can easily check that your setting is correct by looking at the motion vectors for the two fields when there's motion in the clip. If the vectors point in opposite directions most of the time the setting is incorrect.

Camcorder has a rolling shutter

Most modern camcorders (those with a CMOS sensor instead of a CCD sensor) don't capture the whole frames at once, but instead use a "rolling shutter". Here the lines of a frame are captured one after another at slightly different (although usually overlapping) times, which can cause some ugly effects. For example, vertical lines will get slanted when doing a fast horizontal pan, and when panning up/down everything will get squeezed and stretched.

For Deshaker, a rolling shutter means that the camcorder shake parameters (panning, rotation and zoom) aren't necessarily constant over the entire frame, but can change slightly from one line to the next. If you enable this setting, Deshaker will therefore allow these parameters to change linearly in the vertical direction during pass 1 (and you will see a range of values under the output video). This makes extracting these parameters more reliable and it also makes it possible for pass 2 to remove the rolling shutter distortions if you keep the setting enabled during that pass too. Note, however, that only rolling shutter distortions that are caused by moving/shaking the camcorder can be removed. Fast moving objects within the frame will sadly still look as strange as before.

Although the actual camcorder shake isn't linear during the capture of a frame, it's usually a good enough approximation to make the distortions disappear almost completely. But I strongly recommend enabling the internal camcorder stabilizer, to make the distortions more linear. If you have one of those compact CMOS cameras with bad (or no) internal stabilization, and the clip has very fast shakes (for example if the camera is mounted on a bike or similar), or if you use a fisheye lens, you probably won't be able to get a very good result from Deshaker, since the distortions will be far from linear in these cases. Get a CCD camera capable of high shutter speeds for these kind of videos.

Different camcorder models have different rolling shutter speeds (how fast the shutter rolls downwards). And a certain model could possibly even have different speeds under different conditions. To be able to handle all speeds properly, you can enter an amount from 0 to 100%. You can try which amount setting looks best, or you can measure it more precisely yourself using the following procedure:

  1. Place the camcorder on something to make it steady, yet easy to pan left/right at a constant speed, for example on a tripod, or even better, on a turntable. Then, point it towards some vertical line (or edge) that covers the whole height of the frame.
  2. Now, using a fast shutter speed (to make the line sharp), record some video of the line when the camcorder is completely still, as well as when it pans left and/or right (direction doesn't matter) at a pretty fast constant speed.
  3. Then, for interlaced video: Pick a still frame and a panning frame. The panning frame should contain two occurrences of the line, one in each field.
    And for progressive video: Pick a still frame and two consecutive panning frames.
  4. Then, find the horizontal position (x-pos) of the vertical line at 5 places, namely at:
     St = top of still frame,
     Sb = bottom of still frame,
     Ft = top of first panning field/frame,
     Fb = bottom of first panning field/frame,
     Nt = top of next panning field/frame.
  5. Now, the rolling shutter amount can be calculated as: 100 * (Fb - Ft + St - Sb) / (Nt - Ft).

In the above procedure, if you have a fisheye lens, try to pick fields/frames where the line is on opposite sides (left/right) of the center, and preferably at an equal distance from it. Also, when you pick the top and bottom positions, you might want to extrapolate the lines from the center to the top/bottom and use those positions instead.

Usually the shutter rolls downwards on the sensor, but there are a few cameras where it rolls upwards instead. In this case you will get a negative rolling shutter amount.

The default rolling shutter amount is 88%, which was measured from the Sony HDR-HC1(E) camcorder. (Deshaker versions before 2.4 had 88% fixed.)
If you measure the amount for another camcorder, please let me know so I can publish the values for other users. Here are the ones I've got so far:

  • Canon EOS 5D Mark II: Probably somewhere between 66% - 72%
  • Canon EOS 7D Mark II: 56%
  • Canon EOS 60D - 1080p25: 47.5% (+/- 1)
  • Canon EOS 70D - 1080p25: 61%
  • Canon EOS 80D
    - 1080p60: 90%
    - 1080p30: 45%
    - 1080p24: 36%
    - 1080p30 with 3x digital zoom: 90%
  • Canon EOS 500D: 71%
  • Canon EOS 550D: 66%
  • Canon EOS 600D / Rebel T3i - 1080p30: 57% (+/- 1)
  • Canon EOS 650D - 720p50: 56.8%
  • Canon EOS 700D / Rebel T5i
    - 1080p30: 46%
    - 1080p24: 41%
    - 720p60: 52%
    - 480p30: 55%
  • Canon HF100
    - 1080i60, stabilization off: 101.4% (although a larger value than 100% seems strange to me)
    - 1080p24 via IVTC, stabilization off: 41.6%
  • Canon HV20 - 1440x1080p25: 38%
  • Canon IXUS 220 HS
    - 1080p24: Somewhere around 75%
    - 720p30: 36%
  • Canon IXUS 300 HS - 720p30: 57% - 63%
  • Canon LEGRIA HF G30 - 1080p50 (Dynamic Image Stabilisation, AVCHD 28Mbps): 62.0% (+/- 0.3)
  • Canon LEGRIA HF M36 - 1080i50: 82%
  • Canon Vixia HF11 - 1920x1080p25: 53%
  • Canon Vixia HF R300
    - 1920x1080 30p MXP mode: 40%
    - 1440x1080 30p FXP mode: 43%
  • Canon XF100 - 1080p25: 32%
  • Casio Exilim EX-F1 Pro
    - 1080i60: 72%
    - 720p30: 22%
  • Casio Exilim EX-FC100 - 720p30: 64.5%
  • Casio Exilim FH-100 - 720p30: 33%
  • Contour HD1080
    - 1080p30: 88%
    - 720p60: Around 75%
    - 720p30: 73%
  • Drift Innovation HD170 - 1080p: 60%
  • DXG 595V - 1080p30: Probably 100%
  • EVOLVE 4000HD Sport - 720p30: 92%
  • Flip Mino HD: 58.6%
  • FlyCamOne HD 720p - 720p30: 47.6%
  • Gitup Git2 Pro
    - 1080p30, stabilization on: 56%
    - 1080p30, stabilization off: 78%
  • GoPro Hero 960 - 1280x960p25: 70%
  • GoPro HD Hero
    - 1080p30: 95%
    - 720p60: 60% (although another person reported 81-82% earlier)
    - 720p30: 65%
  • GoPro HD Hero2
    - 1080p30, Wide FOV (170°): 83%
    - 1080p30, Medium FOV (127°): 82%
    - 1080p30, Narrow FOV (90°): 88%
    - 720p60: 74%
    - 720p30: 85%
  • GoPro Hero3 Black Edition - 1080p60, Wide FOV: 94% (+/- 2)
  • GoPro Hero3+ Black Edition
    - 1080p60, Wide FOV: 88.89%
    - 1080p60, Narrow FOV: 86.05%
  • GoPro Hero Session 5
    - 1080p30 with internal stabilization on: Internal stabilization does not correct for rotation. Use Deshaker with no rolling shutter to correct for rotation and improve horizontal and vertical stabilization.
  • Hubsan X4 H107C HD 2MP - 720p30: 90.5%
  • iPhone 3GS: 66%
    (Note: Deshaker assumes that the rolling shutter rolls downwards over the frames. For this to happen, the iPhone must record video in landscape mode with the lens in the upper part of the phone. Otherwise you'll probably need to rotate the video before Deshaker, and rotate it back afterwards.)
  • iPhone 4: 97% (+/- 2)
    (Note: Deshaker assumes that the rolling shutter rolls downwards over the frames. For this to happen, the iPhone must record video in landscape mode with the lens in the upper part of the phone. Otherwise you'll probably need to rotate the video before Deshaker, and rotate it back afterwards.)
  • iPhone 5
    - 1080p30: 82.1% (+/- 0.1)
    - 1080p24: 65.8% (+/- 0.1)
    - 1080p30, stabilization off (3rd party app): 89.6% (+/- 0.1)
    - 480p30 (3rd party app): 67.8% (+/- 0.2)
    (Note: Deshaker assumes that the rolling shutter rolls downwards over the frames. For this to happen, the iPhone must record video in landscape mode with the lens in the upper part of the phone. Otherwise you'll probably need to rotate the video before Deshaker, and rotate it back afterwards.)
    (Note 2: The stock camera app automatically chooses between 30 fps and 24 fps modes based on lighting conditions, thus it might be necessary to cut the video where the fps changes and process the parts individually.)
  • iPod touch 4G
    - 720p30 (day mode): 98%
    - 720p24 (night mode): 100%
  • JVC GZ-HM30 - 720p30: 45%-50%
  • Kodak PlayTouch - 1080p30 (with stabilizer turned on): 73.5% (+/- 1.5)
  • Kodak Zi8: Somewhere between 80% - 100%
  • Mobius M800 (Firmware v. 2.25, Wide Dynamic Range = On)
    - 1080p30, narrow: 90%
    - 1080p30, wide: 95%
    - 1080p25, narrow: 84%
    - 1080p25, wide: 90%
    - 1080p10, narrow: 24%
    - 720p30, narrow: 62%
    - 720p30, wide: 98%
    - 720p25, narrow: 56%
    - 720p25, wide: 96%
    - 720p10, narrow: 22%
    (Note: The camera seems to create duplicate frames under certain conditions, such as when recording at higher framerates (50 or 60 fps) and high resolutions. Deshaker can't handle such video correctly unless you remove the duplicate frames first.)
    (Note 2: The owner who reported these measurements recommends others to do additional testing, as he got some inconsistent results.)
  • Motorola Defy - 848x480 widescreen: 52%
  • Nexus 4 - 1080p: 76.9%
  • Nikon 1 J1
    - 1080i59.94: 80%
    - 1080p29.97: 47%
    - 720p59.94: 92%
  • Nikon Coolpix AW110 - 1080p30: 70%
  • Nikon Coolpix P510
    - 1080p30: 82%
    - 720p60: 63%
    - 720p30: 82%
    - "iFrame": 82%
    - 480p120: 41%
  • Nikon D5100 - 720p29.97: 52.6%
  • Nikon D7000: 40%
  • Nikon D600
    - 1080p30, FX mode (full frame): 64.1%
    - 720p60, FX mode (full frame): 76.3%
    - 720p30, FX mode (full frame): 65.7%
  • Nikon D800 - 1080p25: 23.0%
  • Nokia N8-00 - 720p25: One guy reported 60% (+/- 1) using unknown app in August 2011, and one reported 80% (+/- 1) using SymDVR in March 2013.
  • Olympus E-PL1 - 720p30: 59%
  • Olympus E-PM2
    - stabilization on: 38%
    - stabilization off: 47%
  • Olympus SP-720UZ - 1080p30: 91%
  • Oregon Scientific ATC5K: 100%
  • Panasonic AG-UX180 (and probably HC-X1 too)
    - 3840x2160p60: 79.7%
    - 3840x2160p50: 76.0%
    - 4096x2160p24: 34.0%
  • Panasonic G5
    - 1080p50: 68%
    - 1080i50: 68%
    - 1080p25: 34%
    - 720p50: 68%
  • Panasonic GH1 - 1080p24: 66%
  • Panasonic GH2
    - FHD 1080i60: 91.9%
    - FHD 1080i50: 75.0%
    - FHD Cinema 1080p24: 63.9%
    - SD 720p60: 92.3%
    - SD 720p50: 78.4%
  • Panasonic GH3
    - 1080p50 (50Mbps, MOV): 78%
    - 1080p25 (72Mbps and 50Mbps, MOV): 39%
    - 1080p24 (72Mbps, MOV): 38%
    - 1080p25 with Extra Tele Conversion (72Mbps and 50Mbps, MOV): 75%
    - 1080p24 with Extra Tele Conversion (72Mbps, MOV): 72%
  • Panasonic GH4
    - 2160p30 (100Mbps, MOV): 66%
    - 1080p96 (100Mbps, MOV): 90%
    - 1080p60 (100Mbps, MOV): 83%
    - 1080p60 with Extra Tele Conversion (100Mbps, MOV): 67%
    - 1080p50 (100Mbps, MOV): 68%
  • Panasonic HC-V100 - 1080i50: 82%
  • Panasonic HC-V770
    - 1080p50 (50Mbps): 84.6% (+/- 0.2)
    - 1080p100 (filmed at 100fps 56Mbps, stored as 50fps 28Mbps): 82.2% (+/- 0.2)
  • Panasonic HC-X900M - 1080p50: 73%
  • Panasonic HDC-SD300 EG-K: 73%
  • Panasonic HDC-SD900 EG-K - 1080p50: 80.0% (+/- 1.0)
  • Panasonic HDC-TM700 - 1080p60: 91%
  • Panasonic Lumix DMC-GX80/85 - 1080p50, no stabilization: 66% (+/- 2)
  • Panasonic Lumix DMC-ZS100 - 3840x2160p30: 47% (+/- 1)
  • Parrot AR.Drone 2.0: 70%
  • Pentax K-7
    - 1536x1024p30: -96%
    - 720p30: -70%
  • Praktica DVC 5.4 HDMI - 1080p30: 100%
  • Replay XD1080
    - 1080p30: 89% (+/- 1)
    - 720p60: 97% (+/- 3)
  • Samsung Galaxy S2 (GT-I9100)
    - 1080p, superfine: 63%
    - 720p, superfine: 86%
  • Samsung Galaxy S3 - 1080p30: 90% (+/- 1) (fine details, steady disabled, held horizontally with home button to the right)
  • Samsung Galaxy S4 Mini (Note: If the video isn't rotated correctly, run Deshaker before turning the video upright.)
    - 1080p30, normal (back) camera: 63%
    - 720p30, front (selfie) camera: 68%
  • Samsung SPH-A920: 29% (at zoom factor 1x)
  • Sanyo CG100 - 720p59.94: 73.3%
  • Sanyo HD2000 (Note: Available light may possibly affect RS amount on the HD2000.)
    - Full HR: 22%
    - Full HD: 50%
    - Full SHQ: 44%
    - HD SHQ: 48%
    - TV SHQ: 37%
  • Sanyo Xacti HD1010
    - 1080p30: 28%
    - 720p60: 48%
  • Sony DSC-HX9V - 1080p50: 82%
  • Sony DSC-WX200 - 1080i50: Around 70%
  • Sony HDR-AS100: Quote from an owner: "1080/30P and 1080/60P: I recommend using the camera's internal image stabilization and then following it up with Deshaker with no rolling shutter correction. The internal image stabilization corrects for the camera's rolling shutter and the geometric distortions from the fisheye lens, but when pushed hard, leaves small shakes."
  • Sony HDR-FX7: 86.4% (+/- 2.0)
  • Sony HDR-HC1: 88%
  • Sony HDR-HC1E: 88%
  • Sony HDR-V1U: 86.4% (+/- 2.0)
  • Sony HVR-A1E: 82%
  • Sony HVR-Z5
    - 1080p25: 43.3%
    - 1080i50: 88.1%
  • Sony NEX-3 - 720p30: appr. 52%
  • Sony NEX-5N
    - 1080p50: 73.6%
    - 1080p25: 73.2%
    - 1080i50: 81.0%
  • Sony NEX-7 - 1080p50: 86%
  • Sony NEX-VG20
    - 1080p25: 77.6%
    - 1080i50: 70.1%
  • Sony PMW-EX3 - 1080p25: 41% (+/- 2)
  • Sony TX100V - 1080p50: 59%
  • Toshiba Camileo P30 (Note: Amount of optical zoom is reported to influence the RS amount. I have no explanation for this. The low value is for no zoom, and the high value is for full optical zoom.)
    - 1080p30: 84.4% - 95.2%
    - 720p30: 77.6% - 82.2%
    - 848x480p60: 80.0% - 85.7%
  • World Tech Toys Striker 2.4GHz 4.5CH RC Spy Drone: 85.4%
  • Xiaomi Yi
    - 1296p30: 47%
    - 1080p48: 60%

Note: If you set the camera to use digital zoom (or "intelligent zoom" etc.), so that is doesn't use its whole sensor, the rolling shutter amount will usually decrease by the same factor as the zoom. For example, the Panasonic HDC-SD900 has 12x optical zoom, but it has an option to extend that to 20x, using "intelligent zoom". This means that the rolling shutter amount at 20x zoom will be 80% / (20 / 12) = 48%. (The range 1x - 12x will have a constant RS amount of 80%, however.)
Note, though, that this rule doesn't seem to be true when the sensor samples more pixels per area unit when zooming digitally. Panasonic GH3's ETC mode is an example of this.

You cannot use the deep analysis algorithm with rolling shutter video.

Log file

The name of the log file to write in pass 1 and read in pass 2.

Use color mask

If checked, Deshaker will treat all pixels having the selected color in the following way:
In pass 1, the pixels will be ignored so that they don't interfere with the matching process.
In pass 2, if you have also enabled Previous and future frames to fill in borders and Extrapolate colors into border, the pixels will get their color from other frames or from pixels around the masked area, in the same way borders are filled.
This feature can be used to get rid of timestamps, logos and similar, that would otherwise move around annoyingly in the stabilized video. (Don't expect miracles, though.)
It can also be used to simply ignore certain areas during pass 1, to help with the matching. (This is exactly what the Ignore pixels settings do, but with masking you have more flexibility.)
Note that the color must match exactly, so you'd better add the mask to the video in RGB colorspace. VirtualDub's Fill filter works fine for adding the mask, and will let you place it in a user friendly way.

Append to file

If checked, Deshaker appends to the log file instead of overwriting it. This is useful if you want to process certain frames again.

Setting (pass 1)

Description

Video output

What kind of output to generate during pass 1. If you select Motion vectors you will see the previous frame with arrows, or vectors, showing how to move the blocks to match the current source frame. Only white vectors are used to calculate panning, rotation and zoom factor. For interlaced video both of the fields are shown, the first field above the last. There are also two additional options that extend the length of the vectors by a multiple of 2 or 5, which can make it easier to see their direction.

Block size

The width and height of the blocks used during the image matching.

Scale

The maximum scale to do the image matching on. Full is best but very slow.

Use pixels

How many pixels in the blocks to actually use when matching. All is best but very slow.

Initial search range

In the most reduced scale this percentage gives the maximum shift while matching. Lower = slightly faster.

Differential search range

When going from a reduced scale to twice the size, the filter already has approximate shifts. The differential search range is how many pixels up, down, left and right from these approximate shifts to look when matching. Lower values make processing a lot faster but when objects move quickly over the frames, or if you have very fast/big rotations and/or zooms, matching can fail for some blocks.

Detect rotation/zoom

If Deshaker has problems finding a stable background to match on, and you know there is no notable rotation/zoom in the problematic frames, you can turn off detection of rotation and/or zoom (individually) for these frames (or the entire clip). This will make Deshaker assume there is no rotation/zoom and therefore not accept groups of motion vectors that indicate rotation/zoom. And this should make it easier for Deshaker to find the background. But as I said, there mustn't be any rotation/zoom in the analyzed frames for this to work. In fact, there might be problems even when the camera is moving forward quickly, because it looks rather similar to zooming.

Discard motion of blocks that have maximum pixel value difference less than X

Video usually contains some noise, even if you can't always see it. And because of temporal smoothing and/or video compression, within the camera or elsewhere, this noise often has a tendency to look very similar between two consecutive frames. And if a block of pixels doesn't have any real features that can be matched on, Deshaker may happily match on this similar looking noise instead. To avoid this, you can use this setting to ignore blocks that don't contain a lot of color variation. The optimal value can vary with amount of gain used when filming, and between different cameras. If you see zero-length motion vectors (appearing as dots) in clear areas like the sky, you probably need to increase this value.
Blocks that have been discarded by this setting show no motion vector in the output video of pass 1.

Discard motion of blocks that have match value less than X

If the best match value found while matching a certain block is below X this block is discarded.
Blocks that have been discarded by this setting show no motion vector in the output video of pass 1.

Discard motion of blocks that have 2nd best match larger than best minus X

If the second best match value found while matching a certain block is close to the best match value, this means that the best shift found isn't very reliable. It could just as well be this second shift that's the correct one. For example a blue sky has good match values for all shifts. Setting this parameter correctly discards those unreliable blocks.
Blocks that have been discarded by this setting show no motion vector in the output video of pass 1.

Discard motion of blocks that move more than X pixels in wrong direction

When calculating the best values for panning, rotation and zoom based on all motion vectors, the filter soon discovers that some blocks have motion that don't quite fit in with the "main motion". If a block has a motion vector that is more than X pixels off this main motion it is discarded in order to get more precise values. The motion vectors for these blocks are drawn in red in the output video of pass 1 and are not used in any way. Since the panning, rotation and zoom are all done in only 2 dimensions, it's possible to get a lot of these blocks that don't seem to fit in with the main motion when the effect of perspective gets big. This happens when the camera is set to wideangle and not just rotating (along any axis), but actually moving. Here you should use high X values (or maybe limit the matching area to the most distant parts). When zoomed in a lot or when the camera is stationary, the perspective effect is low and you should use low X values (even 1 or lower) to discard motion of objects moving even very slightly.

Discard motion of blocks that move more than X pixels (absolute motion)

Simply discards all blocks that have a motion vector that is longer than X pixels. Might be useful in some cases.

Remember discarded areas to next frame

When enabled, this feature makes Deshaker try to ignore approximately the same areas from one frame to the next. Deshaker will then become a lot more successful in ignoring moving objects. As long as they enter the scene rather slowly (by not covering too much of the background), Deshaker will usually be able to ignore those objects even if they eventually grow to cover most of the frame.

If you want Deshaker to forget the remembered discarded blocks for current frame (and start fresh), you can just click this setting twice.

Deep analysis if less than X percent of vectors are ok

When set to 0% (which is the default value) this does nothing. To enable it, set it to 25% or something. Then, if less than 25% of the found vectors get white using the standard algorithm, this deep analysis algorithm kicks in. It does a much better job finding an object to lock on where the standard algorithm can be confused and lock on two separate objects at the same time, usually resulting very few white vectors and weird values. Use this in combination with the discard setting above to control how much the vectors in the object you want to lock on (usually the background) may vary. For example, the blocks on a moving person usually don't move "coherently" as the background usually does (if the camcorder is stationary). So by using a low value for the discard setting above (maybe < 1) the person would probably get very few white vectors and this algorithm would therefore hopefully lock on the background instead, even if it's a rather small part of the frame. This algorithm is very good, but also VERY slow (depending on other settings and how complicated the video is).

New since version 3.0 is that deep analysis will only be used whenever we're ignoring remembered areas from previous frame, either because remembering is disabled, or because we get way too few ok blocks using the standard algorithm. The reason for this new behaviour is that the deep analysis always finds the panning, rotation and zoom that results in the most white vectors, but this is not always good, because this can mean that the white vectors suddenly jump to a new object/area, which can cause a sudden jump in the video.

You cannot use the deep analysis algorithm with rolling shutter video.

Skip frame if less than X percent of all blocks are ok

If less than X percent of all blocks are ok in a frame (i.e. the rest of the blocks either have no acceptable match or have been discarded), this frame will be skipped, meaning Deshaker will make no attempt to stabilize it in pass 2. Skipped frames will be marked with the keyword "skipped" in the log file.

You can see the percentage of ok blocks below the output frame during pass 1.

Detect scenes

If this setting is enabled, Deshaker will compare the scene detect threshold entered here to a scene detection value that is calculated for each frame, and mark frames that are above this threshold with the keywork "n_scene" in the log file. This allows pass 2 to make sure smoothing and borders etc. aren't applied across scene changes. The scene detection value can vary between 0 - 1000 and is shown below the output frame during pass 1.

Only frames that are skipped due to too few ok blocks are candidates to become new scenes.

A completely blank frame is also considered the beginning of a new scene. These frames are marked with the keyword "blank" in the log file (in addition to "n_scene").

Ignore pixels outside area

Only area is used during matching. If you check Let area follow motion, the area will move along with the motion vectors between different frames. You can use it if you want to stabilize on a moving object instead of the background. Just don't expect this to work perfectly :)

Ignore pixels inside area

area is not used during matching.

Setting (pass 2)

Description

Same destination properties as source

If checked, the destination video will get the same size and pixel aspect ratio as the source and the two settings below will be ignored.

Destination pixel aspect

Tells the filter to generate video with a certain pixel aspect ratio. If you plan to watch the clip on a computer monitor you'll probably want to use square pixels. You may enter any value if you can't find the preset you're looking for.

Destination video size

The size of the output video you want from pass 2.

Generate "interlaced progressive" video

Usually, Deshaker will generate video with the same video type (interlaced/progressive) as the source video. But if you enable this setting, it can turn interlaced video into progressive video with twice the framerate. Earlier versions of VirtualDub didn't allow for filters to change the frame rate, so the two progressive frames are interlaced into the same output frame. In order to get the true progressive video, you must separate the fields of this video afterwards. In later versions of VirtualDub you can do that by adding a Bob doubler filter after Deshaker, using the deinterlacing method None - alternate fields. You could also do it with AVISynth and its SeparateFields function (and a preceeding ComplementParity for "upper field first" video). You should never deinterlace this video in any other way than to simply separate the fields.

The difference between true interlaced output and this interlaced progressive output is that the video becomes twice as high (in order to fit two frames into one) and more importantly that the lower field (or rather "frame" in this case) isn't calculated with a one line offset as in interlaced video.

Resampling

The algorithm to use when calculating pixel colors from the source frame to the destination frame.
As long as the size of the destination video is larger than, or pretty much equal to, the size of the source video, the bicubic resampling here is as good as any resampler you will find. (Don't believe the hype of other resampling algorithms. The difference is in fact extremely small.)
However, when the destination size is a lot smaller than the source (smaller than appr. half the size of the source maybe), you may get better results if you add a separate high quality resizer (such as "precise bicubic" in VirtualDub) after Deshaker.

Edge compensation

A side-effect from stabilizing video is black or strange looking borders caused by moving the image around to compensate the shaking. To reduce or eliminate this effect you can zoom into the image. The following options do this in different ways:

  • None: No zoom is added.
  • Adaptive zoom average: Determines, for each frame, how much zoom is needed to avoid borders. This amount of zoom is then smoothed so the borders still become visible sometimes.
  • Adaptive zoom full: Same as Adaptive zoom average, but this option will add more zoom when needed, to completely eliminate any borders.
  • Fixed zoom: Deshaker will add a constant zoom to completely eliminate any borders. The zoom is only constant within each scene, however.
  • Adaptive zoom average + fixed zoom: First, Adaptive zoom average will be used. Then, a smaller fixed zoom will be added on top of this to completely eliminate any borders. This will usually result in less zoom than Fixed zoom. But if you want to eliminate borders completely and you can live with some adaptive zooming, the newer option Adaptive zoom full is probably a better choice, since it doesn't add as much zoom in less shaky sections.

Note: If you're using any edge compensation (i.e. anything but None), your can limit the amount of zoom needed to avoid the borders by using lower values for Motion smoothness and especially Max. correction limits.

Adaptive zoom smoothness

If you use one of the adaptive zoom edge compensation options, this setting controls how smooth this zooming will be.

Adaptive zoom amount

If you use one of the adaptive zoom edge compensation options, this setting adjusts the amount (or amplitude) of this zooming. For example, if you set it to 50%, Deshaker will only add half the adaptive zoom as normal, for each frame. (Note that this may obviously cause borders to become visible even when using Adaptive zoom full.)

Previous and future frames to fill in borders

This is a kind of additional edge compensation. When the current frame doesn't contain any image data in the "real world area" we want in our output, it can search in past and future frames and use that image data instead. As long as that area is part of the object (or background) that was stabilized on in pass 1, this usually works perfectly. But when other objects move in these areas, it can look a bit strange. It's usually better than black anyway, so I strongly recommend using this feature. Just make sure you crop any borders from the source clip before Deshaker. Otherwise this won't work very well at all.

If the current frame is number 50, it searches frames in the following order to find the image data it needs: 50, 49, 51, 48, 52, 47, 53, 46, 54 etc. So for each pixel the closest frame (chronologically) is always used. You can set how many frames to store internally for this feature. More is always better but keep in mind that each frame needs up to 8 MB of memory (for full HD) and it can take a long time to search through all frames for image data. (To be able to use more memory, you can either use 64-bit Deshaker, or use the 4GB patch on the 32-bit VirtualDub.exe file.)

Try using this feature on a clip with lots of panning, and zoom out by setting Extra zoom factor to something like 0.6. Then you'll get a panorama like effect. It's slow, but fun. :)

Soft borders

If enabled, all relevant previous and future frames that Deshaker has stored in memory will be used to calculate the border (as opposed to just using the closest frame in time). For each pixel, it takes an average of the corresponding pixels in all these frames, weighted so that the frames closest to the current frame (in time) get higher importance.

This option will also allow you to make the transitions between a frame and the frame(s) beneath it smoother. The transition width value you supply is how far in from the edge of a frame the transition will start. The transition will be applied also to the current frame, so you'll actually lose some information in the edges of the main frame by using this option. But I'd say it's worth it. If you don't like it, just set the transition width to 0.

Enabling Soft borders improves the appearance of the border quite a lot, especially when there are objects moving there, but it is also very slow when there are lots of border pixels.

Extrapolate colors into border

If enabled, any black border pixel that couldn't be fixed in another way, is replaced by a color extrapolated from the edge of the known video pixels. This option is very slow when there are lots of border pixels, and I strongly recommend using Previous and future frames to fill in borders in combination with this option.

Extra zoom factor

An additional zoom factor to apply to the video. This can for example be used together with fixed zoom edge compensation to zoom out just enough for the borders to become slightly visible but still remain hidden in the overscan area of the TV. Then you will see more of the video while still not seeing any borders on the TV. Or you can use it to zoom in slightly to get less borders. This setting won't cause another resampling, so using a little extra zoom to finetune your results is perfectly safe, quality wise. (Btw, all output pixels are always resampled directly from the original source pixels exactly once no matter what settings you use. So, no double resampling ever. This includes areas taken from previous or future frames.)

Motion smoothness

These values determine how smooth the motion will be. You can set a parameter to 0 to turn off the smoothing completely. This can be useful if you don't want to stabilize zoom for example. The motion smoothness calculation is not time-based but rather based on frame count, so you'll probably want to use larger values for video with high number of frames per second. And in this case, the fps for interlaced video will count as twice as high, since each of its frames contains two "sub frames" (fields). If you enter -1 as smoothness you will get "infinite smoothness", meaning the camera will appear to be stationary at the position of the first frame that was processed in pass 1. This feature usually doesn't work perfectly, though.

Max. correction limits

To keep the corrections (that cause the black borders) small during fast pans (for example), you can limit the maximum corrections. Especially when using Fixed zoom as edge compensation these settings keep the zoom from being too large. What these settings really do is automatically lower the motion smoothness values in certain parts of the video when it becomes necessary.

 

Human Guidance

Sometimes it can get nearly impossible to automatically match two successive frames correctly (or rather 'the way you want to'). This usually happens when the frames have very little in common or when there's conflicting motion of large objects. In order to make a complete video clip look perfect, you might want to use different settings during pass 1 for different parts of the clip (or even single frames). You can do this in two ways:

  • You can use the Append to file option to continue writing to the same log file. You can then change the settings, step a few frames, change again, step some more etc. The frame numbers are written to the log file so you can even go back and redo some frames. If a frame exists more than once in the log file, the last one is used in pass 2.
  • You can edit the log file manually. See below for information about the log file format.

 

Log File Format

The log file that is created by pass 1, and that you may edit manually if you like, is a text file with the following tab-separated columns:

Item

Description

Frame number

Frame number of the source video. For interlaced video, the frame number will have an 'A' or 'B' appended, depending on the field.

Pan X

The number of horizontal panning pixels between (the middle line of) the previous frame and current frame.

Pan Y

The number of vertical panning pixels between (the middle line of) the previous frame and current frame.

Rotation

The number of degrees of rotation between (the middle line of) the previous frame and current frame.

Zoom

The zoom factor between (the middle line of) the previous frame and current frame.

Pan X RS

If rolling shutter is enabled, the number of horizontal panning pixels between (the first line of) the previous frame and current frame.

Pan Y RS

If rolling shutter is enabled, the number of vertical panning pixels between (the first line of) the previous frame and current frame.

Rotation RS

If rolling shutter is enabled, the number of degrees of rotation between (the first line of) the previous frame and current frame.

Zoom RS

If rolling shutter is enabled, the zoom factor between (the first line of) the previous frame and current frame.

Skipped

Reserved for the keyword "skipped" for skipped frames.

New scene

Reserved for the keyword "n_scene" for the first frame of a new scene.

Comment start

A comment start character ('#') will be added here by pass 1, because the remaining columns are not used by pass 2. They are only for your information.

Scene detection value

The calculated scene detection value for this frame.

% ok blocks

How many blocks (in percent) that were ok in this frame.

Blank

Reserved for the keywork "blank", which indicates a blank frame.

If a frame number exists more than once in the log file, the last occurence is used by pass 2.

Frame numbers that are missing in the log file, are treated like skipped frames.

Any text from a '#' character to the end of that line is ignored by pass 2.

Pass 2 doesn't require the exact format given above. As long as all required values are there, in correct order, and they are separated by one or more spaces and/or tabs, and any keywords are present somewhere on the line (between the frame number and any '#' character), pass 2 should be able to parse it.

 

Stabilizing Interlaced Video

Deshaker can deshake interlaced video, but the resulting video will look slightly softer than for progressive video since the fields of interlaced video are resampled individually and they only have half the vertical resolution of a progressive frame. The resampled fields are then reinterlaced in the output video. There is really no sense in trying to detect non-moving pixels and keep them "un-deinterlaced" since you wouldn't be deshaking video shot on a tripod anyway, and without a tripod the pixels will almost always move slightly. (Deinterlacing with motion estimation in some way might give a better result but I'll probably not try implementing that anytime soon. And for certain reasons I don't like the idea of it.)

If you want, here's another way to stabilize interlaced video that might look better when some parts of the video are completely non-moving.

  1. Use my smooth deinterlacer (or Xesdeeni's AVISynth port of it, or other advanced deinterlacers) to generate 50 or 60 fps full-sized video.
  2. Feed it into Deshaker as progressive video (in two passes).
  3. Run the resulting video through this little AVISynth script (that I got from Xesdeeni):

AVISource("deshaked.avi")
SeparateFields()
SelectEvery(4, 1, 2)   (or SelectEvery(4, 0, 3) depending on the output field polarity)
Weave()

If you stop after the second step you'll have smooth 50 or 60 fps progressive video that will look great if the media/computer/player/cable/display can handle it.

 

Script Parameters

If you for some reason want to configure Deshaker without using its settings GUI (in a VirtualDub vcf file or an AviSynth avs file, for example), Deshaker takes one single argument; a string with all parameters, separated by '|' characters. (The reason for this is that VirtualDub can't handle too many parameters (or at least it couldn't when I started making Deshaker).)

If you make some settings in VirtualDub and select File/Save processing settings, you'll find the settings string in the vcf file.

The items in this string are:

Item no.

Description

Possible values

Default value

Decimals allowed

1

The version no. of the settings string. (It changes whenever a new Deshaker version is released that uses new settings.)

1 - 19

19

No

2

Selected pass no.

1, 2

1

No

3

Block size

1 - 100

30

No

4

Differential search range

1 - ?

4

No

5

Source pixel aspect value

> 0

1

Yes

6

Source pixel aspect selection.
(This parameter is only used by the GUI. The Source pixel aspect value specifies the actual pixel aspect to use.)

-1: A free source pixel aspect value
0: Square pixels / HD (1:1)
1: Standard PAL (59:54)
2: Standard NTSC (10:11)
3: Anamorphic PAL (118:81)
4: Anamorphic NTSC (40:33)
5: SVCD PAL (59:36)
6: SVCD NTSC (15:11)
7: HDV 1440x1080 (4:3)

0

No

7

Destination pixel aspect value.
(Only used if Same destination properties as source is set to 0.)

> 0

1

Yes

8

Destination pixel aspect selection.
(This parameter is only used by the GUI. The Destination pixel aspect value specifies the actual pixel aspect to use.)

Same as Source pixel aspect selection.

0

No

9

Destination width.
(Only active if parameter Same destination properties as source = 0.)

1 - ?

640

No

10

Destination height.
(Only active if parameter Same destination properties as source = 0.)

1 - ?

480

No

11

Scale

0: Full
1: Half
2: Quarter

1

No

12

Use pixels

1: All
2: Every 4th
3: Every 9th
4: Every 16th

2

No

13

Motion smoothness - horizontal panning

-1 - ?

1000

No

14

Motion smoothness - vertical panning

-1 - ?

1000

No

15

Motion smoothness - rotation

-1 - ?

1000

No

16

Motion smoothness - zoom

-1 - ?

1000

No

17

Discard motion of blocks that move more than X pixels in wrong direction

> 0

4

Yes

18

Video output

0: None
1: Motion vectors
2: Motion vectors, extended 2x
3: Motion vectors, extended 5x

1

No

19

Edge compensation

0: None
1: Adaptive zoom average
3: Fixed zoom
4: Adaptive zoom average + fixed zoom
6: Adaptive zoom full

0

No

20

Resampling

0: Nearest neighbor
1: Bilinear
2: Bicubic

2

No

21

Skip frame if less than X percent of all blocks are ok

0 - 100

8

Yes

22

Initial search range

1 - 99

30

No

23

Discard motion of blocks that have match value less than X

-1000 - 1000

300

Yes

24

Discard motion of blocks that have 2nd best match larger than best minus X

0 - ?

4

Yes

25

Log file

A file path

Depends

n/a

26

Append to file

0: No
1: Yes

0

No

27

Ignore pixels outside.
(Activates the following four parameters if set to 1.)

0: No
1: Yes

0

No

28

Ignore pixels outside - left

Any value

0

No

29

Ignore pixels outside - right

Any value

0

No

30

Ignore pixels outside - top

Any value

0

No

31

Ignore pixels outside - bottom

Any value

0

No

32

Ignore pixels inside.
(Activates the following four parameters if set to 1.)

0: No
1: Yes

0

No

33

Ignore pixels inside - left

Any value

0

No

34

Ignore pixels inside - right

Any value

0

No

35

Ignore pixels inside - top

Any value

0

No

36

Ignore pixels inside - bottom

Any value

0

No

37

Video type - interlaced

0: No
1: Yes

0

No

38

Video type - upper field first.
(Only used if Video type - interlaced is set to 1.)

0: No
1: Yes

0

No

39

Extra zoom factor

> 0

1

Yes

40

Max. correction limits - horizontal panning

1 - ?

15

Yes

41

Max. correction limits - vertical panning

1 - ?

15

Yes

42

Max. correction limits - rotation

1 - ?

5

Yes

43

Max. correction limits - zoom

1 - ?

15

Yes

44

Use previous and future frames to fill in borders - previous frames enabled

0: No
1: Yes

0

No

45

Use previous and future frames to fill in borders - future frames enabled

0: No
1: Yes

0

No

46

Use previous and future frames to fill in borders - previous frames.
(Only used if previous frames are enabled.)

0 - ?

30

No

47

Use previous and future frames to fill in borders - future frames.
(Only used if future frames are enabled.)

0 - ?

30

No

48

Ignore pixels outside - let area follow motion

0: No
1: Yes

0

No

49

Deep analysis if less than X percent of vectors are ok.
(Only used if Camcorder has a rolling shutter is set to 0.)

0 - 100

0

No

50

Camcorder has a rolling shutter

0: No
1: Yes

0

No

51

Generate "interlaced progressive" video.
(Only valid for interlaced video.)

0: No
1: Yes

0

No

52

Same destination properties as source

0: No
1: Yes

1

No

53

Soft borders.
(Only valid if using previous and future frames to fill in border.)

0: No
1: Yes

0

No

54

Extrapolate colors into border

0: No
1: Yes

0

No

55

Soft borders - edge transition width.
(Only valid if using Soft borders.)

0 - ?

10

No

56

Discard motion of blocks that move more than X pixels (absolute motion)

> 0

1000

Yes

57

Remember discarded areas to next frame

0: No
1: Yes

1

No

58

Rolling shutter amount.
(Only used if Camcorder has a rolling shutter is set to 1.)

Any value

88

Yes

59

Detect rotation

0: No
1: Yes

1

No

60

Detect zoom

0: No
1: Yes

1

No

61

Detect scenes - threshold.
(Only used if Detect scenes is set to 1.)

0 - 1000

20

Yes

62

Adaptive zoom smoothness.
(Only used if Edge compensation is set to 1, 4 or 6.)

> 0

5000

Yes

63

Adaptive zoom amount.
(Only used if Edge compensation is set to 1, 4 or 6.)

Any value

100

Yes

64

Discard motion of blocks that have maximum pixel value difference less than X

0 - 255

20

No

65

Detect scenes

0: No
1: Yes

1

No

66

Use color mask

0: No
1: Yes

0

No

67

Mask color in hex RRGGBB (e.g. black is 0, blue is ff, red is ff0000, grey is 808080)

0 - ffffff

ff00ff

No

 

Frequently Asked Questions

- It just doesn't work.

Please start by carefully following The Short Guide above. Also, make sure you're using 32-bit Deshaker for 32-bit VirtualDub, or 64-bit Deshaker for 64-bit VirtualDub. If it still won't work, feel free to email me. Try to explain what you do, and what happens, as precisely as possible.

- Deshaker slows down a lot, or even crashes, after processing for a while.

As of May 2014, I've had reports of Deshaker doing this if Bitdefender is installed. The problems should go away if you put Bitdefender into manual mode and turn off various features, or if you simply uninstall it.

- The output video has tiny dots and lines all over it.

You need to run pass 2 too. And use the original video (not any video from pass 1) for pass 2. Please follow The Short Guide above carefully.

- There are black borders in the stabilized video.

You can fix that with either one (or more) of the settings: Edge compensation, Previous and future frames to fill in borders and Extrapolate colors into border.

- The stabilized video is very shaky (no improvement at all in at least some parts).

If too few blocks are ok in a frame during pass 1, that frame will be skipped completely (and will show an orange or red text field below the video during pass 1). This means Deshaker will make no attempt to stabilize it in pass 2. Either make sure you get more motion vectors, for example by changing the Discard motion... settings, or try lowering the Skip frame if less than X percent of all blocks are ok setting to avoid skipping even if few blocks are ok. The latter option might not always be a good idea, though.

Also, you should be aware that not all video decoders are frame accurate, which means that a certain frame might get a different frame number in each Deshaker pass, which means that completely wrong compensations will be made to the frames. (For H.264/AVC video, using DGAVCDec from AviSynth is always frame accurate in my experience.)

- The stabilized video is a bit shaky (but improved).

For best results, always try to make sure the white vectors end up on the background in the frames during pass 1, i.e. try to make Deshaker completely ignore objects moving in front of the background. If the white vectors jump around between different objects from frame to frame, you need to do something to get a good result. Either use the Ignore area settings or something else. There are many things you can do. Experiment with the settings!

If the background consists of several layers at different distances, or if there is basically no visible background at all, it's often best to stabilize on pretty much everything except the fastest moving objects. To do that, increase the value of Discard motion of blocks that move more than X pixels in wrong direction.

As a last resort, you can make Deshaker skip the problematic frames by either increasing the threshold for skipping frames, or by deleting the corresponding lines from the log file.

- I get zero-length motion vectors (appearing as dots) in clear areas, such as in the sky, or on a wall.

Try increasing the value for Discard motion of blocks that have maximum pixel value difference less than X.

- The stabilized video has a severe "jello" effect. Also, far from all vectors are white even on a solid background during pass 1, when the video shakes a bit.

Make sure you have enabled the rolling shutter setting if your camera has a rolling shutter. (Most cameras today have a rolling shutter.)

- I have enabled the rolling shutter setting but Deshaker still won't remove the rolling shutter distortions.

Deshaker can only remove rolling shutter distortions linearly. If you have one of those compact CMOS cameras with bad (or no) internal stabilization, and the clip has very fast shakes (for example if the camera is mounted on a bike or similar), you probably won't be able to get a very good result from Deshaker, since the distortions will be far from linear in this case. Get a CCD camera capable of high shutter speeds for these kind of videos.

- I get a slight waving effect when objects move slightly, even when the camera is completely still.

Try decreasing the value for Discard motion of blocks that move more than X pixels in wrong direction.

- I get a slight waving effect and distorted geometry when the camera shakes a lot.

If you're filming with a rather wide angle (or a fisheye lens), this effect is probably due to some geometrical properties of perspective, that Deshaker unfortunately doesn't deal with. The only things you can do to make it better is to shake less during filming, and/or add some zoom, either during filming or in Deshaker. Lowering the motion smoothness values for horizontal and vertical panning can help too. Finally, using the "Ignore pixels outside area" setting to ignore the outer (most "distorted") parts of the video during pass 1 might also help a bit.

- I get some blurring/shimmering in frames where the camera shakes the most.

What you see is probably motion blur, i.e. motion occuring within a frame. This is present in the source video too, but it doesn't become distracting until Deshaker has removed the motion between the frames. To get rid of this effect you need to use a faster shutter speed while filming. How fast it needs to be depends on the camera and the amount of shake. For a camera with built-in stabilizer, I'd recommend at least 1/200 sec, or so. (Faster if it doesn't have built-in stabilizer.)

- I get sudden jumps in zoom, or other jumps.

Deshaker probably had problems matching a frame to the previous one during pass 1. Always try to avoid getting white vectors on moving objects, and make sure you have enough white vectors on the background, spread over the whole frame (ideally). Having Detect zoom and/or Detect rotation unchecked during problematic frames can often help Deshaker find the correct motion (but that will obviously disable zoom/rotation stabilization for those frames). Zoom jumps can also be avoided by settings zoom motion smoothness to 0.

Also, make sure Deshaker didn't incorrectly detect new scenes during pass 1.

- I get unwanted zooming in the stabilized video.

Deshaker can add two types of zoom. One is for stabilizing zooming that it detects in the video. If this detected zooming isn't really camera zoom (for example, Deshaker usually detects zoom if the camera moves forward), or if you just don't want the camera zoom stabilized, you can turn it off by setting the zoom motion smoothness to 0. It's always a good idea to do this if there's no real zooming in the video.

The other kind of zoom that Deshaker can add is adaptive zoom. If you don't like it, choose another Edge compensation option.

- The output video says "This frame was not processed in pass 1", even though I did run pass 1.

Unless the Append to file option is enabled, the log file will be emptied as soon as you start processing in pass 1, even if you just happened to process one frame. Make sure this is not the case. Also, make sure you have write access to the log file location. In either case, try opening the log file from pass 1 in notepad and maybe you can figure out what happened.

- I want to be able to save my Deshaker settings.

Save processing settings in VirtualDub will save everything, including Deshaker settings. There is no way to save only the Deshaker settings.

- Can I try different pass 2 settings without running pass 1 again?

Yes.

- Deshaker says "Deshaking..." for a very long time.

Certain settings will make the deshaking procedure a lot more time consuming. Especially low values for Max. correction limits and using Adaptive zoom full.

- I get problems, such as frozen frames at the end of the output video, when using future frames to fill in borders.

If you have filters placed before Deshaker in the filter chain, try removing them or placing them after Deshaker. For some reason, certain filters may cause problems when placed before Deshaker and the Future frames setting is bigger than 0. I haven't investigated this problem yet.

- How about porting Deshaker to Mac or Linux or...?

I'm afraid I doubt that will happen.

- My question/problem isn't listed in the FAQ.

Feel free to email me.

 

Version History

Version 3.1 (2014-09-14)

  • The process to calculate the smooth motion at the beginning of pass 2 (when it says "Deshaking...") now runs faster in many cases. The detected scenes are now processed individually and in parallel, and Adaptive zoom full is faster even if you just have a single scene.
  • Adaptive zoom full now often manages to zoom in slightly less than before.
  • You can now set a mask color that will make pass 1 ignore the masked area, and make pass 2 fill the area in the same way borders are filled. Read more under the 'Use color mask' setting above.
  • Soft borders are now enabled by default if Previous and future frames to fill in borders is enabled (because it generally looks better).
  • Changed the pixel aspect ratio presets slightly (again). Now, I've settled for the ratios that most people seem to agree on; 59/54 for PAL and 10/11 for NTSC.
  • The ranges of some settings have been extended. Destination width/height: 1 - 1000000, Motion smoothness: -1 - 1000000, Adaptive zoom smoothness: 0.1 - 1000000, Max. correction limits: 0.0001 - 1000.
  • The settings Discard motion of blocks that have match value less than X and Discard motion of blocks that have 2nd best match larger than best minus X now allow decimals.
  • The size of the info text in the output video during pass 1 now increases with the height of the video (once it gets high enough).
  • Other minor changes and fixes.

Version 3.0 (2011-08-14)
(64-bit version was released 2012-11-18)

  • Added better detection of new scenes. Previously, you would get a new scene whenever a frame got skipped due to too few ok blocks. Read more under the 'Detect scenes' setting above. For skipped frames that are not new scenes, Deshaker will interpolate motion values in pass 2.
  • Default percentage for skipping frames was increased from 5% to 8% because Deshaker now handles skipped frames better.
  • Skipped frames will now be marked "skipped" in the logfile, and such lines won't have any values anymore. Missing frames in the logfile will also be treated like they are skipped, but they will not become new scenes as before.
  • Default value for initial search range was decreased from 40% to 30%, because an unnecessarily high value can have a slightly negative impact on the new scene detector, and 40% is way more than you need for most videos.
  • The option to do the matching in pass 1 in grayscale mode was removed because of the new scene detector.
  • Removed the option to discard dark pixels and replaced it with a better way to ignore noise. Read more under the 'Discard motion of blocks that have maximum pixel value difference less than X' setting above.
  • Smoothness for zoom stabilization and adaptive zoom are now controlled separately, so the usual zoom smoothness setting now controls only stabilization of zooming in the clip. As for controlling adaptive zoom smoothness, read more under the 'Adaptive zoom smoothness' setting above.
  • Adaptive zoom now uses a new smoothing algorithm, so it will look slightly different (better?). Its smoothness values are only approximately comparable to before in how smooth it gets.
  • Added a setting for controlling the amount (amplitude) of adaptive zoom, in percent. Read more under the 'Adaptive zoom amount' setting above.
  • Added a new edge compensation option Adaptive zoom full, which is similar to the usual Adaptive zoom, except that this one will remove borders completely (if adaptive zoom amount is 100%). Kind of like Adaptive+fixed, but doesn't add as much zoom in less shaky sections. Read more under the 'Edge compensation' setting above.
  • The original Adaptive zoom option changed name to Adaptive zoom average.
  • Removed the somewhat confusing edge compensation options Adaptive zoom only and Adaptive+fixed only. You can now get the same effect by using another adaptive zoom option and setting the zoom motion smoothness to 0. (When loading old settings files which used these removed options, Deshaker will automatically choose settings that work similarly as before.)
  • All edge compensation options (except None) now checks for rolling shutter distortions too. (Those distortions usually require some extra slight zoom to completely get rid of borders.)
  • Zoom stabilization and adaptive zoom no longer spill over scene changes. Previously, that would happen when edge compensation was used.
  • Made a tiny adjustment to amount of adaptive zoom, to make zoom factor exactly 1 for a still video sequence, to avoid degrading the quality due to resampling in such cases.
  • The very last frame (and any frame that has a skipped frame after it) of a rolling shutter video clip will now be compensated for rolling shutter distortion too, but a little less accurately. Previously, no compensation was made for those single frames.
  • Added two video output modes for pass 1, which make the motion vectors longer, by 2x or 5x. Read more under the 'Video output' setting above.
  • Added buttons in the configuration dialog to open or delete the current log file, and also to open the current log file folder. (Deleting the log file can be useful if you use the Append to file option, but want to get rid of old garbage (prior to running pass 1) that may otherwise influence the stabilization.)
  • Deshaker now uses less memory during pass 1 (which should allow for processing larger images/frames).
  • Deshaker will now try a little harder (but not too hard) to keep tracking the same object(s) if Remember discarded areas to next frame is enabled, even when frames become skipped due to too few ok blocks.
  • Added a somewhat hidden feature to make Deshaker forget the remembered discarded areas for current frame if you click once (or twice) on the Remember discarded areas to next frame checkbox.
  • While the Deep analysis algorithm is pretty good, it does ignore any remembered discarded areas from previous frame, which is usually bad. So now, Deep analysis will only be used whenever we're ignoring remembered areas from previous frame, either because remembering is disabled, or because we get way too few ok blocks.
  • The log file now looks somewhat different (although pass 2 can still read the old format). Each tabbed column is now reserved for a single thing. And a scene detection value and percent ok blocks are now written to the log file, after the comment character "#". And the "new_scene" keyword is now called "n_scene" (to make the log file look nice in notepad :)
  • Improved error handling.
  • Other minor changes and fixes.
  • Added an FAQ to this page.

Version 2.7 (2011-01-30)

  • In version 2.5, I changed the way the size of the initial block was calculated, to make it more consistent. As a side effect, this meant that for certain settings (such as the default ones) and certain video sizes (such as interlaced 720x576 and interlaced 720x480), pass 1 would run a lot slower than before. After some testing, I have now made another adjustment to this initial block size to speed things up. If you feel that this version is less reliable than versions 2.5 and 2.6, please let me know.

Version 2.6 (2011-01-08)

  • Fixed a bug that could cause a crash under some circumstances, such as sometimes when using prefilter cropping in VirtualDub.
  • Ignored areas are no longer completely black.
  • Fixed a bug that didn't let you change the ignored area (easily) when using the option Let area follow motion on progressive video.

Version 2.5 (2010-07-18)

  • When using future frames to fill in borders, you no longer need to manually pre-collect frames and delay the audio etc. Everything is now taken care of automatically, mostly by VirtualDub. This doesn't work for very old versions of VirtualDub, though. In fact, I strongly recommend version 1.9.9 or later.
  • You can now turn off detection of rotation and/or zoom during pass 1. Read more under the 'Detect rotation/zoom' setting above.
  • When the setting Remember discarded areas to next frame is enabled, the discarded areas are now remembered for all processed frames, so that when you want to reprocess some frames with other settings during pass 1, Deshaker will know which blocks were discarded in the frame prior to the frame you're starting reprocessing at. This only works as long as the total number of blocks (horizontally and vertically) don't change, which can happen if you, for example, change the block size.
  • The default edge compensation type was changed from Adaptive zoom to the more basic None, since I want you to decide for yourself if and how the borders should be taken care of. Also, the default smoothness values were changed from 400 (1500 for zoom) to 1000.
  • The C++ and MFC libraries are now linked statically. (This means you shouldn't need to install the C++ Redistribution Package any longer.)
  • Other smaller changes and bugfixes. For example, I fixed a bug which caused Deshaker to sometimes ignore large areas during pass 1 for certain (unusual) settings.

Version 2.4 (2008-11-15)

  • Added two new edge compensation zoom options; adaptive+fixed and adaptive+fixed only. Read more under the 'Edge compensation' setting above.
  • The constant zoom that is added for the fixed zoom edge compensation options is now constant only for each scene in a clip. It used to be constant for the entire clip.
  • If you have a rolling shutter camcorder, you can now specify how severe this effect is for your camcorder model. Read more under the 'Camcorder has a rolling shutter' setting above.
  • The default location of the log file has been changed (due to write access limitations).

Version 2.2 (2007-05-21)

  • The most time consuming parts of Deshaker are now multi-threaded, which allows for significantly faster processing on systems with more than one cpu.
  • Added an option to help ignoring large moving objects during matching. Read more under the 'Remember discarded areas to next frame' setting above. This new option is enabled by default (but not if you load old settings files).
  • Added an option to ignore motion vectors that are simply too long. Read more under the 'Discard motion of blocks that move more than X pixels (absolute motion)' setting above.
  • Improved handling of new scenes. When matching fails for a certain frame, the word 'new_scene' is written to the logfile, which allows pass 2 to take appropriate action.
  • Fixed a bug where some settings would change by themselves under some circumstances.
  • Fixed a bug that was introduced in version 2.0 where the borders would always look a bit bad if you used previous and future frames to fill in the border but didn't enable soft borders.

Version 2.0 (2006-08-12)

  • Renamed the feature for improved border appearance that was added in version 1.9 to "Soft borders" and improved it by allowing soft edge transitions between frames in the border, which greatly reduces any sharp ugly edges there. Read more under the 'Soft borders' setting above.
  • Added an option to ignore dark pixels during matching.
  • Deshaker should no longer crash when being used from AviSynth. But no motion vectors or info texts will be shown in the video due to a limitation in AviSynth.
  • The info text in the output video during pass 1 now includes the percentage of ok blocks and whether or not deep analysis was used for the frame.
  • The text of the deep analysis option was changed from 'Deep analysis if > X % of blocks discarded' to 'Deep analysis if < X % of vectors are ok', because it's really a percentage of all found vectors (not a percentage of all blocks). Note also that the value is treated differently. If you used value X before, you should now enter 100-X. This is taken care of automatically if you load old processing settings.

Version 1.9 (2006-06-18)

  • Added an option to improve appearance of the border when using previous and future frames.
  • Added an option to extrapolate colors into the border. Read more under the 'extrapolate colors into border' setting above.
  • Added an option to always produce video with the same properties as the source video. Read more under the 'same destination properties as source' setting above.
  • Other minor changes, fixes and speed improvements.

Version 1.8.1 (2006-02-11)

  • Fixed a bug (that was introduced in version 1.8) where gaps in the log file would cause black frames.

Version 1.8 (2005-08-30)

Version 1.7.1 (2005-07-28)

  • Fixed an old bug that suddenly showed itself (by crashing) when I tried VirtualDub-MPEG2 with an HDV clip.

Version 1.7 (2005-07-26)

  • Improved the algorithm that extracts panning, rotation and zoom from the motion vectors slightly. Previously, sometimes too few white vectors were found without a "good reason".
  • Added a new "deep analysis" algorithm that makes the extraction of panning, rotation and zoom a lot more reliable in complicated clips. Unfortunately I couldn't get it as fast as I would have hoped and therefore it's not enabled in the default settings. Read more about this under the deep analysis setting above.
  • Deshaker should no longer crash when running VirtualDub batch jobs (wasn't my fault...).
  • You may now enter fractional numbers for the setting that discards motion of blocks that move > X pixels in wrong direction. (I tend to use values below 1 a lot to really only follow the background, and also to make the new deep analysis algorithm find the background among moving people etc.)
  • Added a new pixel aspect ratio preset for HDV 1440x1080. (HDV 1280x720 has square pixels, as does the HD resolution 1920x1080.)
  • Modified the pixel aspect ratio for all NTSC variants very, very slightly. (Standard NTSC was changed from 72/79 to 4320/4739, which is the correct PAR according to this page.)

Version 1.6 (2003-11-24)

  • Quick fix to make Deshaker work better with VirtualDub 1.5.5+ in interlaced mode too :)

Version 1.5 (2003-11-22)

  • Works better with VirtualDub 1.5.5 and later. (Before, log files could be emptied after pass 1.)
  • Added a (pretty useless?) feature to help stabilizing on a moving object. Read about it under the 'ignore image area outside area' setting.

Version 1.4 (2003-06-13)

  • Past and future frames can now be used to fill in the black borders. I recommend reading about these new settings above before using them. (Thanks to Lorin Thwaits for the idea to use future frames!)
  • The settings window now fits 800x600 screen resolution (by using smaller font size when necessary).
  • Now, you can enter -1 as smoothness to get "infitite smoothness" :)
  • Other minor changes.

Version 1.3

  • For some kinds of video (for example interlaced NTSC), pass 1 was unnecessarily slow. This issue was fixed.

Version 1.2

  • Added support for interlaced video.
  • Added settings that limit the amount of corrections.
  • Added new edge compensation option that completely eliminates the black borders
  • Added an optional extra zoom factor to apply to the video.
  • For some settings, Deshaker can now take quite a long time to calculate motion at the start of pass 2. So a little cancel button will now be shown during this calculation.

Version 1.1

  • Fixed a little bug when calculating rotation and zoom. You shouldn't use log files created with version 1.0. But hopefully you can use log files created with 1.1 in all future versions.

Version 1.0

First release.

 

If you feel like giving me a little something for my efforts...

© 2022 Gunnar Thalin

www.guthspot.se