Skip to content

Instantly share code, notes, and snippets.

@mhamilt
Last active September 10, 2019 14:21
Show Gist options
  • Save mhamilt/362ec554604ee835df50677220012d74 to your computer and use it in GitHub Desktop.
Save mhamilt/362ec554604ee835df50677220012d74 to your computer and use it in GitHub Desktop.
Make gifs with ffmpeg

FFMPEG: Generate Gif

See This SO Article

And Here

# verbose, but customisable
ffmpeg -i VIDEO.EXTENSION  -vf "fps=10,scale=680:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 OUT.gif
# gritty, but portable
ffmpeg -i VIDEO.EXTENSION -pix_fmt bgr8 -r 10 -y -s 680x400 OUT.gif # Supported pixel formats: rgb8 bgr8 rgb4_byte bgr4_byte gray pal8

Cut FrameRate

FILE=path/to/file
echo y | ffmpeg -i $FILE.mp4  -filter:v "setpts=0.5*PTS" output.mp4; 
ffmpeg -i output.mp4 -pix_fmt bgr8 -r 5 -y -s 1140x600 $FILE.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment