PDA

View Full Version : How to locate I-frames?


HymnToLife
29th April 2008, 23:01
Hi :)

I'm looking for a tool that would allow me to locate I-frames in a H.264 stream (ideally, give the frame numbers of all I-frames, so I can have chapters that don't display pop-art when switching :p).

I thought this would be a trivial thing to find, but I've spent two hours on Google with no luck, so any help would be much appreciated.

ajp_anton
29th April 2008, 23:10
There are probably easier ways:

Mux into .mkv, open in VirtualdubMod and press shift+left/right.

Mux into .avi, open in Virtualdub and press shift+left/right

unskinnyboy
30th April 2008, 00:44
@HymnToLife, If you are looking for keyframes, you want to look for IDR-frames, not I-frames. OK?

OK. Here we go...get MPEG4IP tools first. In that, you need to use mp4videoinfo.exe to do this.


Mux the file into an MP4 container first (if it isn't already in one).
From the command line, do mp4videoinfo.exe "C:\path_to_your_ video\my_file.mp4">results.txt
Now, do a findstr IDR-I results.txt>frames.txt
The resultant frames.txt should look something like:

sampleId 1, size 26009 time 0(0) SEI IDR-I
sampleId 62, size 18581 time 61061(2544) IDR-I
sampleId 130, size 23189 time 129129(5380) IDR-I
sampleId 209, size 16736 time 208208(8675) IDR-I
sampleId 291, size 16983 time 290290(12095) IDR-I
sampleId 369, size 10287 time 368368(15348) IDR-I
sampleId 449, size 15720 time 448448(18685) IDR-I
sampleId 699, size 15780 time 698698(29112) IDR-I
sampleId 949, size 23263 time 948948(39539) IDR-I
sampleId 1199, size 20476 time 1199198(49966) IDR-I
sampleId 1449, size 14192 time 1449448(60393) IDR-I
sampleId 1582, size 22686 time 1582581(65940) IDR-I
sampleId 1696, size 27911 time 1696695(70695) IDR-I
sampleId 1851, size 19141 time 1851850(77160) IDR-I
sampleId 1985, size 23905 time 1985984(82749) IDR-I
sampleId 2166, size 14186 time 2167165(90298) IDR-I
sampleId 2206, size 15886 time 2207205(91966) IDR-I
sampleId 2254, size 19282 time 2255253(93968) IDR-I
sampleId 2308, size 14036 time 2309307(96221) IDR-I
sampleId 2371, size 6918 time 2372370(98848) IDR-I
sampleId 2621, size 17324 time 2622620(109275) IDR-I
sampleId 2795, size 11063 time 2796794(116533) IDR-I
sampleId 2932, size 11320 time 2933931(122247) IDR-I
sampleId 3012, size 9196 time 3014011(125583) IDR-I
sampleId 3107, size 18534 time 3109106(129546) IDR-I
sampleId 3261, size 12768 time 3263260(135969) IDR-I
sampleId 3395, size 25665 time 3397394(141558) IDR-I
sampleId here means the frame number.
Done.

HymnToLife
30th April 2008, 16:25
Thanks :)

EDIT: By the way, for those using Linux (like me), it works just fine in WINE (albeit with a few warnings):

% wine ./mp4videoinfo.exe /path/to/file.mp4 | grep IDR-I | head
preloader: Warning: failed to reserve range 00000000-60000000
preloader: Warning: failed to reserve range 00000000-60000000
err:dosmem:setup_dos_mem Cannot use first megabyte for DOS address space, please report
preloader: Warning: failed to reserve range 00000000-60000000
err:dosmem:setup_dos_mem Cannot use first megabyte for DOS address space, please report
preloader: Warning: failed to reserve range 00000000-60000000
err:dosmem:setup_dos_mem Cannot use first megabyte for DOS address space, please report
err:dosmem:setup_dos_mem Cannot use first megabyte for DOS address space, please report
./mp4videoinfo.exe version 1.5.11
sampleId 1, size 2470 time 0(0) SEI IDR-I
sampleId 74, size 27112 time 73073(3044) IDR-I
sampleId 164, size 12773 time 163163(6798) IDR-I
sampleId 308, size 27724 time 307307(12804) IDR-I
sampleId 397, size 21302 time 396396(16516) IDR-I
sampleId 546, size 21818 time 545545(22731) IDR-I
sampleId 623, size 26928 time 622622(25942) IDR-I
sampleId 724, size 24893 time 723723(30155) IDR-I
sampleId 772, size 30063 time 771771(32157) IDR-I
sampleId 800, size 14400 time 799799(33324) IDR-I

I got it from here (http://ffdshow.faireal.net/mirror/mpeg4iptools/).