Skip to content

Instantly share code, notes, and snippets.

@FradSer
Last active July 26, 2021 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FradSer/ccb5a7404fcc9a285e8d554cbe50f377 to your computer and use it in GitHub Desktop.
Save FradSer/ccb5a7404fcc9a285e8d554cbe50f377 to your computer and use it in GitHub Desktop.
Video to gif with ffmpeg.
function gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 1200x1200\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -vf scale=1200:-1 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
echo "proper usage: gifify <input_movie.mov>. You DO need to include extension."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment