bengreen.eu Circle Device

 

Quick Reference

Thumbnail Generation for Montage Creation

So, ever wanted to make a nice montage of a video, you know one of those pictures that has various frames of a video and allows you to see if it is the one you want before downloading the whole 700MiB - 23GiB? Well, I wanted to do the same a little while ago and this is how I did it:

Required programs: Linux, MPlayer and ImageMagick.

Create a set of screenshots from the video with MPlayer:

mplayer -frames 16 -sstep 10 -ss 0:00:10 -nosound -vf scale=640:360 \
  -vo jpeg:outdir=myheartisbroken Evanescence-MyHeartIsBroken-1080p.mp4

Lets have a closer look at those options:

  • -frames the number of frames to capture
  • -sstep the interval to take pictures at, in seconds
    I will get images of -ss + 0, 10, 20, 30, 40... seconds through the video
  • -ss will skip the first N seconds of the video, this is generally black anyway so you don't need it in your montage.
  • -nosound guess what?
  • -vf scale=640:360 the source video is 1080p which I do NOT need in my montage, it would hog too much memory when loaded with ImageMagick if I left it alone :-(
  • -vo jpeg:outdir=myheartisbroken the directory to write the images to, will be created if it does not exist
  • Last argument is the filename of the video, I am sure you worked that out.

Now to create a montage from the generated files, we do this using montage from ImageMagick. Details of the options I have used and more is available on the ImageMagick examples page.

montage *.jpg -background grey40 -pointsize 9 -density 144x144 +polaroid \
  -resize 50% -background grey70 -fill grey40 -geometry +1+1 -tile 4x4 \
  -title "My Heart is Broken" ../myheartisbroken.jpg

Did you do it all right? If you did then you should have ended up with this (click for bigger version):

My Heart is Broken Montage

This article was helped by:
http://videotranscoding.wikispaces.com/ExtractThumbnailImages and
https://x443.wordpress.com/2009/09/10/create-photo-montage-with-imagemagick/.

Quick Links: Techie Stuff | General | Personal | Quick Reference