Skip to content

Instantly share code, notes, and snippets.

@knugie knugie/mp42gif
Created Jan 21, 2017

Embed
What would you like to do?
Generate a gif from an mp4 file
# Using ffmpeg
ffmpeg -y -i video.mp4 -vf fps=1,scale=600:-1:flags=lanczos,palettegen palette.png
ffmpeg -i video.mp4 -i palette.png -filter_complex "setpts=0.125*PTS,fps=5,scale=600:-1:flags=lanczos[x];[x][1:v]paletteuse" video.gif
# OR
# Using ffmpeg and gifsicle (https://www.lcdf.org/gifsicle/)
ffmpeg -i video.mp4 -s 600x400 -r 3 -f gif - | gifsicle --delay=3 > video.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.