FFmpeg

Video Stabilization with FFmpeg

Install Vidstab

For Ubuntu Trusty 16.04 install the vidstab filter.

 sudo add-apt-repository ppa:mc3man/ffmpeg-test
 sudo apt-get update
 sudo apt-get install ffmpeg-static
 hash -r

Now run ffmpeg2 (note the “2”).
For Arch Linux vidstab is already included, one can just use ffmpeg.

Calculating the Stabilization Vectors

 ffmpeg2 -i SHAKY_INPUT_VIDEO.mp4 -vf vidstabdetect=stepsize=6:shakiness=8:accuracy=9:result=transform_vectors.trf -f null -

Transcoding the Video

 ffmpeg2 -i SHAKY_INPUT_VIDEO.mp4 -vf vidstabtransform=input=transform_vectors.trf:zoom=1:smoothing=30,unsharp=5:5:0.8:3:3:0.4 -vcodec libx264 -preset slow -tune film -crf 18 -acodec copy SMOOTH_OUTPUT_VIDEO.mp4

That manual is taken from: https://www.epifocal.net/blog/video-stabilization-with-ffmpeg