Stabilise video using FFmpeg 2
me@grafxflow

Written by me@grafxflow

18 Dec, 2025

0

938

Stabilise video using FFmpeg

FFmpeg can stabilise a video utilising a two-pass method. The aim of my entry is to compile some references and commands that I have found beneficial, primarily for my future reference.

Pass 1: Video detection

The initial step employs vidstabdetect to examine the video and generate stabilisation data, which is saved in a file named transforms.trf. Various parameters, including shakiness, accuracy, and stepsize, can be adjusted to indicate the level of shakiness in the video, the required precision of the detection process, and the detection step size. The default settings are satisfactory for my needs.

# Example given in the docs to analyse very shaky video. 
ffmpeg -i original_video.mkv -vf vidstabdetect=shakiness=10:accuracy=15 -f null -

# Example using the default parameter values.
ffmpeg -i original_video.mkv -vf vidstabdetect -f null -

Pass 2: Video stabilisation

The second pass employs vidstabtransform, which processes the file generated in the first pass to produce a stabilised video. This filter includes numerous parameters for adjusting smoothing, interpolation, and zooming. I prefer to use the default settings, which yield satisfactory results. FFmpeg recommends utilising this step in conjunction with the unsharp video filter.

# Example to use the default .trf file generated to stabilise a video.
ffmpeg -i original_video.mkv -vf vidstabtransform stabilised_original_video.mkv
Combining both passes 

By merging the two passes into one command, we arrive at the command listed below.

export vid="original_video.mkv"
ffmpeg -i "$vid" -vf vidstabdetect -f null -; ffmpeg -i "$vid" -vf vidstabtransform "stabilised_$vid"

Add comment

Smart Search

133 Following
50 Followers

me@grafxflow

Hull, United Kingdom

I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!

Follow