Skip to content

Instantly share code, notes, and snippets.

@clearxlate
Last active November 29, 2020 04:35
Show Gist options
  • Save clearxlate/4bbf5ae5ff26ebfc9c2cc9876ac29da6 to your computer and use it in GitHub Desktop.
Save clearxlate/4bbf5ae5ff26ebfc9c2cc9876ac29da6 to your computer and use it in GitHub Desktop.
Create animated gif from video
# 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}".>
rm "${1}.png"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment