Configure vidstabtransform Zoom and Interpolation in FFmpeg

This article explains how to configure the zoom and interpolation settings of the vidstabtransform filter in FFmpeg to stabilize shaky video footage. You will learn how to control how much the video zooms in to hide moving borders and how to select the best pixel interpolation method to maintain visual quality.

Stabilizing a video with FFmpeg is a two-step process. First, the vidstabdetect filter analyzes the motion and generates a transform file (usually named transforms.trf). Second, the vidstabtransform filter uses this file to apply stabilization. Zooming and interpolation are configured during this second step.

Here is a standard command template using both configuration options:

ffmpeg -i input.mp4 -vf vidstabtransform=input=transforms.trf:zoom=5:optzoom=1:interpol=bicubic output.mp4

Configuring Zoom Options

When a video is stabilized, the frame shifts to counteract the camera shake, which can reveal empty black borders. To hide these borders, you must configure the zoom parameters.

Example with optimal static zoom:

ffmpeg -i input.mp4 -vf vidstabtransform=zoom=0:optzoom=1 output.mp4

Configuring Interpolation Options

Interpolation determines how FFmpeg reconstructs and renders pixels when the video frame is rotated, shifted, or zoomed. Choosing the right interpolation method directly affects the sharpness and rendering speed of the output.

You can set the interpol parameter to one of the following values:

Example using high-quality bicubic interpolation:

ffmpeg -i input.mp4 -vf vidstabtransform=interpol=bicubic output.mp4