What is this?
mpeg-analyzer is a tiny C program which prints to the standard output the position of the start codes found in the mpeg file read by the standard input.
How do I use it?
(1) download it and save to your disk. (2) Compile it; for example, if you have gcc, you can use
The program is just simple C and it should work on any architecture. Now you can analyze your MPEG file by just sending it to the program stdin, for example,
The program will print a line for each start code found. Each printed line has the following format
where the ">>" string is at the beginning of the line, Letter is a letter which describe the start code type, Posistion is the distance in byte from the beginning of the file of the first byte of the start code, [Other fields] are other informations relative to the start code. Depending on the code type, [Other fields] can be empty. The meaning of Letter is described in the following table
|I||Frame of type I||empty|
|P||Frame of type P||empty|
|B||Frame of type B||empty|
|D||Frame of type D||empty|
|F||Frame of type unknown||(x) where x is the hexadecimal value relative to the frame type|
|G||GOP||timestamp with format (hour:min:sec:frame)|
|H||Sequence header||picture width, picture height, frame rate (in frame/sec) and aspect ratio|
|#||Other start codes||(x) where x is the hexadecimal value relative to code type|
For example, a possible output could be the following
>> H 0 352 240 30 1:1 >> U 12 >> G 32 (0:0:0:0) >> I 40 >> # 48 (0x01) >> P 11814 >> # 11823 (0x01) >> B 18079 >> # 18088 (0x01) >> B 18836 >> # 18845 (0x01) >> B 19659 >> # 19668 (0x01) >> P 20324 >> # 20333 (0x01) >> B 26636 >> # 26645 (0x01) >> B 27550 >> # 27559 (0x01) >> B 28443 >> # 28452 (0x01) >> B 29321 >> # 29330 (0x01) >> E 30010
The output is relative to a 352x240 video sequence, with 30 frame/sec and only one GOP. The unhandled start codes of type 0x01 are relative to the beginning of slices.