Language German (Deutsch) for this side no available. Fall back to English
Provide a reasonably easy and flexible way to stabilize (deshake) even strongly jiggled video clips with transcode or other great open source video tools.
Example movie: Cycling downhill:
The cycling video from above: Original vs. deshaked (low quality XViD4 3.5MB): High quality 1290x1460(XViD4 30MB) |
Downhill skiing clip: Original vs. deshaked using default parameters (low quality Theora 6.7MB). High quality 1290x1460 (XViD4 17MB) |
Another snow clip with bad weather (XViD4 4.5MB) (still with version 0.4):
The easiest way is to download the binary bundle, if you have the right version of transcode and the plattform. (Otherwise you need to compile the sources, then use the CVS or HG version of transcode)
After you downloaded the appropriate binary tar-ball from the download page extract it. The newest versions contain an install script, which you can invoke with ./install.sh. Otherwise copy the .so files into /usr/lib/transcode (as root). Done!
For ffmpeg the installation is a bit more complicated at the moment, you have to compile ffmpeg yourself and make some changes, see libavfilter/README.
You have to do two transcode runs for each movie. One to detect the transformations and the second to apply the smoothed transformations.
Instead of long bla bla I give some examples since it is easy to understand. I use the following place holders which should be replaced with your concrete values:
default case:
single pass case:
If the movie is more shaky or has fast camera movement then we can increase the shakiness parameters.
Independently we can do more or less smoothing at the second pass, e.g.
Another aspect is the zooming and the border area. By default the optimal zooming is calculated, which means that 90% of transformations are hidden. This can be switched off by optzoom=0. Additionally a zoom value can be given with zoom=percentage, which is added to the optimal value. By default the border of the transformed frames contains the pixels from previous frames. If instead black pixel should be filled in, we can do the following:
[filter_stabilize.so] v0.75 (2010-04-07) extracts relative transformations of subsequent frames (used for stabilization together with the transform filter in a second pass) [filter_stabilize.so] Overview: Generates a file with relative transform information (translation, rotation) about subsequent frames. See also transform. Options 'result' path to the file used to write the transforms (def:inputfile.stab) 'shakiness' how shaky is the video and how quick is the camera? 1: little (fast) 10: very strong/quick (slow) (def: 4) 'accuracy' accuracy of detection process (>=shakiness) 1: low (fast) 15: high (slow) (def: 4) 'stepsize' stepsize of search process, region around minimum is scanned with 1 pixel resolution (def: 6) 'algo' 0: brute force (translation only); 1: small measurement fields (def) 'mincontrast' below this contrast a field is discarded (0-1) (def: 0.3) 'tripod' virtual tripod mode (if >0): motion is compared to a reference frame (frame # is the value) (def: 0) <--- NEW 'show' 0: draw nothing (def); 1,2: show fields and transforms in the resulting frames. Consider the 'preview' filter 'help' print this help message
[filter_transform.so] v0.75 (2009-10-31) transforms each frame according to transformations given in an input file (e.g. translation, rotate) see also filter stabilize Overview Reads a file with transform information for each frame and applies them. See also filter stabilize. Options 'input' path to the file used to read the transforms (def: inputfile.stab) 'smoothing' number of frames*2 + 1 used for lowpass filtering used for stabilizing (def: 10) 'maxshift' maximal number of pixels to translate image (def: -1 no limit) 'maxangle' maximal angle in rad to rotate image (def: -1 no limit) 'crop' 0: keep border (def), 1: black background 'invert' 1: invert transforms(def: 0) 'relative' consider transforms as 0: absolute, 1: relative (def) 'zoom' percentage to zoom >0: zoom in, <0 zoom out (def: 0) 'optzoom' 0: nothing, 1: determine optimal zoom (def) i.e. no (or only little) border should be visible. Note that the value given at 'zoom' is added to the here calculated one 'interpol' type of interpolation: 0: no interpolation, 1: linear (horizontal) (def), 2: bi-linear 3: quadratic 'sharpen' amount of sharpening: 0: no sharpening (def: 0.8) uses filter unsharp with 5x5 matrix 'tripod' virtual tripod mode (=relative=0:smoothing=0) <--- NEW 'help' print this help message