Skip to content

Instantly share code, notes, and snippets.

@lancehunt
Created March 2, 2017 17:19
Show Gist options
  • Save lancehunt/319d293582ea9f7b8f4fcc3607f4db5c to your computer and use it in GitHub Desktop.
Save lancehunt/319d293582ea9f7b8f4fcc3607f4db5c to your computer and use it in GitHub Desktop.
Convert MP4 to animated Gif
#!/bin/bash
brew install ffmpeg
ffmpeg -y -ss 3 -t 3 -i ~/Downloads/input.mp4 -vf fps=10,scale=800:-1:flags=lanczos,palettegen palette.png
ffmpeg -ss 1 -t 30 -i ~/Downloads/input.mp4 -i palette.png -filter_complex "fps=10,scale=800:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
# 30-second output at 800 x 600 resolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment