Well, just parsing the bitstream to find each I-frame is a bit complicated; among other things, the encoding order may differ (or not) from the display order. One solution is to use http://www.ffmpeg.org/ffprobe.html from the ffmpeg package.
Example:
ffprobe -show_frames input.bin | grep key_frame
key_frame=1
key_frame=0
key_frame=0
key_frame=0
key_frame=0
key_frame=0
...
the output you can easily calculate the length of the gop
Another solution is to fix the reference implementation found at http://iphome.hhi.de/suehring/tml/
Let me know if you need help with this part :-)
source
share