This is a very old article. It has been imported from older blogging software, and the formatting, images, etc may have been lost. Some links may be broken. Some of the information may no longer be correct. Opinions expressed in this article may no longer be held.
So, I was looking for a way to create sequential video thumbnails (like this one) from a video file on Linux. I found that my options were severely limited. On Windows there are a plethora of tools capable of this fairly simple task, including Media Player Classic, but on Linux all I could find was QFrameCatcher. The QFrameCatcher website was inaccessible yesterday; today I managed to download the source code, but couldn’t get it to build.
Anyway, I decided it probably wouldn’t be very difficult to build my own so…
dhyana.pl
dhyana.pl is a small Perl script that co-ordinates mplayer and ImageMagick to create a lovely montage of thumbnails. (Dyhana — roughly pronounced as “jahna” — is the Sanskrit word for a deep meditation.)
Usage
dhyana.pl MovieFile.avi 8 4 ‘240Ã180+10+10’
The first parameter is required and is the file name for the movie file. dhyana.pl has been tested with videos in AVI, WMV and MPEG formats. MPEG videos come out looking like crap, but AVI and WMV look much better.
The second and third parameters are the numbers of rows and columns in the output file. These parameters are optional and default to 6 rows and 4 columns = 24 thumbnails.
The fourth parameter is a geometry setting to be passed to ImageMagick. This is also optional. It takes the form of WxH+L+T where:
W is the thumbnail width
H is the thumbnail height
L is the left and right padding
T is the top and bottom padding
Thumbnails will be resized keeping their aspect ratio, so images don’t look squished. Normally with ImageMagick you can precede the width with an exclamation mark to force the image to be resized to exactly the sepcified dimensions. I’ve not tried this with dhyana.pl, but it should work. The default geometry is ‘240Ã180+10+10’.
Requirements
ImageMagick
MPlayer
ffmpeg (optional)
Perl 5
FFMPEG is used for MPEG video captures and MPlayer is used for other video captures. As previously mentioned MPEG video captures look like crap — but they look even worse when you use MPlayer. AVI and WMV captures look great. (This has to do with key frames and stuff… I won’t go into the boring details. Also, it’s worth noting that ffmpeg is very slow for video captures. MPlayer is significantly faster.)
If you have those programs, but they’re not installed in the normal place (/usr/bin/), then you’ll need to open up dhyana.pl in your favourite text editor and manually set the correct paths.
Actually, you’ll probably need to open it up anyway and enter in the path to your favourite TrueType font, as it’s probably different to how it is on my system.
Download
If, after all that, I’ve not scared you away, here it is…
dhyana.pl (Highlighted source code.)