[ExtractStream] [HTML inside] MPEG Stream questions...

Edmond E. Shwayri eshwayri at n...
Sun, 14 Apr 2002 21:31:58 -0400


A record in a TY file is of the following format :

Audio sub-types :
#define TY_APES_SUBTYPE 0x03 // Audio PES packet sub-type.
#define TY_AFRAME_SUBTYPE 0x04 // Audio frame sub-type.
#define TY_AFRAME_CONTINUE 0x02 // Audio data continues from the 
prev sub-type.

Video sub-types :
#define TY_VHEADER_SUBTYPE 0x07 // Video header sub-type.
#define TY_VGOP_SUBTYPE 0x0C // Video group-of-pictures 
sub-type.
#define TY_VPES_SUBTYPE 0x06 // Video PES packet sub-type.
#define TY_IFRAME_SUBTYPE 0x08 // Video I-Frame sub-type.
#define TY_BFRAME_SUBTYPE 0x0B // Video B-Frame sub-type.
#define TY_PFRAME_SUBTYPE 0x0A // Video P-Frame sub-type.
#define TY_VFRAME_CONTINUE 0x02 // Video data continues from 
the prev sub-type.

All EXCEPT for 0x02 are approximately the start of the mpeg packet. I say 
approximately because it starts with [number of 0s] then 00 00 01. The 
number of 0's pre-padded is between is 0 and 4


>From what I've read, the MPEG spec allows for 0 padding. The way you tell 
when an MPEG packet starts is by looking for the 00 00 01.

>The dark green 8-byte headers are GOP headers... but usually right after 
>that there are 4-byte headers of 0 0 0 0 or 0 0 0 1; but sometimes there's 
>wildly different data in these headers... is it possible that the tivo 
>isn't breaking the video/audio stream on MPEG headers [but magically 
>reassembles the stream correctly whilst playing] or is there a whole lot 
>more to the MPEG standard than what I've found so far that allows data 
>headers to be something other than 0 0 1 xx...?
>
>There just seems to be a lot of these "strange" [well, at least to me] 
>4-byte headers that don't make much sense to me (yet).
>
>Remember all, I'm still a newbie at this MPEG stuff...
>
>... And I'm already working on zss 0.56 that will begin logging (for 
>eventual chopping) on GOP header boundries, not on chunk/record boundries...
>
>Sorry for the HTML but I cut-n-pasted from my zss log (which can now 
>output in HTML, which does make reading the log quite a bit easier)... I 
>hope it didn't look too evil.
>
>Laterz,
>Roger "Merch" Merchberger