[RELEASE] Quick Thumbnail Generator Tool (for Linux, Mac, and Windows)
Thumbs Up 

This may not be for everyone, but its a quick and dirty way of generating thumbnails on a large collection without alot of hassle (at least once its setup). This solution might be bit technical, so if the instructions look overwhelming, you might want to wait until thumbnails are added to MIP or another tool. This original code is a PERL script, so for Linux it does need Perl. I have rolled up the script into a prepackaged EXE for Windows. This should work for most Windows systems. I tested on XP, but not specifically in Vista. There might be some UAC issues with Vista, but I think it should work okay.

To use this tool, you should be using a folder structure for your files. It will be pretty useless otherwise. This isn't really a limitation of the tool, but the Aeon skin for example looks for the thumbs in a directory relative to the movie folder. The program is designed to be a one shot script to pull thumbnails from virtually any movie file and batch the images to the right locations. Bold are new with version 1.2
  • Config file based setup.
  • Many file types searched. See config file for full list.
  • You can run it in a collection folder and it will examine all subfolders automatically. An additional config/paths file can be used to scan multiple directories.
  • Thumbs for multi-part movies are detected and spanned across the parts. However, XBMC has issues with this (see issues below).
  • By default the program will detect if you've already made thumbnails and skip over that folder. You can overwrite existing thumbs by setting a config value.
  • By default, I generate 9 thumbnails. This can be changed by providing an option at runtime or config.
  • The time interval between thumbnails is calculated automatically based on movie duration.
  • The default size of each thumbnail is 960x540. The size can be changed in config or with command line options. High quality thumbnail output and resizing is done automatically.
  • Calculates aspect ratio of thumb vs movie and does letterbox or crop to the aspect.
  • Cropping can be offset by a percentage value (allows frame offset of the crop itself).
  • Code is MIT licensed and source code is included, so you can do with it what you'd like.
  • Output of program work to a log file for easy backtracking of errors.
  • Windows and Linux versions (will likely run on OS/X with Perl as well).
  • Blur and black level detection to discard "bad" images


Some Issues:
  • For multi-part movies, Aeon's workaround in the XBMC skinning engine cannot find the thumbnails for these movies. This can only be resolved by joining the movie files. This may be fixed in XBMC in the future, but there is no planned timeline for this currently.
  • Only VTS_1 is parsed for VOB files. It is assumed this VTS is the main movie.
  • The program makes lots of "noise". Most all of this is FFMPEG output. Processing can be monitored in the log file.
  • Previous versions had problems with FFMPEG hanging on bad movies. This should now be resolved.

Requirements for Linux:
If you're using Linux, I am kind of assuming you know what you're doing. If alot of Linux folk need additional help on these requirements, just let me know (PM) or reply in thread and I will try to help. I have tested this on an Ubuntu server install (8.04LTS) as well as XP.
  • Perl 5 - any recent version will do. I tested with 5.8. I only use standard Perl modules.
  • FFMPEG - more recent versions will work best. Most Linux systems have older versions by default. As such, you may need to compile your own or find an SVN build package. I recommend as new as possible.
  • Mediainfo - I'm not sure which distros carry mediainfo by default. If you need a package, grab one here http://mediainfo.sourceforge.net/en/Download. You will need all three: libzen, libmediainfo and the CLI packages.
  • ImageMagick - If you want to enable image processing for blur/black levels, you must install the CLI utilities for ImageMagick.
Requirements for Windows:
Everything should be pre-packaged, but you will need a zip utility to unpack the files.
For Windows users, I have packaged these requirements in a single file to aid with usage. I have also rolled up the script into a Windows executable. There isn't an installer though, so you're on your own for unpackaging and use.

Installation & Usage:

LINUX: Put the "thumber" script in your path (I usually use $HOME/bin), ensure FFMPEG, MediaInfo and Imagemagick are installed. Run the program by changing to the folder you want to scan, or add the path to the end of the command and it will use that path instead. NOTE: You do not need the tools directory or the thumber.exe for Linux.

WINDOWS: Extract the file to a folder of your choice. The main program is "thumber.exe". The alternate file "thumber" is the base Perl code. For general use, you should be able to drag a folder to the program file. NOTE: The program only accepts one folder, so if you drag multiple ones, it will only process the first one. If many users have problems with using the command line options, I might write some batch wrappers for this. The source code for Windows is separate and included in the "src" directory.

The program accepts command line options as well as using the config file. Command line options always override the config value. To get help on the command line options, run the program as follows:
thumber -h

I expect a few people might have issues, so I am happy to help however I can.

Hope this helps...
It works great once i figured it out nice work on this it will save me hours of work creating thumbs by handSmile
XBMC Frodo 12 - Windows 7 - Asrock Ion 330HT - Aeon Nox
webmosher Wrote:Hello,

I expect a few people might have issues, so I am happy to help however I can.

Hope this helps...

i can tell you it works in vista x64 without a problem.. Smile UAC should only be a problem when trying to add files to system-secured directories.

pretty easy, this is really useful to just fill in those extrathumbs without any intervention, and later, when there is some time left, one can browse through and select which thumbs should be placed to position 1 and 2 for displaying in aeon.

thank you for this, i like it. i might now change back from my poster mod by hitcher to display extrathumbs again Smile

edit: some movies had bad thumbs as you mentioned, but when using default 9 thumbs per movie, one can be sure there are at least 2 useful ones to display in aeon Smile
cheers,azido :;):
Ah, interesting. You can't just define one of the height/width overrides. I ran it using a smaller width assuming it would scale the height accordingly, but such is not the case....

It made my funny-looking images really quickly, though. And the content is pretty good.

I'm impressed! Thanks tons for this....

Edit: Actually, two more things....

1. It crashed on me, citing division of zero on line 226. Which brings me to:
2. Why letterbox? The actual dimensions are available to the script, so it wouldn't be too much more complicated to just always crop to a 16:9 image, right? Take the height value, calculate what the width would be to take up the whole frame Aeon is looking for (height*16/9), then crop that out of the center of the frame.... That way all the images are of a uniform size. It's maybe less than ideal for preserving perfect images, but if we're running a batch script in the first place, then it's a safe assumption that we're okay with a few compromises, right?

Maybe make it a special switch: perl thumber -u activates "uniform" mode, or something, and then we're opting into the aspect ratio issues.... Did you try this and reject it based on the results already?

I'll try to dig into the code and try it for myself, but I'm assuming it would take you minutes to my couple hours of trial and error....
Works great on for me on Windows 7 x64. I think dimensions both have to be even for this to work (at least when I tried), but that isn't a problem if you aren't changing that

I just ran thumber.exe -x960 -y540 d:\movies and everything worked out fine

Lanczos would be nice, maybe using imagemagick? Save image as original resolution, then process/resize with imagemagick using lanczos if downsampling, bicubic if upscaling to the user-defined resolution (or default). Not sure how hard that would be (or even worth it), only a suggestion.
Worked great for me, thanks.

Any chance of it not creating the 'extrathumbs' folder if it doesn't find a video file only I've stuck it in the root of my movies (they're in separate folders) and each time I run it creates one in the root.?
will try out this weekend, Thanks.
The Transforminators HD Movie Trailer
- from the creators of Terminator and Transformers -
Also works great for me, thanks!
webmosher Wrote:
  • File types searched: avi|mpg|mpeg|wmv|mkv|ogm|vob|ts|mov (let me know if I have missed any obvious ones).
.mp4? Some are also using .divx and .xvid.
Took me a while to figure it out, because i alread had empty Extrathumb Folders in my Movie Folders and the program therefore wouldnt create any thumbs, but once i deleted them everything worked great!
Thanks much for trying out this tool. Based on the comments already, I have prepared some fixes for the program. I am currently in the process of testing these issues, and when I am done, I will update the main post with the new link. I really cannot release this quite yet, as one of the new features has been pretty unstable, so I want to make sure it works well before I put it in the wild.

New Features Planned
  • While command line options are still available, all program options can be set from a config file. I'm hoping this will help Windows users to be able to use the program a bit better.
  • New aspect ratio calculation system. This will allow you to setup how you want thumbs cropped or letterboxed. I also discovered a "tweak" for using FFMPEG cropping, so now cropping works to the center of the frame. Additionally, you can set percent offsets when cropping is used.
  • I've noted that FFMPEG will often get "lost" looking for thumbnails, specifically on WMV9 formatted files. I've added a timeout, but since FFMPEG doesn't do this on its own, the script handles the signalling. Unfortunately, this is the unstable bit I've had problems with. I'm still working on some of the stability issues.
  • I'll also address other minor issues people have brought up and include those as well. I will be providing new versions of FFMPEG that seem to work better with Windows. Especially for WMV9/HD content.

Stuff I am still working on... I experimented a bit with using image magick to do blur detection, resizing and so forth. This is not integrated into the program yet, but might be later this week.

Thanks again.
Really cool script. Nod

Thanks mate.

Works almost perfect on my linux 32 bit with svn ffmpeg.

Just had a hang in the script when it reached a movie with a $ character in the movie name and folder.: Ca$h.avi

You could add .m2ts video extension too.

Your script is already placed in my crontab now Smile

Keep up the good work boss.
this is a cool script and also should be sticked.
All the good things might get lost.
New users might never seem them.
We need sticky threads for the mods and tools for aeon.
Would it be possible to specify a separate output folder? I like having my movies and meta data separate and then virtually merge them with symlinks into a folder that is actually parsed by XBMC. This way I have a folder with only movies when I, or anyone else in the family, use a different media player.

Hi webmosher. great program but i have found a problem it will not create thumbs for .vob files or .mp4 and it wont do the ones i encoded to 720p using divx encoder version 7 i even tried changing the extension from .divx to .avi i also tried the .mp4's and .vob to .mpeg .mpg and still no joy. but it does work with .avi's with lower resolutions so i am stuck doing half of my collection by hand. any ideas would be helpfull thanksOo
XBMC Frodo 12 - Windows 7 - Asrock Ion 330HT - Aeon Nox

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Quick Thumbnail Generator Tool (for Linux, Mac, and Windows)2
This forum uses Lukasz Tkacz MyBB addons.