ffmpeg is capable of measuring the difference between every scene,
and you may specify you want the difference to be above/below some rate to include that thumbnail.
black/white/uni-color screens are common as a transition, and are not a "problem", we should generate quite a lot of thumbnails, and storing them as JPG (loosely format), which has very high compression rate for uni-color images, web can sort the images by size (later) and just remove that below 1kb images.
the same issue can also be addressed by performing quite large jumps into the movie, which in-turn also generate a more story-line variety.
Just Good Business:
- Keeping thumbnails small enough, undistorted (in ratio) can be easily achieved by limiting the width to
200pixels, together with height-ratio matching and smart-cropping, this way, in-image is mostly undisrupted, cropped without missing important-ingredient and provide unified size.
- zero-padded output file name can help with sorting on older systems that might sort 10.jpg right after 1.jpg in normal cases (Windows XP/NT and below).
ffmpeg -ss 100 -i my_movie.mp4 -vf "select=gt(scene\\,0.1)" -frames:v 50 -filter:v scale=200:-1,crop=iw:ih*0.8,fps=1/10 out%04d.jpg
for example this ~4minutes YouTube Video:
- the command line would probably won't give you as many as 50 thumbnails (address the command as "maximum 50 frames" it is depending on the length of the jump (
-ss 100) which can be adjusted to much less on shorter videos (
- just bare in mind that lowering the jump rate will probably hit those black screens transitions (which are common in lammmmeeee video editing...)
raising jump (
-ss) back to
100will improve the storyline variety, but, naturally, will lower the number of thumbnails rendered:
oh, and, by the way- those black frames are about ~1.36KB while the other thumbnails are about ~4-9KB (depending on amount of colors in the image and placement near each other, which is how the JPEG compression algorithm works..).
another variation is the scene difference which is currently on 0.1 rendering a quite different scenes,
we can bring it around 0.4, and lower the jump to
20to see the quality of interest, of result.
ffmpeg -ss 20 -i "PEOPLE ARE AWESOME! 2016 (UNBELIEVABLE).mp4" -vf "select=gt(scene\\,0.4)" -frames:v 50 -filter:v scale=200:-1,crop=iw:ih*0.8,fps=1/10 icompile.eladkarako.com__ffmpeg_generate_high_interest_thumbnails__just_back_at_20__scene_at_0_4__thumbnail_%04d.jpg
now, those sort of videos are constructed of mostly multi-scenes with sharp transition so we would still (probably) get a nice result:
as you can see:
the result is not as good as keeping the scene at lower-rates,
similar colors scenes are generated, which drop the interest rate down down down... :)
so it is always better keep the scene variable low, the jump rate (-ss) high (relative to video's length), the frames above 50, which will render more than enough thumbnails, which you can sort by size later, deleting those which are around 2KB which has low amount of colors, which also means they are boring!
this rule-of-thumb (ha! thumbnail/rule of thumb -- you see what I've did there?)
can be applied beyond removing black screens, if you'll always delete one tenth of your thumbnails, removing the ones which their size is lower first, you can alway assure a high amount of colors, which in combination of high rate of story line jump rate (-ss) and scene variation - WILL result with a high interest thumbnail scenes.
May 23, 2016 Edit
I had great result when I've increased the bitrate tolerance using
-btand increased the frame-rate, so FFMPEG will look every 60 frame/seconds each time.
ffmpeg -threads 8 -ss 10 -i "myMovie.mkv" -bt 50M -vf "select=gt(scene\\,0.05)" -frames:v 20 -filter:v fps=1/60 out%04d.jpg
the scene difference is VERY LOW (meaning the scenes should be VERY DIFFERENT),
FFMPEG will take longer to calculate those.. BUT- you'll (probably) get a VERY different color/lighting theme, etc..
..which is a good thing :)))