Fix Camera Vibration with FFmpeg Deshake Filter

This article provides a practical guide on how to use the FFmpeg deshake filter to stabilize video footage affected by high-frequency camera vibrations, such as engine rumble, drone motor jitters, or rapid hand tremors. You will learn the basic command syntax, the key parameters to tune specifically for micro-jitters, and a step-by-step command example to clean up your shaky videos.

Understanding the Deshake Filter

FFmpeg’s built-in deshake filter works by comparing consecutive frames to detect motion, estimating the unwanted camera shake, and applying counter-transformations to smooth the video. For high-frequency vibrations (rapid, small-scale shakes), you must fine-tune the filter’s search window and block size to prevent the algorithm from ignoring the tiny jitters.

Basic Command Syntax

The simplest way to apply the filter is by using the default settings:

ffmpeg -i input.mp4 -vf deshake output.mp4

However, default settings rarely yield perfect results for high-frequency vibrations. To fix micro-jitters, you must customize the filter parameters.

Key Parameters for High-Frequency Vibrations

To target rapid, small-scale movements, adjust the following parameters within the -vf deshake filter string:

Here is an optimized command tailored for resolving high-frequency, low-amplitude camera vibrations:

ffmpeg -i input.mp4 -vf "deshake=rx=10:ry=10:blocksize=8:contrast=100:edge=mirror" -c:v libx264 -crf 18 -c:a copy output.mp4

Parameter Breakdown: