Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
video2gif: simple command line tool using ffmpeg to convert a video to a gif


Install FFMPEG Mac

$ brew install ffmpeg

Add video2gif to ~/.bash_profile

#Convert video to gif file.
# Usage: video2gif video_file (scale) (fps)
video2gif() {
  ffmpeg -y -i "${1}" -vf fps=${3:-10},scale=${2:-320}:-1:flags=lanczos,palettegen "${1}.png"
  ffmpeg -i "${1}" -i "${1}.png" -filter_complex "fps=${3:-10},scale=${2:-320}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${1}".gif
  rm "${1}.png"

Record Screen

quicktime vieo player to record the screen Quicktime -> new screen recording -> save

Create the GIF

then from the command line (terminal) $ video2gif 600

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.