The difference between the RTMP/RTP/RTSP/RTCP

Source: Internet
Author: User
Tags rfc

summed up in a simple sentence: RTSP initiated/terminated streaming media, RTP transmission stream Media data, RTCP control of RTP, synchronization.

The reason for this is a bit confusing, because the CTC standard does not have RTCP requirements, so in the standard RTSP code does not see the relevant part. In the private RTSP code, the control, synchronization, etc., are implemented in the RTP header for extended definitions.

In addition, RFC3550 can be seen as a RFC1889 upgrade document, only to see RFC3550.

RTP

Real-time transport Protocol) is a Transport layer protocol for multimedia data streams on the Internet. The RTP protocol details the standard packet format for transmitting audio and video over the Internet. RTP is often used in streaming media systems (in conjunction with the RTCP protocol), video conferencing and one-click (Push to Talk) system (with H.323 or SIP), making it the technology base of the IP telephony industry. The RTP protocol is used in conjunction with the RTP Control protocol RTCP, and it is based on the UDP protocol.
RTP itself does not provide on-time delivery mechanisms or other quality of service (QoS) guarantees, it relies on low-level services to implement this process. RTP does not guarantee the transmission or prevention of disorderly transmission, nor is it certain of the reliability of the underlying network. RTP implementation of orderly transmission, RTP serial number allows the receiver to reorganize the sender's packet sequence, while the serial number can also be used to determine the appropriate packet location, for example: In video decoding, there is no need for sequential decoding.
RTP consists of two tightly linked parts: rtp― transmits data with real-time attributes, RTP Control Protocol (RTCP)-Monitors the quality of service and transmits information about ongoing session participants.
RTCP
Real-time Transport Control Protocol (Real-time Transport controls protocol or RTP Protocol or abbreviated RTCP) is a sister protocol for real-time Transport Protocol (RTP). RTCP provides channel (Out-of-band) control for RTP media streams. The RTCP itself does not transmit data, but it cooperates with RTP to package and send multimedia data. RTCP regularly transmits control data between streaming multimedia session participants. The main function of RTCP is to provide feedback on the quality of service (Quality of services) provided by RTP.

RTCP collects statistics on related media connections, such as bytes transmitted, transfer packets, lost packets, jitter, one-way and bidirectional network latency, and so on. Network applications can use the information provided by RTCP to try to improve the quality of service, such as restricting information traffic or using a compact codec instead. The RTCP itself does not provide data encryption or identity authentication. SRTCP can be used for such purposes.
SRTP & Srtcp
Secure real-time transport protocol (secure Real-time Transport protocol or SRTP) is a protocol defined on the basis of the real-time transport Protocol (Real-time Transport Protocol or RTP). The aim is to provide encryption, message authentication, integrity assurance, and replay protection for data in real-time transport protocols in unicast and multicast applications. It was developed by David Oran (Cisco) and Rolf Blom (Ericsson) and was first released by the IETF in March 2004 as RFC 3711.

Because the real-time transmission protocol and the Real-time Transmission Control Protocol (RTP/RTCP), which can be used to control the real-time transport protocol, are closely related, the secure real-time transport protocol also has a companion protocol, which is called secure real-time Transmission Control Protocol (protocol RTCP or SRTCP); secure real-time transmission control protocols provide similar security-related features for real-time transmission control protocols, just as those provided by secure real-time transport protocols for real-time transport protocols.

When using a real-time transport protocol or a real-time transport control protocol, enabling the use of secure real-time transport protocols or secure real-time transport control protocols is optional, but even with secure real-time transport protocols or secure real-time transport control protocols, all of their features (such as encryption and authentication) are optional, These attributes can be used or disabled independently. The only exception is that when using secure real-time transport control protocols, the message authentication feature must be used.


RTSP
RTSP (real Time streaming Protocol) is a multimedia streaming protocol used to control sound or video, and allows multiple streaming requirements to be controlled, and the network protocol used for transmission is not within the scope of its definition, The server side can optionally use TCP or UDP to deliver streaming content, which is similar in syntax and operation to HTTP 1.1, but does not specifically emphasize time synchronization, so it is more tolerant of network latency. The above mentioned allow simultaneous multiple stream demand control (multicast), in addition to reduce the server-side network usage, but also support multi-party video conferencing (conference). Because it is similar to the operation of the HTTP1.1, so proxy server "proxy" cache is also applicable to RTSP, and because RTSP has a redirect function, visual actual load situation to transform the service delivery server, To avoid delays due to the concentration of excessive load on the same server.
The relationship between RTSP and RTP

________________________________________________________________________________
RTP: Real-time Transfer Protocol (real-time transport Protocol)
RTP/RTCP is the protocol that actually transmits data
RTP Transmission of audio/video data, if the play,server is sent to the client side, if the record, can be sent by the client to the server
The RTP protocol consists of two closely related components: RTP data Protocol and RTP control Protocol (i.e. RTCP)
RTSP: Live Streaming Protocol (real time streaming protocol,rtsp)
RTSP request mainly has describe,setup,play,pause,teardown,options, as the name implies can know to play the role of dialogue and control
During the RTSP dialog, Setup can determine which ports rtp/rtcp uses, and Play/pause/teardown can start or stop RTP delivery, etc.
RTCP:
RTP/RTCP is the protocol that actually transmits data
RTCP includes sender and receiver, which are used for audio/video synchronization and other purposes, and are a control protocol

The following is an overview of each protocol:

First, RTP data protocol
The RTP data protocol is responsible for the packet of streaming media data and the real-time transmission of the media stream. Each RTP datagram consists of two parts of the head (header) and load (Payload), where the first 12 bytes of the head are fixed and the payload can be audio or video data. The header format of the RTP datagram is shown in Figure 1:


Some of the more important fields and their significance are as follows:
The Regulatory Commission (CC): Represents the number of identification for the CSRC. The CSRC logo, immediately following the RTP fixed head, is used to represent the source of the RTP datagram, which allows multiple data sources to be present in the same session, which can be merged into a single data source through the RTP mixer. For example, you could generate a list of the lists of the regulators to represent a conference call that combines the speech data of all speakers into a RTP data source through a RTP mixer.
Load Type (PT): Indicates the RTP load format, including the encoding algorithm used, sampling frequency, bearer channel and so on. For example, type 2 indicates that the RTP packet contains speech data encoded using the ITU g.721 algorithm, with a sampling frequency of 8000Hz and mono.
Serial number: Used to provide a way for the receiver to detect data loss, but how to handle lost data is an application's own business, and the RTP protocol itself is not responsible for retransmission of data.
Timestamp: The sample time of the first byte in the load is recorded, and the receiver can timestamp to determine whether the arrival of the data is affected by the delay jitter, but how to compensate for the delay jitter is the application's own business.

It is easy to see from the format of RTP datagram that it contains the type, format, serial number, time stamp and additional data of the transmission media, which provides the basis for streaming media transmission in real time. The RTP protocol is designed to provide end-to-end transport services for real-time data (such as interactive audio and video), so there is no concept of connectivity in RTP, which can be built on the underlying connection-oriented or connectionless transport protocol, and RTP does not rely on special network address formats, Only the underlying transport protocol support Group frames (Framing) and segments (segmentation) is sufficient, and RTP itself does not provide any reliability mechanisms, which are guaranteed by the transport protocol or the application itself. In typical applications, RTP is generally implemented as part of an application on the transport Protocol, as shown in Figure 2:

Second, RTCP Control protocol
The RTCP control protocol needs to be used in conjunction with the RTP data protocol, which uses two ports at the same time when the application initiates a RTP session, respectively, for both RTP and RTCP. RTP itself does not provide a reliable guarantee for the sequential transmission of packets, nor does it provide flow control and congestion control, which is done by RTCP. Usually RTCP will use the same distribution mechanism as RTP, periodically send control information to all members of the session, the application receives the data, obtains the relevant data of the session participant, and the network condition, the packet loss probability and other feedback information, It can control the quality of the service or diagnose the network condition.

The functions of the RTCP protocol are implemented through different RTCP datagrams, which are mainly as follows:
SR: The sender side reports that the sender is the application or terminal that emits the RTP datagram, and the sender can also be the receiving end.
RR: The receiving end reports that the receiver is an application or terminal that only receives but does not send RTP datagrams.
SDEs: Source Description, the main function is as a session member of the identity information of the carrier, such as user name, mail address, telephone number, in addition to the session members to communicate the control information function.
BYE: Notify departure, the main function is to indicate that one or several sources are no longer valid, that is, notify the other members of the session themselves will exit the session.
App: defined by the application itself, solves the RTCP extensibility problem and provides a lot of flexibility for the implementation of the Protocol.

The RTCP datagram carries the necessary information of service quality monitoring, can adjust the service quality dynamically, and can control the network congestion effectively. Because the RTCP datagram is multicast, all members of the session can understand the current situation of other participants through the control information returned by the RTCP datagram.
In a typical application scenario, an application that sends a streaming stream will periodically generate a send-side report SR, which contains synchronization information between different media streams, and a count of datagrams and bytes that have been sent, based on which the receiver can estimate the actual data transfer rate (RTCP). On the other hand, the receiving end sends a receive-side report RR to all known senders, which contains important information such as the maximum serial number of the received datagram, the number of lost datagrams, delay jitter, and time stamp, which can be used to estimate the round-trip delay based on this information, The transmission rate can be adjusted dynamically according to the loss probability and delay jitter of the datagram to improve the network congestion condition, or adjust the service quality of the application smoothly according to the network condition.

Iii. RTSP Real-time Streaming protocol
As an application layer protocol, RTSP provides an extensible framework that makes it possible to control and demand real-time streaming media data. In general, RTSP is a streaming media representation protocol that is used primarily to control the sending of data with real-time characteristics, but it does not transmit data itself, but must rely on some services provided by the underlying transport protocol. RTSP can provide streaming media such as playback, pause, fast-forward and so on, it is responsible for defining specific control messages, operating methods, status codes, in addition to the interaction between RTP (RFC2326).

RTSP in the formulation of more reference to the http/1.1 protocol, and even many descriptions and http/1.1 exactly the same. RTSP's deliberate use of syntax and operations similar to http/1.1 is largely intended to be compatible with the existing Web infrastructure, which is why the http/1.1 extension mechanism can be introduced directly into RTSP.
A collection of media streams controlled by RTSP can be defined by a presentation description (presentation Description), which refers to a collection of one or more media streams that the streaming media server provides to the client, and the description contains information about each media stream in the such as data encoding/decoding algorithm, network address, the content of the media stream.
Although the RTSP server also uses identifiers to differentiate each class of connection sessions (session), the RTSP connection is not bound to a transport layer connection (such as TCP), which means that during the entire RTSP connection, RTSP users can turn on or off multiple reliable transport connections to the RTSP server to issue RTSP requests. In addition, RTSP connections can be based on connectionless transport protocols such as UDP.

The RTSP protocol currently supports the following operations:
Retrieving media: Allows a user to submit a presentation description to the media server via HTTP or other means. If the representation is multicast, the description contains the multicast address and port number for the media stream, and if the representation is unicast, only the destination address should be provided for security in the presentation description.
Invitation to join: A media server can be invited to participate in an ongoing meeting, or play back the media in a presentation, or record all media or a subset of it in the presentation, which is ideal for distributed teaching.

Add media: Notifies users of newly added available media streams, which is especially useful for live lectures. Similar to http/1.1, RTSP requests can be handled by proxies, channels, or caches.

RTMP VS tcp&udp (2011-08-30 10:57:53) reprint

Tags: topics Category: Audio and video

1, TCP is a point-to-point protocol, which means that each customer needs to separate client/server links, so that data broadcasts to multiple clients cannot be implemented at the network level. If a data stream must be delivered to multiple clients at the same time, the server must transmit a copy of the data stream to each client, and TCP can dynamically adjust the transmission speed and resend the lost packet according to network bandwidth and congestion, so that although the reliability of data transmission is ensured, the server resource is expensive, In the case of large data flow, it is difficult to ensure the real-time transmission of data stream.

2, UDP is unreliable transmission protocol, at the sender, the speed of UDP transmission data is only the speed of data generated by the application, the computer's ability and transmission bandwidth constraints; At the receiving end, UDP places each message segment in the queue, and the application reads a message segment from the queue each time.

The UDP protocol does not need to maintain the connection state, nor does it think that each packet must reach the receiving end, so the network load is smaller than TCP, and the transmission speed is faster than TCP, but more packets are lost when the network becomes more congested.

3, the RTMP protocol is a protocol designed specifically for the efficient transmission of video, audio and data. It enables real-time video and sound transmission by establishing a binary TCP connection or connecting to an HTTP tunnel.

A shared object is a relatively important data type in rtmp data, and when any client changes data, the shared object can update the server-side data in a timely manner, so that each client can be informed of the data changes in a timely manner.

RTMP supports more media protocols than traditional media servers. It supports dynamic transmission of multiple lines that may contain sound, image and script data from the server to the customer and from the client to the server. Rtmp the sound, image, and scripting data separately.

Sound and video data are separately buffered in the server. If the sound data reaches a certain limit in the sound buffer, all data in the buffer will be discarded, and the recently arrived data is allowed to begin to collect in the buffer and be sent to each customer. Video data is handled in a similar way, but the data in the buffer is cleared when new keyframes arrive. When the old frame data is discarded, if the client's data is found to be incorrect, the old and new two different frames are fitted.

Rtmp gives different priority to the data. In real-time conversations, sound is the most important, the image is given a low priority, and the priority given by the script data is between the sound and the image.

The RTMP protocol can create multiple data streams, but only one direction per data flow.

RTMP can be used to build a system in which clients can interact with the RTMP server and application server at the same time, allowing the service-side load to be dispersed, although the performance requirements of the RTMP server are higher in this improved system architecture.



rtmp:real Time Messaging Protocol (live messaging protocol)
The RTMP (the real-time messaging Protocol) protocol is a client-and server-side transport protocol, a TCP/IP protocol designed specifically for the efficient transmission of video, audio, and data, and data transmitted using the RTMP protocol is unencrypted. Includes authentication information such as user name and password.
Category: Adobe

rtp:real-time Transport Protocol (real-time Transfer Protocol)
Real-time Transfer Protocol (RTP) provides data with real-time characteristics of end-to-end delivery services, such as interactive video audio or analog data under a multicast or unicast network service. Applications typically run RTP on UDP to use their multiple node and checksum services, both of which provide the Transport layer protocol functionality. However, RTP can be used in conjunction with other suitable underlying network or transport protocols.
Category: IETF
Source: RFC 3550

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.