Making GIFs from videos using ffmpeg

video to image sequence (use either -t or -frames:v)

$ ffmpeg -ss 1:23 -i input.mp4 -frames:v 100 image-%03d.png

resize selected frames (output numbering will start from 1, so -start_number is no longer needed after this)

$ ffmpeg -start_number 7 -i image-%03d.png -frames:v 12 -vf scale=480:270 imagescaled-%03d.png

generate gif palette (otherwise ffmpeg will guess and screw up all the colors)

$ ffmpeg -i imagescaled-%03d.png -filter_complex "[0:v] palettegen" palette.png

generate gif using palette

$ ffmpeg -i imagescaled-%03d.png -i palette.png -filter_complex "[0:v][1:v] paletteuse" output.gif