[Mp4-tech] Need Information about Parsing of MPEG-4 Transport Stream

Peter Schirling schirlin us.ibm.com
Mon Jun 20 14:05:37 EDT 2005


Joshi,
Transport Stream syntax is the same whether MPEG-2 or AVC is carried in the
multiplex.  Likewise, PES packets headers the same. What changes are codes
that identify the various MPEG video and audio standards. As I indicated,
in order to handle all the information correctly you will need to obtain a
copy of ISO/IEC 13818-1. An email reflector is not the place for this
discussion.
Pete Schirling
Digital Media Standards
IBM Research
Office: +1 802 769 6123/Mobile: +1 802 238 2036/E-Fax: +1 802 769 7362
Internet e-mail: schirlin us.ibm.com
             "Joshi"                                                       
             <cmjoshi dlink.co                                             
             .in>                                                       To 
                                       Peter                               
             06/19/2005 03:30          Schirling/Burlington/IBM IBMUS,     
             PM                        "MPEG4" <mp4-tech lists.mpegif.org> 
                                                                        cc 
                                                                   Subject 
                                       RE: [Mp4-tech] Need Information     
                                       about Parsing of MPEG-4 Transport   
                                       Stream                              
Dear Mr. Peter,
Thanks for your reply.
I have few more doubts.
1.  Whether MPEG-4 use the same header format as that of MPEG-2
Transport Stream.
2.  According to my understanding, every frame of data starts with a
SYNC Byte, which is indicated by 0x47.  The following data structure
kind of thing I am using
      typedef struct {
                unsigned int sync_byte :8;
                unsigned int transport_err_inc :1;
                unsigned int payload_start :1;
                unsigned int transport_prio :1;
                unsigned int pid :13;
                unsigned int transport_scrambling_control :2;
                unsigned int adap_field_control :2;
                unsigned int continuity_counter :4;
}mpeg_ts_header;
The payload_start, indicates whether the Payload is starting (Start of
Frame) is present.  Further subsequent headers need not have the
payload_start bit as '1', till the completion of the current frame, and
start of the next frame.
I am parsing the buffer, byte by byte in order to know the occurrence of
sync_byte (0x47) and corresponding payload_start bit as '1'.  I am
getting the pattern which is shown below
This is for MPEG-2 Transport Stream.
Note:  Here Starting Index is the point where 0x47 (Sync Byte)  is found
and corresponding payload_start is also '1'.  Buffer length was 10 KB.
Frame starts Starting Index = 623
Frame starts Starting Index = 1033          Difference = 410
Frame starts Starting Index = 1304          Difference = 271
Frame starts Starting Index = 3125          Difference = 1821
Frame starts Starting Index = 4067          Difference = 942
Frame starts Starting Index = 5195          Difference = 1128
Frame starts Starting Index = 5972          Difference = 777
Frame starts Starting Index = 6032          Difference = 60
Frame starts Starting Index = 6103          Difference = 71
Frame starts Starting Index = 6125          Difference = 22
Frame starts Starting Index = 6407          Difference = 282
Frame starts Starting Index = 6545          Difference = 138
Frame starts Starting Index = 6566          Difference = 21
Frame starts Starting Index = 7121          Difference = 555
Frame starts Starting Index = 8108          Difference = 987
Frame starts Starting Index = 8834          Difference = 726
Frame starts Starting Index = 8970          Difference = 136
Frame starts Starting Index = 9078          Difference = 108
Frame starts Starting Index = 9174          Difference = 96
Frame starts Starting Index = 9193          Difference = 19
Frame starts Starting Index = 9208          Difference = 15
Frame starts Starting Index = 9221          Difference = 13
Frame starts Starting Index = 9311          Difference = 90
Frame starts Starting Index = 9393          Difference = 82
Frame starts Starting Index = 9501          Difference = 108
Frame starts Starting Index = 9902          Difference = 401
My Doubt is why the Difference is not multiple of 188 bytes?.  On what
logic I need to fragment this?
Can any of you pls share me the Frame formats for MPEG-4, H.263
Transport Stream Header if it is different from the MPEG-2 Transport
Stream System.  Pls let me know.
Pls comment.
Regards,
Joshi
-----Original Message-----
From: Peter Schirling [mailto:schirlin us.ibm.com]
Sent: Saturday, June 18, 2023 6:30 PM
To: Joshi
Subject: Re: [Mp4-tech] Need Information about Parsing of MPEG-4
Transport Stream
Joshi,
What you have is MPEG- 4 video over MPEG-2 Transport Stream. In order to
demux you need to obtain the MPEG-2 Systems Standards
ISO/IEC 13818-1 from:
   India (BIS)
   Address
                  Bureau of Indian Standards
                  Manak Bhavan
                  9 Bahadur Shah Zafar Marg
                  IN-New Delhi 110002
   Tel
                  +91 11 23 23 79 91
   Fax
                  +91 11 23 23 93 99
   E-mail
                  ird bis.org.in
   Web
                  http://www.bis.org.in
Pete Schirling
Digital Media Standards
IBM Research
Office: +1 802 769 6123/Mobile: +1 802 238 2036/E-Fax: +1 802 769 7362
Internet e-mail: schirlin us.ibm.com
             "Joshi"
             <cmjoshi dlink.co
             .in>
To
             Sent by:                  "MPEG4"
<mp4-tech lists.mpegif.org>
             mp4-tech-bounces@
cc
             lists.mpegif.org
Subject
                                       [Mp4-tech] Need Information about
             06/18/2005 07:03          Parsing of MPEG-4 Transport
Stream
             PM
Hi,
I do have Mpeg 4 Transport Stream data reading from an Encoder (Video
ONLY
- VES).  I am reading (188 * 10) = 1880 bytes in a buffer.  I need to
parse
this Data, in order to know the end of Frame(s) in it. In other words i
need to know End of one frame and beginning of next frame.
This is very much important for me because, I need to Fragment this data
(corresponding to single frame) into Smaller chunks of length equal to
multiple of 188 bytes.   For the Last chunk I need to assign the Marker
Bit
as '1' because I use RTP as my Transport protocol.
Note:
Out of 188 bytes, 4 bytes will be header.  Can i get information about
end
Start of New Frame in it?
Does this 4 Byte Header Pattern vary across the other formats like
MPEG-2
TS, H.263 TS, H.264 TS.
Pls Comment.
Regards,
Joshi.
Dlink India Limited, Bangalore.
 _______________________________________________
NOTE: Please use clear subject lines for your posts. Include [audio,
[video], [systems], [general] or another apppropriate identifier to
indicate the type of question you have.
Note: Conduct on the mailing list is subject to the Antitrust guidelines
found at
http://www.mpegif.org/public/documents/vault/mp-out-30042-Antitrust.php


More information about the Mp4-tech mailing list