FFMPEG – Extract All Keyframes, But Don’t Fill Your Hard-Drive…


The following line will
– extract (well.. generate) an keyframe representing image, of EVERY keyframe image in your video file,
– a “ratio-correct” 100 pixel width image,
– a loosely JPEG output with quality of 15, which is about 53% (from 0-100) in terms of quality where 100 is highest quality and 0 is lowest quality,
– all total it will be a lot (!) of files, but 100 files will weight (size) in ~67.2 KB,
which if you’ll be using this command to generate a way of (let’s say..) trimming a video by visually showing the keyframes, and providing a range collector (..for example), will still generate nice output,

you can even stretch it a bit (in client side!) so it will “look bigger” if you’ll keep the 100x? ratio (which is easy to remember, right?)

ffmpeg -threads 4 -i my_movie.mp4 -vf "select=eq(pict_type\,I)" -vsync vfr -filter:v scale=100:-1,crop=iw:ih*0.8 -q:v 15 -qscale:v 15 out%05d.jpg

Here are the first ~~52 frames of this YouTube video:

Continue reading