I'm trying to get the frames of a video file as images, together with tags that if the frame is a I, P or B frame.
I know that ffmpeg can output only a specific type of frame using
For I-Frames one can do:
ffmpeg -i input.mp4 -vf "select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr iframe_%04d.png
Other pict types can be used for B or P frames. However this will output the frames as iframe_0001.png, iframe_0002.png, etc. The original frame number in the video is lost.
For example, to achieve something like: iframes_0001.png, bframe_0002.png, bframe_0003.png, pframe_0004.png, bframe_0005.png, iframe_0006.png, ...
It's ok if several passes are required, it's also ok to generate an auxiliary file that specifies the type of frame it is (maybe a text file with frame number and frame properties).