Barnee
Barnee

Reputation: 35

Extract Less Keyframes (ffmpeg)

I'm trying to extract keyframes from a large video I have. The problem I'm seeing is that it is extracting far too many, leaving me with many very similar images.

Below is what I am currently using (from terminal)

ffmpeg -i video.mov -vf "select=eq(pict_type\,I)" -vsync vfr thumb%04d.png -hide_banner

What would be great is if there was a way I can either make it only output 1 in 5 keyframes. Or what would be even better is if there is a way I can make it only output if the frame is over x% different from the previous one.

Upvotes: 0

Views: 519

Answers (1)

Gyan
Gyan

Reputation: 93028

1 in 5 keyframes:

ffmpeg -i video.mov -vf "select=eq(pict_type\,I),select='not(mod(n\,5))'" -vsync vfr thumb%04d.png

frame is over x% different from the previous one:

ffmpeg -i video.mov -vf "select=eq(pict_type\,I),select='gt(scene\,x/100)'" -vsync vfr thumb%04d.png

Upvotes: 1

Related Questions