I've used FFmpeg to extract all the I-frames from a MKV/MP4 file but FFmpeg seems to decode all frames to do it, so it takes a very long time if the video file is 1080p and longer than 10 minutes. I only want it to jump from I-frame to I-frame and dump them out to JPG/PNG files. Also, I need to know the timestamp of the I-frame.
The other option was to use FFprobe to get timestamps for all the I-frames, but that also decodes the whole file.
I'm trying to do something similar to Avidemux. In Avidemux you can step to each I-frame very fast by just pressing the up or down arrow keys, but it does so without decode all the B/P frames.
Best Answer
Use
skip_frame
tells the decoder to process only keyframes.-vsync 0
(in this command) preserves timestamps.-frame_pts
sets the numeral portion of the output image filename to represent the timestamp. The interpretation of the number requires you to know the framerate e.g. if the framerate is 30 then an image name of out75 corresponds to a timestamp of 75/30 = 2.50 seconds. You can add-r 1000
if you want numbers to represent milliseconds.