Skip to content

Instantly share code, notes, and snippets.

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 shaneshifflett/b6a4c339d347b4af741e12aeff2a2d3c to your computer and use it in GitHub Desktop.
Save shaneshifflett/b6a4c339d347b4af741e12aeff2a2d3c to your computer and use it in GitHub Desktop.
video-to-gif
brew install ffmpeg --with-libvorbis, --with-libvpx, --with-theora, --with-opus, --with-x265, --with-fdk-aac --with-ffplay, --with-freetype, --with-libass, --with-libquvi
#shrink video
ffmpeg -ss 0:01 -i YOURVIDEO.mov -vcodec libx264 -vprofile high -preset veryslow -b:v 1m -maxrate 300k -bufsize 1000k -vf scale=-1:-1 -threads 2 -pass 1 -an -f mp4 intro.mp4
#capture dominant colors
ffmpeg -y -t 5 -i intro.mp4 -vf fps=10,scale=1000:-1:flags=lanczos,palettegen palette.png
#create a new gif accentuating dominant colors from prior step
ffmpeg -i intro.mp4 -i palette.png -filter_complex "fps=18,scale=1000:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment