Introduction to Rtps Streaming media

Source: Internet
Author: User

Introduction to RTSP Data flow:
Rtsp_header + Rtp_header + 1, Video: Nalu_header (type*) + Fu_header
2, Audio: + audio data;

Rtsp_header Payloadlen = packet length after Rtsp_header;
dollar = (0x24);

Rtp_header payloadtype = data type (H264, g711_a, G711_u, MPEG ....) );

TimeStamp = timestamp of the current package;

Version = 2;

sequencenumber= package sequence number, increment +1;


Nalu_header type (Nal_unit_type) = 1, seq_parameter_set_rbsp (7): Keyframe, take the height and width of the frame;
2, slice_layer_without_partitioning_rbsp to Single_time_aggregation_packet_a, before the data need to add rtp_start_code;

Fu_header start_bit = 1, first package, need to add Rtp_start_code + (Fu_header.nri << 5) | (fu_header.forbidden_zero_bit << 6) | Fu_header.type;

Audio data: Add Rtp_audio_code before each package;

Class Rtsp_header
{
public byte dollar; /* 8, $:d ollar sign (in decimal) */
public byte Channelid; /* 8, Channel ID */
public short Payloadlen; /*, Payload length */

}


Class Rtp_header
{
Public byte csrccount;//4 bit;
Public byte extension;//1 bit;
Public byte padding;//1 bit;
Public byte version;//2 bit;
Public byte payloadtype;//7 bit;
Public byte marker;//1 bit;
public short SequenceNumber;
public long TimeStamp;
public int ssrc;

}


Class Nalu_header
{
Public byte type;//: 5 bit;
Public byte nri;//: 2 bit;
Public byte forbidden_zero_bit;//: 1 bit;

}


Class Fu_header
{
Public byte type;//: 5 bit; Same as the type in Nalu in the original data
Public byte reserve_bit;//: 1 bit; Reserved bit, must be 0
Public byte end_bit;//: 1 bit; Indicates whether the last shard of this frame
Public byte start_bit;//: 1 bit; Indicates whether the first shard of this frame

}


Public final byte[] Rtp_start_code = new byte[] {0x00, 0x00, 0x00, 0x01};
Public final byte[] Rtp_audio_code = new byte[] {0x00, 0x01, (byte) 0xA0, 0x00};

Introduction to Rtps Streaming media

Related Article

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.