Extracting Keyframes (I-frames) from a Video [closed]
First, a definition:
By keyframes, I mean frames in which the encoder has written all pixels instead of just the diff pixels. For example, in Adobe Premiere Pro you can specify the maximum number of frames between "Key Frames" in the export UI here:
Further research, here and here, leads me to believe that these are called "I Frames" or "I-Frames".
I have a task that involves detecting these frames in videos. The range of codecs that must be supported is not specified, so if we can support a "typical" .mp4 file, it should be good enough.
In case any additional clarification is needed, it has been suggested that we can use ffprobe to find the indices of these keyframes like so:
ffprobe -select_streams v -i x.mp4 -print_format json -show_entries frame=pict_type,coded_picture_number
If it is possible, and relatively similar in terms of efficiency, I would like to do this with OpenCV instead so that we don't need to independent executables to solve the problem.
In full disclosure, this is part of a job application 'take home' challenge. I believe posting this question is a valid example of how I might approach that problem "on the job" and I will link to this question in my submission.
The Question
Can OpenCV be used to detect I-Frames? If so, what functions or parameters should I be looking at? Also, if so, would we expect OpenCV to be as efficient at this as ffprobe?
in short - no.
look at video processing / editing software, not at a computer-vision library.
Thank you for answering. BTW, Not that I actually care, but your comment could perhaps instead be the accepted answer. Also, instead of closing the question as off-topic, it seems like a useful question regarding the features of OpenCV that could be helpful to someone else trying to solve a similar problem in the future. In-fact I asked the question because it was difficult to find the answer definitely with Google.
i am looking for similar solution, how to extract key-frame that represent whole video. such as i have 3sec long video of expressed emotion angry, now i wants to extract one frame that best describes video as angry.