View Full Version : How to know the number of I Frames in a MP4 file without decoding?
ruian.xu
25th May 2007, 10:06
Hi, anyone knows how to get the number of I Frames of a MP4 file without actually decoding it? Is there related information in the file header?
Thanks!
Kurtnoise
25th May 2007, 17:44
h264_parse : a command line tool from the mpeg4ip framework which is able to get this iirc.
Another way : through MP4Box via a new creation file. During import step, this tool displays this number...
iirc the stss atom in mp4 carries the information where the keyframes are
moved
mediator
26th May 2007, 17:24
please note that there is a subtle difference between IDR- and I-frames in AVC. iirc I-frames which are not IDR are not signalled in the sync-sample-table (stss). Maybe this is not relevant in this case. Just for the sake of completeness...
ruian.xu
27th May 2007, 08:36
Thank you for your help! I found the "stss" frame in a sample file with only one I Frame. I'll try to integrate this support. However, I still have one question here:
In MPEG-4 spec, "stss" is not a mandantory atom. How can we know the number of I Frames in absence of it? Then, do we have to decode all the frames till the end before we can tell?
It would be time consuming, and u can never expect what kind of file u get...
mediator
27th May 2007, 14:41
"stss is absent" is semantically equivalent to "all samples are keysamples"
ruian.xu
28th May 2007, 12:45
Thanks!
I'm treating it like this now:
1. When "stss" exists, count on the num of entries in it as the number of I Frames;
2. When it is absent, just take it as no I Frames;
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.