H. rtppayload format-------H. Video RTP payload format

Source: Internet
Author: User

H. rtppayload format------

H. A video RTP payload format

1. Network Abstraction Layer Unit type (NALU)

The Nalu header consists of a byte with the following syntax:

+---------------+
|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+
| F|  nri| Type |
+---------------+

F:1 bits (no bit).
Forbidden_zero_bit. This one must be 0, as stipulated in the H.

Nri:2 a bit.
NAL_REF_IDC. taking 00 ~ 11, it seems to indicate the importance of this nalu, such as 00 of the Nalu decoder can discard it without affecting the playback of the image. However, this attribute is not generally a concern.

Type:5 a bit.
Nal_unit_type. The type of this NALU unit is summarized as follows:

0 Not defined
1-23 nal Unit single NAL unit package.
Stap-a Single-time combo package
Stap-b Single-time combo pack
MTAP16 Multi-time combo pack
MTAP24 Multi-time combo pack
Fu-a Shards of cells
Elements of Fu-b shards
30-31 Not defined

2. Packaging mode

The following is the structure of the RTP header as specified in RFC 3550 (12 bytes).

0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 34 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| v=2| p|  X| CC |    m|       PT | SequenceNumber |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Synchronization source (SSRC) identifier |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| Contributing Source (CSRC) identifiers |
| ....                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Load type payload type (PT): 7 bits
Serial sequence Number (SN): Bits
Timestamp timestamp:32 bits

The H. Payload format defines three different basic load (PAYLOAD) structures. The receiving end may identify them through the first byte of the RTP Payload. This byte resembles the Nalu header format, and the header structure of the NAL The cell Type field indicates which structure is represented,

The structure of this byte is as follows, it can be seen that it is the same as H. NALU head structure.
+---------------+
|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+
| F|  nri| Type |
+---------------+
Field type: The type of the Nal cell in this RTP payload. The difference between this field and the Type field in H. 24 is that when the value of type is 31, it means that this is a special format of the NAL unit, and that only the value of 1~23 is valid in H.

Stap-a Single-time combo package
Stap-b Single-time combo pack
MTAP16 Multi-time combo pack
MTAP24 Multi-time combo pack
Fu-a Shards of cells
Elements of Fu-b shards
30-31 Not defined

Possible types of structures are:

1. Single NAL unit mode
That is, a RTP packet consists only of a complete nalu. In this case, the RTP NAL header Type field is the same as the original H. Nalu Header Type field.

2. Combo Packet mode
This may be a RTP package consisting of multiple NAL units. There are 4 combinations: stap-a, Stap-b, MTAP16, MTAP24. The type values here are 24, 25, 26, and 27, respectively.

3. Shard Packet Mode
Used to encapsulate a NALU unit into multiple RTP packets. There are two types of fu-a and fu-b. The type values are 28 and 29, respectively.

2.1 Single NAL unit mode

For NALU packets with a length less than the MTU size, a single nal cell pattern is generally used.
For an original H. Nalu unit is usually composed of [start code] [Nalu Header] [Nalu Payload] Three parts, where start code is used to indicate that this is the beginning of a NALU unit, must be "00 00 00 01" or "Nalu", the head only one byte, followed by the Nalu unit content.
When packaging, remove the "00 00 01" or "00 00 00 01" Of the start code, the other data packets to the RTP packet.

0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| F|  nri|                                              Type | |
+-+-+-+-+-+-+-+-+                                              |
| |
| Bytes 2..N of a single Nalunit |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :... OPTIONAL RTP Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


If there is a nalu of H. S:

[xx] A0 1E 0E 2F ...]

This is a sequence parameter set of nal cells. [00 00 00 01] is the start code of four bytes, 67 is the NALU header, and 42 begins with the Nalu content. Package into RTP package will be as follows:

[RTP Header] [A0 1E 0E 2F]

That is, just get rid of the 4-byte start code.


2.2 Combo Packet Mode

Second, when the length of the Nalu is special, several NALU units can be sealed in a RTP packet.


0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Rtpheader |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Stap-a NAL hdr| Nalu 1Size | Nalu 1HDR |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Nalu 1 Data |
:                                                              :
+              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | Nalu 2Size | Nalu 2 HDR |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Nalu 2 Data |
:                                                              :
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :... OPTIONAL RTP Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


2.3 Fragmentation Units (FUs).

When the length of the Nalu exceeds the MTU, the NALU unit must be fragmented. Also known as Fragmentation Units (FUs).

0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   FU Indicator |                              Fuheader | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                              |
| |
| FU Payload |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :... OPTIONAL RTP Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Figure 14. RTP Payload format for FU-A

The Fuindicator octet has the following format:

+---------------+
|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+
| F|  nri| Type |
+---------------+

The FU headerhas the following format:

+---------------+
|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+
| s| e|  r| Type |
+---------------+


3. SDP Parameters

The following describes how to represent a h: stream in the SDP.

. The media name in the "m=" line must be "video"
. The encoding name in the "A=rtpmap" line must be "H264".
. The clock frequency in the "A=rtpmap" line must be 90000.
. Other parameters are included in the "A=fmtp" line.

Such as:

M=video 49170 rtp/avp98
A=rtpmap:98 h264/90000
A=fmtp:98 profile-level-id=42a01e;sprop-parameter-sets=z0iacpztbymi,amljia==

Some common parameters are described below.

3.1packetization-mode:
Represents the supported packet pattern.
When the value of Packetization-mode is 0 o'clock or does not exist, a single Nalu cell mode must be used.
Non-interleaved (non-interleaved) encapsulation mode must be used when the value of Packetization-mode is 1.
When the value of Packetization-mode is 2, the Interleaved (interleaved) packet mode must be used.
This parameter is not allowed to take other values.

3.2sprop-parameter-sets:
This parameter can be used to transfer the sequence parameter set and image parameter of H. NAL Unit. The value of this parameter is encoded with BASE64. Separate parameter sets are separated by "," numbers.

3.3 Profile-level-id:
This parameter is used to indicate the profile type and level of H. 3 bytes represented by BASE16 (hexadecimal). The first byte represents the profile type of H.

The three bytes represent the profile level of H +:

3.4 max-mbps:
The value of this parameter is an integral type, which indicates the maximum processing speed of the macro block per second.

H. rtppayload format-------H. Video RTP payload format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.