Skip to content

Instantly share code, notes, and snippets.

@samuelstevens9
Last active February 28, 2018 19:37
Show Gist options
  • Save samuelstevens9/b6c8a56a5d614f4aa0c79756d1b6386f to your computer and use it in GitHub Desktop.
Save samuelstevens9/b6c8a56a5d614f4aa0c79756d1b6386f to your computer and use it in GitHub Desktop.
video2gif: simple command line tool using ffmpeg to convert a video to a gif

FFMPEG

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 cjm-touchpoint.mov 600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment