Last active
May 25, 2022 19:35
-
-
Save knugie/db876679a75b3c5ab4608e96357a3302 to your computer and use it in GitHub Desktop.
Generate a gif from an mp4 file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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