Skip to content

Instantly share code, notes, and snippets.

@timhughes
Created January 14, 2018 23:06
Show Gist options
  • Save timhughes/2f07078613bcf15f82ff9002b4cbde20 to your computer and use it in GitHub Desktop.
Save timhughes/2f07078613bcf15f82ff9002b4cbde20 to your computer and use it in GitHub Desktop.
Stabilize my GoPro videos
#! /bin/sh
#
# stabilize.sh
#
fullfile=$(readlink -f $1)
dir_name=$(dirname $fullfile)
filename=$(basename $fullfile)
file_no_ext=${filename%.*}
extension="${filename##*.}"
tempdir=$(mktemp -d)
ffmpeg -i $fullfile -vf vidstabdetect=shakiness=5:show=1 $tempdir/dummy.mp4
ffmpeg -i $fullfile -c:v libx264 -crf 20 -preset slow -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4,scale=1280:720 ${dir_name}/${file_no_ext}-720p.${extension}
rm -rf $tempdir
# vim: set ft=sh ts=4 sw=4 tw=999 et :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment