Transcode



Stabilization is best done as a two step processes - first filter is stabilize which creates a transformation file - second step applies the transformations.

Stabilize

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)  Generates a file with relative transform information (translation, rotation) about subsequent frames. See transform below.
Options
 'result' path to the file used to write the transforms
 (default:inputfile.trf)
 'shakiness' how shaky is the video and how quick is the camera?
 1: little (fast) 10: very strong/quick (slow) (default: 4) 
Controls the size of the range of possible transformations that are searched for matching transformations - distance between frames.
Larger numbers increase processing time.
 'accuracy' accuracy of detection process (>=shakiness) 
more accuracy takes more processing time.
larger numbers use smaller step size to look for matching transformations and more tracking-sections.
 1: low (fast) 15: high (slow) (default: 4) 
 'stepsize' stepsize of search process, region around minimum (lower steps are better at the cost of processing time )
 is scanned with 1 pixel resolution (default: 6)
 'algo' 0: brute force (translation only); (no rotation)
 1: small measurement fields (default) ( better and what almost all will use )
 'mincontrast' below this contrast the tracking-section area are discarded (0-1) (default: 0.3) 
small tracking-sections are matched as a whole. If mincontrast is lower than the threshold the tracking-section is ignored.
 'show' 0: draw nothing (default); 1,2: show fields and transforms
 in the resulting frames. Consider the 'preview' filter
 'help' print this help message

There is a grid of tracking-section rectangles (number and size calculated from shakiness and

video dimensions). Then the contrast and some other magic (to have them possibly spread nicely) are used to select some of them (accuracy). 

Statistical techniques are used to generate the translations. The upper and lower percentile are thrown out and an average is calculated. Small moving areas are ignored.

Transform

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 Reads a file with transform information ( produced by stabilize above) for each frame and applies it.
Options
 'input' path to the file used to read the transforms
 (default: inputfile.trf)
 'smoothing' number of frames*2 + 1 used for lowpass filtering of the frame velocity (more makes the change of frame move slower)
 used for stabilizing (default: 10) 
Number of frames among which the transformations are averaged in order to get the low-pass signal (slow camera pan motions).
Low-pass filter in transformation domain
higher values correspond to lower pass frequency: frequency about fps/smoothing.
Use high value to allow only slow pan or zoom motion, small value to keep fast pan movements.
smoothing=1 -> no smoothing at all (video will not be stabilized)
smoothing=fps -> camera acceleration is limited to about 1 framesize/s2 movement changes on the timescale of second remain
smoothing=1000 (large number) -> no panning/tilting should remain (not sure it works correctly?)
 'maxshift'  maximal number of pixels to translate image 
 (default: -1 no limit)
 'maxangle'  maximal angle in rad to rotate image (default: -1 no limit)
 'crop' 0: keep border (default), 1: black background
 'invert' 1: invert transforms(default: 0)
 'relative'  consider transforms as 0: absolute, 1: relative (default)
 'zoom' percentage to zoom >0: zoom in, <0 zoom out (default: 0)
 'optzoom' 0: nothing, 1: determine optimal zoom (default)
 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) (default), 2: bi-linear 3: quadratic
 'sharpen' amount of sharpening: 0: no sharpening (default: 0.8) ( Sharpen may help fix up the artifacts of the interpolations ) 
 uses filter unsharp with 5x5 matrix
 'help' print this help message


Example static

This is a setting attempt for a static block shot with hand-held vibration

#!/bin/bash
IN="2012-05-18_09-02-28"
EXT=".mov"
OUT="$IN-stab$EXT"

#first pass
transcode -J stabilize=shakiness=3:accuracy=15:stepsize=1:mincontrast=0.0 -i $IN$EXT  -y null,null -o dummy
#second pass
transcode \
-J transform=sharpen=0:smoothing=1000 \
-i $IN$EXT \
-o $OUT \
-Q 5,5 \
-F huffyuv \
-y ffmpeg,tcaud 

Top Page wiki Index

Disclaimer

This information may have errors; It is not permissible to be read by anyone who has ever met a lawyer.
Use is confined to Engineers with more than 370 course hours of electronic engineering for theoretical studies.
ph +1(785) 841-3089

Email inform@xtronics.com

(C) Copyright 1994-2017, Transtronics, Inc. All rights reserved
TranstronicsĀ® is a registered trademark of Transtronics, Inc.
All trademarks are the property of their respective owners.