I want to create an animated .gif file as a thumbnail for a video. I used this command line to grab 20 frames from a video:
ffmpeg -i input.mkv -ss 00:05:14.435 -vframes 20 ./thumbs/out%02d.png
Which worked well to get a sample that I can create a .gif from. But in a longer video there are multiple scenes, obviously, and I wanted to get another 20 frames from another part and so on several more times to get a few scenes. Of course that presents a problem of how to decide where to grab the frames from.
I searched and found this question the answer to which really seems close to what I want - Meaningful thumbnails for a Video using FFmpeg. In that answer they offer the command:
ffmpeg -ss 3 -i input.mkv -vf "select=gt(scene\,0.4)" -frames:v 5 -vsync vfr -vf fps=fps=1/600 ./thumbs/out%02d.jpg
which gets a single frame at the beginning of each of five scene changes. I was exited because grabbing 10 or 20 frames from each of those scenes would be awesome and just want I want.
I could not tell how to combine the two concepts of finding the places where the scene changes are and grabbing multiple frames from each location. -frames:v and -vframes seem to be the same parameter and in one command they tell ffmpeg to grab 10 consecutive frames and in the other they say limit the grabbing fro frames from the scene breaks to 5.
How can I create a command that will grab n frames from each scene break up to y scene breaks? Heck I would take not being able to control how may scene breaks the n frames were grabbed for.