Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mezentsev
Forked from max-mapper/readme.md
Last active May 28, 2019 11:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mezentsev/dcf3922d6f1960ba7520598baca8349b to your computer and use it in GitHub Desktop.
Save mezentsev/dcf3922d6f1960ba7520598baca8349b to your computer and use it in GitHub Desktop.
Video stabilization using VidStab and FFMPEG (Mac OS X)

Video stabilization using VidStab and FFMPEG

Examples here use the default settings, see the VidStab readme on GitHub for more advanced instructions.

Here's an example video I made

Install ffmpeg with the vidstab plugin from homebrew

brew install ffmpeg --with-libvidstab

Analyze your video to create a .trf file

This won't modify your video or create a new video, but it should create a new file called transform.trf

ffmpeg -i clip.mov -vf vidstabdetect -f null -

Use the .trf file to create a stabilized video

ffmpeg -i clip.mov -vf vidstabtransform=smoothing=5:input="transforms.trf" clip-stabilized.mov

This should create a new stabilized video called clip-stabilized.mov

Create a side by side comparison video

ffmpeg -i Clip8.mov -i Clip8-vidstab.mov -filter_complex "[0:v:0]pad=iw*2:ih[bg]; [bg][1:v:0]overlay=w" merged.mov

Side-by-side

ffmpeg -i clip.mov -i clip-stabilized.mov  -filter_complex hstack merged.mov

Vertically stacked

ffmpeg -i clip.mov -i clip-stabilized.mov  -filter_complex vstack merged.mov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment