First, let me preface this with saying that I have to process a massive amount of videos and shaving even 1 second per video is very significant.
I'm trying to extract the position of all intra-frames in a video.
FFProbe works, but it's amazingly slow.
FFMpeg works much faster, but it's still quite slow.
So, my question is if there is a lib, where I could do something like this pseudo code:
var frame = first_frame;
do
{
if (frame.type == intra_frame) log(frame.time);
frame = frame.next;
} while (frame != null);
and scan through the video very fast, not looking at anything inside the frames, but just the headers to find the type of the frame and move on to the next.
The end goal is to generate filmstrips, for preview, as fast as possible. I need to generate 48 thumbnails roughly evenly spread through the movie and covering the whole movie span (excluding 5 sec on each end). I am hoping to speed the process up by extracting only intra-frames. Since I need a fixed number of thumbnails, I can only do this by knowing the total amount of intra-frames.
This scenario works only if the time to find all the intra-frame indices and extract 48 intra frames is less than getting frames, in a single pass, at regular intervals, 48 times.
Edit: This is the solution I have found so far; in this example I take one frame every minute
ffmpeg -hide_banner -skip_frame nokey -i _a.mp4 -vf "select='eq(pict_type\,PICT_TYPE_I)*(lt(abs(t\-30)\,2)+lt(abs(t\-90)\,2)+lt(abs(t\-150)\,2)+lt(abs(t\-180)\,2)+lt(abs(t\-240)\,2)+lt(abs(t\-300)\,2)+lt(abs(t\-360)\,2)+lt(abs(t\-420)\,2))',showinfo,scale=640:480,tile=6x8" -vsync 0 frames.jpg
I found that if I specify the frames directly, I don't really get a speed difference.
Short of going through the API, is there anything faster with FFMPEG?