– conversion:

– monitor:

– remove every-other:

Create a folder, and move the video file in to the folder.

# ffmpeg -t <duration> -ss <starting position in hh:mm:ss format> -i <input_video> out%04d.png
# NOTE: the original output of the article was GIF, but I changed it. Might be a source of problems

ffmpeg -t 5 -ss 00:00:10 -i funny.mp4 out%04d.png
# Starts at 10 seconds, lasts for 5 seconds

At this point you have files. Viewing the folder should let you see the thumbnails. You can pre and post delete any files you grabbed by accident.

If the images come from an animation, you might want to delete every-other-file.

rm -f *[13579].png

Next use ImageMagick to build the GIF.

# convert -delay <ticks>x<ticks-per-second> -loop 0 out*png <output-gif-file>

convert -monitor -delay 1x20 -loop 0 out*.png anim.gif

I added `-monitor` myself to see what was happening. In my case it was freezing, hence the need to remove excess frames.

The original article then recommends using ImageMagick again for optimizing, but my file was too big.

Alternatively, gifsicle.

# -O = optimize
# --resize-width = specify a proportional scale

gifsicle -O anim.gif --resize-width 480 -o anim2.gif