Last active
August 18, 2017 22:05
-
-
Save lucabelluccini/6460a7cdee6e4aa021ae175ddc17c567 to your computer and use it in GitHub Desktop.
Stabilize video using ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ARG1=${1:-foo} | |
ARG2=${2:-bar} | |
IN_FILE=$1 | |
SHAKINESS=${2:-8} | |
ACCURACY=${3:-9} | |
SMOOTHING=${4:-30} | |
ZOOM=${5:-1} | |
PREFIX=${6:-smooth.} | |
# https://www.epifocal.net/blog/video-stabilization-with-ffmpeg | |
ffmpeg -i $IN_FILE -vf vidstabdetect=stepsize=6:shakiness=$SHAKINESS:accuracy=$ACCURACY:result=$IN_FILE.transform_vectors.trf -f null - | |
ffmpeg -i $IN_FILE -vf vidstabtransform=input=$IN_FILE.transform_vectors.trf:zoom=$ZOOM:smoothing=$SMOOTHING,unsharp=5:5:0.8:3:3:0.4 -vcodec libx264 -preset slow -tune film -crf 18 -acodec copy $PREFIX$IN_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment