Skip to content

Instantly share code, notes, and snippets.

@todiadiyatmo
Last active November 5, 2015 02:24
Show Gist options
  • Save todiadiyatmo/22576d44213a41af14a4 to your computer and use it in GitHub Desktop.
Save todiadiyatmo/22576d44213a41af14a4 to your computer and use it in GitHub Desktop.
ffmpeg gif converter
#!/bin/sh
# ./convert.sh video.mp4 video
palette="/tmp/palette.png"
filters="fps=4,scale=480:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen=stats_mode=diff" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse=dither=none" -y "$2.gif"
ffmpeg -i $1 "$2.webm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment