How to calculate GOP size of a file H264

user3677103 picture user3677103 · Jun 3, 2014 · Viewed 25.2k times · Source

I have a h264 file that extract from YUV format using SVC software. Now, I want to caculate size of each GOP in the h264 file. We know that size of GOP is the distance between two nearest I frame. here. Could you suggest to me how to cacluate the GOP size of a given h264 file. It is better when we implement it by C/C++.Thank you

Answer

mysteryegg picture mysteryegg · May 17, 2016

I personally prefer filtering by pict_type:

ffprobe -show_frames input.h264 | grep pict_type

This will show you the frame structure:

pict_type=I
pict_type=P
pict_type=P
pict_type=P
pict_type=P
pict_type=P
...