Skip to content

Instantly share code, notes, and snippets.

@kadimi
Created November 30, 2018 09:42
Show Gist options
  • Save kadimi/e90ce0cef01fdf5d78af59052e4223fc to your computer and use it in GitHub Desktop.
Save kadimi/e90ce0cef01fdf5d78af59052e4223fc to your computer and use it in GitHub Desktop.
Video (.mp4) to animation (.gif)
#!/bin/sh
## Cleanup
rm -f palette.png video.gif
## Make palette
# --ss stop at seconds
# --t duration
ffmpeg -ss 10 -t 4 -i video.mp4 -vf fps=15,scale=800:-1:flags=lanczos,palettegen palette.png
## Make gif
# --ss stop at seconds
# --t duration
ffmpeg -ss 10 -t 4 -i video.mp4 -i palette.png -filter_complex "fps=15,scale=800:-1:flags=lanczos[x];[x][1:v]paletteuse" video.gif
# Cleanup
rm -f palette.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment