[Doug Bay] “I know its a long shot for ffmpeg to do something like this”
Not at all!
FFprobe (which installs with newer FFmpeg builds) is your candidate.
$ ffprobe -show_frames input.mp4
This will print out various attributes for each frame.
What you are after is “coded_picture_number=” for the frame and “pict_type=” for frame type (I,P or B).
I usually use grep to turn this into useful data without all of the other noise.
For your requirements:
$ ffprobe -show_frames input.mp4 2> /dev/null | grep ‘coded_picture_number|pict_type’
It is important to note that the “coded_picture_number” starts logically at 0 so you may need to offset this by 1 depending on how you use the output.
Michael