Creating animated GIFs from the shell using FFmpeg and ImageMagick
- Extracting frames:
mkdir anim && cd anim ffmpeg -ss 14:55 -i video.mkv -t 5 -s 480x270 -f image2 %03d.png - Selecting the frames (only 1 in 3, from frame 10 to frame 72):
seq -f %03g.png 10 3 72 - Creating the animation:
convert -delay 1x8 `seq -f %03g.png 10 3 72` \ -coalesce -layers OptimizeTransparency animation.gif - ImageMagick tricks:
convert -fuzz 1% -delay 1x8 `seq -f %03g.png 10 3 72` \ -coalesce -layers OptimizeTransparency animation.gifor even :
convert -delay 1x8 `seq -f %03g.png 10 3 72` \ -ordered-dither o8x8,8 \ -coalesce -layers OptimizeTransparency \ +map animation.gif