FFmpeg - Creating a mosaic of screenshots from a movie : scene change detection and keyframes - 2020
bogotobogo.com site search:
Note
Continued from Thumbnails -Selecting specific frames : I-frame extraction etc.
Downloading a video file
Let's download a video that we want to play with:
$ youtube-dl https://www.youtube.com/watch?v=ZwzY1o_hB5Y
Here is the downloaded video:
Screenshots to mosaic/tile via scene change
Now, we want to extract screenshots by scene change:
$ ffmpeg -i YosemiteHDII.webm -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 Yosemite_preview.png
This will create a mosaic composed of the first scenes, and it looks like this:
Note that comparing scene against a value between 0.3 and 0.5 is generally a good choice.
Every n-th frames with tile format
The following command will seek 5 seconds into the movie, select every 400th frame, scale it to 160x120 pixels and create 4x3 tiles in the output image tile.png:
$ ffmpeg -ss 00:00:05 -i YosemiteHDII.webm -frames 1 -vf "select=not(mod(n\,400)),scale=160:120,tile=4x3" tile.png
It will look like this:
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization