How to create a thumbnail storyboard from a video file with FFmpeg & ImageMagick

This took me a few minutes to write after I couldn’t find anything via Google.  Basically what this little script does is take a file as input, takes a snapshot every 100 seconds and arranges them in a 3×30 display.  This can be modified in anyway to change the speed in which shots are take to how they are arranged.  Remember this is open source, do whatever makes you happy.

The script! :

#!/bin/sh
# Filename is first input
file=$1
# Resolution for screenshots is second input
size=$2
#Take snapshots of $file every 100 seconds in image2 format @ $size
ffmpeg -i $file -r 0.01 -f image2 -s $size images%05d.png
# Images 1&2 Always seem to be black so lets remove them
rm -rf images00001.png images00001.png
# Merge the snapshots together with 0 border/margin, tile them 3×30 and save that new image as $file.jpg
montage images000* -geometry +0+0 -tile 3×30 $file.jpg
# Clean up after ourselves
rm -rf images0*

I have the above saved and chmod +x in /usr/bin/thmbcreate, when I have a movie I want to create this storyboard from I run the following command:

thmbcreate myfile.avi 320×240

Enjoy!

-S

Leave a Reply