Skip to content

Instantly share code, notes, and snippets.

@ChrisCinelli
Created July 19, 2017 16:52
Show Gist options
  • Save ChrisCinelli/4f5338eb2717fe70a472235c338688ee to your computer and use it in GitHub Desktop.
Save ChrisCinelli/4f5338eb2717fe70a472235c338688ee to your computer and use it in GitHub Desktop.
video2gif with ffmpeg
# Convert video to gif file. See:https://superuser.com/a/1154859
# 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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment