Skip to content

Instantly share code, notes, and snippets.

@matheusd
Created October 3, 2017 17:17
Show Gist options
  • Save matheusd/50f37a9bfb4b5b0d3adfe02107674802 to your computer and use it in GitHub Desktop.
Save matheusd/50f37a9bfb4b5b0d3adfe02107674802 to your computer and use it in GitHub Desktop.
ffmpeg script to convert mp4 to gif
#!/bin/sh
# Use as ./vid2gif.sh <filename.mp4>
SRC=$1
DST="$1.gif"
ffmpeg -y -i $SRC -vf fps=10,scale=1280:-1:flags=lanczos,palettegen palette.png
ffmpeg -y -i $SRC -i palette.png -filter_complex "fps=10,scale=1280:-1:flags=lanczos[x];[x][1:v]paletteuse" $DST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment