View Full Version : Payload Start in M2TS
Cedvano
24th February 2013, 21:47
Hi,
I'm trying to determine the "payload offset unit start" in a M2TS file.
I do not know what calculate offsets.
Can you help me?
http://cdn.imghack.se/medium/aa0e226beb9c56b23f9e46a67a144b06.jpg (http://www.imghack.se/87953)
PES start is surrounded.
H264 video start a red line [00 00 00 01 09...].
and the next PES, video start at [2E 76 69 64...]
Thanks in advance.
Guest
25th February 2013, 00:37
"payload offset unit start" is some kind of neologism. I will assume you are looking for the location of the payload_unit_start_indicator. M2TS is standard TS with a 4-byte timestamp ahead of the sync byte, so you can refer to the 13818-1 spec. Here is a breakdown for the first packet of your example:
11 3B FE 12: timestamp
47: sync byte
10:
bit 7: transport_error_indicator
bit 6: payload_unit_start_indicator
bit 5: transport_priority
The remaining bits of the 10 and the following byte are the PID.
sync_byte – The sync_byte is a fixed 8-bit field whose value is '0100 0111' (0x47). Sync_byte emulation in the choice of values for other regularly occurring fields, such as PID, should be avoided.
transport_error_indicator – The transport_error_indicator is a 1-bit flag. When set to '1' it indicates that at least 1 uncorrectable bit error exists in the associated Transport Stream packet. This bit may be set to '1' by entities external to the transport layer. When set to '1' this bit shall not be reset to '0' unless the bit value(s) in error have been corrected.
payload_unit_start_indicator – The payload_unit_start_indicator is a 1-bit flag which has normative meaning for Transport Stream packets that carry PES packets (refer to 2.4.3.6) or PSI data (refer to 2.4.4). When the payload of the Transport Stream packet contains PES packet data, the payload_unit_start_indicator has the following significance: a '1' indicates that the payload of this Transport Stream packet will commence with the first byte of a PES packet and a '0' indicates no PES packet shall start in this Transport Stream packet. If the payload_unit_start_indicator is set to '1', then one and only one PES packet starts in this Transport Stream packet. This also applies to private streams of stream_type 6 (refer to Table 2-29). When the payload of the Transport Stream packet contains PSI data, the payload_unit_start_indicator has the following significance: if the Transport Stream packet carries the first byte of a PSI section, the payload_unit_start_indicator value shall be '1', indicating that the first byte of the payload of this Transport Stream packet carries the pointer_field. If the Transport Stream packet does not carry the first byte of a PSI section, the payload_unit_start_indicator value shall be '0', indicating that there is no pointer_field in the payload. Refer to 2.4.4.1 and 2.4.4.2. This also applies to private streams of stream_type 5 (refer to Table 2-29). For null packets the payload_unit_start_indicator shall be set to '0'. The meaning of this bit for Transport Stream packets carrying only private data is not defined in this Specification.
transport_priority – The transport_priority is a 1-bit indicator. When set to '1' it indicates that the associated packet is of greater priority than other packets having the same PID which do not have the bit set to '1'. The transport mechanism can use this to prioritize its data within an elementary stream. Depending on the application the transport_priority field may be coded regardless of the PID or within one PID only. This field may be changed by channel specific encoders or
decoders.
PID – The PID is a 13-bit field, indicating the type of the data stored in the packet payload. PID value 0x0000 is
reserved for the Program Association Table (see Table 2-25). PID value 0x0001 is reserved for the Conditional Access Table (see Table 2-27). PID values 0x0002 – 0x000F are reserved. PID value 0x1FFF is reserved for null packets (see Table 2-3).
Your dump shows 2 full packets and the start of a third. The second one contains an AVC access unit delimiter (AUD) NALU (00 00 01 09), which marks the start of a picture, and so we expect the payload_unit_start_indicator to be set for that packet, and it is indeed set.
Refer to the spec for more detail.
Maybe I can help you further if you describe what you are trying to accomplish. I'm amazed to see this in Newbies, BTW!
Cedvano
25th February 2013, 10:30
Thank you very much for your help.
I try to create a program like 'tsMuxeR'. But who will take care of the 'H264 AVC / MVC'.
I analyzed several source code. (TsRemuxer. ..) and read somes tuto on web.
But each had a different method of calculation. With you explications I can advance in my project.
Thanks
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.