FFmpeg has the ability to stabilise a video using a 2 pass approach. I first learnt about this from a post on Paul Irish’s website and later also shared the link. Their post also includes a useful single command to stabilise and create a comparison video to see the before and after. The purpose of my entry is to add some references and commands that I’ve found useful mostly for me to look up later.
The first pass uses vidstabdetect to analyse the video and output stabilisation data to a file called transforms.trf. Parameters such as shakiness, accuracy, and stepsize can be set to describe how shaky the video is, how accurate the detection process needs to be and the step size in detection.1 The defaults work well enough for me.
The second pass uses vidstabtransform which takes the file created during the first pass and outputs a stabilised video. This filter also has many parameters to adjust smoothing, interpolation, and zooming. I stick with the defaults which generate decent results. The FFmpeg recommend using this step together with the unsharp video filter.