Montage Frame Extractyion with mpv
To use mpv rather than MPlayer
mpv --vf=lavfi-scale=320x240 --vo=image --sid=no --frames 18 --sstep 60 --ss 00:00:32 --no-audio
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):
Simpler and font chosen:
montage *.jpg -font '/usr/share/fonts/dejavu/DejaVuSans.ttf' \ -fill white -title "My Heart is Broken" -background black \ -geometry +2+2 -tile 4x ../myheartisbroken.jpg
This article was helped by:
http://videotranscoding.wikispaces.com/ExtractThumbnailImages and
https://x443.wordpress.com/2009/09/10/create-photo-montage-with-imagemagick/.