Skip to content

Instantly share code, notes, and snippets.

@kevinchappell kevinchappell/
Last active Mar 26, 2016

What would you like to do?
Convert any video to GIF
# vid2gif - converts videos to gifs
# Usage: Add to your PATH then call like:
# $ vid2gif video.mp4 video.gif
# To add to context menu, create command that calls:
# $ vid2gif %F %d/%W.gif
# Get custom width and framerate from user input
read -p 'Width (default 540): ' G_WIDTH
read -p 'FPS (default 10): ' G_FPS
# Use custom width and framerate or fallback on default
# Define temporary image to use as color pallette
# Define filters
# Generate color palette from video stream so final GIF will have good filesize to quality ratio
ffmpeg -v warning -i $1 -vf "$FILTERS,palettegen" -y $PALETTE
# Generate GIF using our color palette and filters
ffmpeg -v warning -i $1 -i $PALETTE -lavfi "$FILTERS [x]; [x][1:v] paletteuse" -y $2
# Remove temporary palette image
rm -f $PALETTE

This comment has been minimized.

Copy link
Owner Author

commented Mar 26, 2016

This is how I make animated 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.