Media Player Classic has a cool feature called “Save Thumbnails” and Multi-platform media player SMPlayer, using MPlayer as playback engine (supports mpv as well), has the same feature called “Thumbnail Generator“. So if you want a GUI tool to generate video thumbnail, you probably already have one of the two players installed. But if you want to use command-line to do the same, there are tons of tutorials and Q/A forums that will suggest you to use Mplayer or FFMPEG to extract sequential images and then to use imagemagick’s Montage Tiling. Problem with these methods are 1) You have tons of extracted images per your extraction method like 1 image per 10 seconds or 1 image per 5 minutes etc. Depending on your video length the number of images can be messy. And you have to delete them after creating the montage using imagemagick. To address all these challange, there is a super cool shell script named SlickSlice. It uses ImageMagick and MPlayer and once you configure it with little to no effort, you can generate video thumbnail from terminal using simple command like slickslice -x "InputFile.mp4"
According to the author of SlickSlice
SlickSlice is a bash script powered by ImageMagick and MPlayer tools that creates a timeline representation of a videofile – one big image with screenshot thumbnails taken at automatically set periods of time.
Latest version: 0.9 (28 Sept 2008); no worries it works perfectly as always!
HOW TO INSTALL:
1) Make sure you have ImageMagick and MPlayer installed.
2) Download and copy the script in your system path:
$ sudo cp /where/you/downloaded/slickslice-0.9 /usr/local/bin/slickslice
3) Make it executable:
$ sudo chmod +x /usr/local/bin/slickslice
4) Run slickslice to see the list of options:
$ slickslice
On its first run SlickSlice will create/update a config file with defaults in your home directory. You may want to examine/update it to your taste later.
$ gedit ~/.slickslice-config
HOW TO USE: $ slickslice -x "InputFile.mp4"
~/.slickslice-config file customization:
Default setting for number of images per row(W) and column(H) is 4×15. Find the lines as follows and change the dimensions for example 6 images per row and 5 images per column:
# The size of the timeline in WxH format where:
# W is the number of thumbs in a row
# H is the number of thumbs in a column
# [default: 4×15]
DIMENSION=6×5
Another customization I use is disabling ‘3 screenshots on one page image’ feature. Change SCREENSHOTS= value from ‘yes’ to ‘no’:
# Do you need a 3 screenshots on one page image?
# [default: yes]
SCREENSHOTS=no
I don’t need to automatically open each thumbnail I generate. So I disabled the ‘jpeg viewer program’ but couldn’t find a suitable way, so I just removed the default value ‘eog’.
# The name of a jpeg viewer program
# For KDE – kview or kuickshow or other
# For GNOME – eog or gthumb or other
# [default: eog ]
VIEWPROGRAM=
The hardest one I did isn’t available in the slickslice configuration file. So I had to access the script file at /usr/local/bin/slickslice
and edit with elevated access.
The generated timeline file name follows "SLICKSLICED_InputFile.mp4.jpeg"
while I wanted it to be like "InputFile.mp4-screen.jpeg"
To do that, open the script file and search for "SLICKSLICED_$MOVIENAME.jpg"
. I found twice in version 0.9 script, line 627 and 681. I changed them to "$MOVIENAME-screen.jpg"
.
Line 627: “./SLICKSLICED_$MOVIENAME.jpg” to “./$MOVIENAME-screen.jpg”
Line 681: $VIEWPROGRAM “SLICKSLICED_$MOVIENAME.jpg” & to $VIEWPROGRAM “$MOVIENAME-screen.jpg” &
Now I can sort my video and image files my name and get them together. Yay!!
Still… You might sometimes stumble upon a type of error like
INFO: Movie duration: 32 seconds
INFO: Movie width: 1080 pixels
INFO: Timeline dimension: WxH=”6×5″ -> W=”6″ H=”5″
ERROR: Cannot generate 30 thumbs for a short movie!
INFO: The estimated maximum number of thumbs is 17
30 thumbs?! Yes, remember we set 6×5 in our ~/.slickslice-config
settings for number of images per row and column? In the above example our video is too short (32 seconds) for 30 images. Luckily we don’t have to edit the config file each time we face the problem. We can simply pass options & switches to bypass the default settings. In this particular example we can:
$ slickslice -x InputFile.mp4 -S 4x3
where
-S WxH Set the timeline dimention
W – number of thumbs in a row
H – number of thumbs in a column
In extreme case like the following where:
INFO: video/mp4; charset=binary
INFO: Movie duration: 20 seconds
INFO: Movie width: 1920 pixels
INFO: Timeline dimension: WxH=”4×3″ -> W=”4″ H=”3″
ERROR: Cannot generate 12 thumbs for a short movie!
INFO: The estimated maximum number of thumbs is 5
We can do $ slickslice -x Smile.mp4 -S 5x1
that will generate 5 thumbs in a row. yippee!
OPTIONS:
-x file The name of a videofile to slickslice
-m ‘options’ Pass custom options to mplayer
[default: ‘-vf pp=ac/lb’]
Ex: Enable postproccessing filters for better image quality:
slickslice -x video.avi -m ‘-vf pp=lb/ac’
-S WxH Set the timeline dimention
W – number of thumbs in a row
H – number of thumbs in a column
[default: 4×15]
Ex: Create a timeline of 17 thumbs in one row:
slickslice -x video.avi -S 17×1
-w width Custom video width for automatic scale detection
[default: auto]
Ex: Force slickslice to use width 1066px for scaling detection:
slickslice -x video.avi -w 1066
-q value Custom jpeg quality (worst 1-100 best)
[default: 100]
Ex: Set jpeg quality to 60:
slickslice -x video.avi -q 60
-c value Custom color of a thumbnail frame. Run ‘identify -list color’ for a list
of available colors. For more info www.imagemagick.org
[default: #F0F0FF]
Ex: Set frame color to LightSkyBlue:
slickslice -x video.avi -c LightSkyBlue
-b value Custom background color. Run ‘identify -list color’ for a list
of available colors. For more info www.imagemagick.org
[default: White]
Ex: Set background color to LightGrey:
slickslice -x video.avi -b LightGrey
-l value Custom font color. Run ‘identify -list color’ for a list
of available colors. For more info www.imagemagick.org
[default: Black]
Ex: Set font color to White and background to Black:
slickslice-0.9 -x video.avi -l White -b Black
-f fontname Custom font. Run ‘identify -list font’ for a list of available fonts.
For more info www.imagemagick.org
Or provide the path to the installed font directly.
[default: DejaVu-Sans-Condensed]
Ex1: Let’s use Bitstream-Vera-Sans-Bold
slickslice -x video.avi -f Bitstream-Vera-Sans-Bold
Ex2: Let’s use our system font /usr/share/myfont.ttf
slickslice -x video.avi -f /usr/share/myfont.ttf
SWITCHES:
-o Turn off image shadows
-e Do not generate a 3 screenshots on a page image
-d Do not delete all temporary files on exit
-s Print md5sum hash into the info section of the timeline image
-n Hide the file name in the info section of the timeline image
For more info: http://slickslice.sourceforge.net