#!/bin/sh
# /usr/local/bin/video2gif
# https://crystalfaeries.net/posix/bin/video2gif
# celeste:crystalfaery VIDEO2GIF Sat, 27 Aug 2016 06:17:34 -1000
# https://puri.sm/posts/digital-media-transcoding-part-1-ffmpeg/
# To call this script, just use :
# video2gif input.mkv output.gif
#filters="fps=15,scale=320:-1:flags=lanczos"
filters="fps=24,scale=640:-1:flags=lanczos"
palette="/tmp/palette.png"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
syntax highlighted by Code2HTML, v. 0.9.1