>FFmpegLab Start free
FFmpeg Guide

How to stabilize shaky video with FFmpeg

Smooth out handheld wobble with the two-pass vidstab workflow — analyze the motion, then apply the correction — plus a quick single-pass deshake fallback.

The best results come from vidstab, which works in two passes. The first pass (vidstabdetect) analyzes camera motion across the whole clip and writes it to a transforms file. The second pass (vidstabtransform) uses that data to counter-move each frame. Two passes means it can plan smoothing using future frames, not just past ones.

Key takeaways

Two-pass stabilization (vidstab)

Run detection first, then the transform. vidstab requires an FFmpeg build compiled with --enable-libvidstab:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# pass 1: analyze motion -> transforms.trf
ffmpeg -i in.mp4 -vf vidstabdetect=shakiness=5:accuracy=15 -f null -

# pass 2: apply the correction
ffmpeg -i in.mp4 -vf \
  "vidstabtransform=smoothing=30:input=transforms.trf,unsharp=5:5:0.8" \
  -c:a copy out.mp4

Tune smoothing and hide the edges

Stabilization shifts frames, exposing empty borders. Raise smoothing for steadier motion and let vidstabtransform zoom in slightly to crop the edges out:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i in.mp4 -vf \
  "vidstabtransform=smoothing=50:zoom=5:optzoom=0:input=transforms.trf" \
  -c:a copy steady.mp4

Quick single-pass deshake

If your build lacks vidstab or you just need a fast pass, the built-in deshake filter works in one go — less smooth, but no setup:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i in.mp4 -vf "deshake" -c:a copy out.mp4

Stabilize visually instead

FFmpegLab runs both stabilization passes for you behind a single toggle and previews the smoothed result before you commit — all offline, so raw footage never leaves your device. After stabilizing, crop any leftover edges or compress for delivery.

✦  Fresh from the render queue

Better FFmpeg workflows, delivered.

Get practical commands, new templates, and deep-dive guides for the edits that are usually hardest to get right.

✓  Copy-pasteable commands    ✓  Editor templates    ✓  No noise
One useful email at a time.

Smooth out shaky footage — in your browser.

Free in your browser — nothing to install, nothing uploaded.