rtsp stack

What is the rtsp protocol?

RTSP (RealTimeStreamingProtocol), the Real-Time Streaming Transport Protocol, is an application-layer protocol in the TCP/IP protocol architecture, an IETFRFC standard submitted by Columbia University, Netscape, and RealNetworks. The protocol defines how a one-to-many application can efficiently deliver multimedia data over an IP network. rtsp sits on top of rtp and rtcp in terms of architecture, and uses either tcp or rtp to accomplish the data transfer. http is compared to rtsp, which transmits html, whereas rtsp transmits multimedia data. an http request is sent by the client and responded to by the server. RTSP is used when both the client and the server can send requests, i.e. RTSP can be bi-directional.

The above is Baidu Encyclopedia

The following is some personal understanding, generally these protocols are at the same time,

RTSP: Real-Time Streaming Control Protocol (Real-TimeStreamingProtocol).

RTCP: Real-Time Transport Control Protocol (RealtimeTransportControlProtocol).

UDP: UserDatagramProtocol.

RTP: RealtimeTransportProtocol.

RTSP controls commands for locating streaming media (e.g., video and audio), initializing a streaming connection, playing, pausing, continuing, stopping, etc.

RTCP is a control protocol over RTP that provides feedback on the quality of data distribution, such as the traffic flow of the message, and determining whether UDP has been disconnected;

UDP Streaming Transport, the unreliable transport protocol that transmits streaming data;

RTP: details the standard packet format for delivering audio and video over the Internet.The sequence number in RTP allows the receiver to reorganize the sender’s packet sequence, and also the sequence number can be used to determine the appropriate packet location, e.g., in video decoding there is no need for a sequential decode

What network transport protocol is rtsp? What are the characteristics

RealTimeStreamingProtocol(RTSP) is proposed by RealNetworks and Netscape.The

protocol defines how a one-to-many application can efficiently deliver multimedia data over an IP network.RTSP is located on top of RTP

and RTCP in terms of architecture. RTSP sits architecturally on top of RTP

and RTCP, and uses either TCP or RTP to accomplish the data transfer. HTTP transmits HTML, while RTSP transmits

multimedia data. HTTP requests are sent by the client and responded to by the server, whereas with RTSP, both the client and the server can send requests, which can be bi-directional, i.e., RTSP can be bi-directional. That is, RTSP can be bidirectional.

6.3 RTSP Protocol

The Real-Time Streaming Protocol (RTSP) is an application-level protocol that controls the delivery of real-time data.RTSP provides an extensible framework that enables the controlled, on-demand delivery of

real-time data, such as audio and video. Data sources include live data and data stored in clips

. The purpose of the protocol is to control multiple data sending connections, to provide a means for selecting sending channels, such as UDP, multicast UDP, and TCP

, and to provide a means for selecting a sending mechanism based on RTP.

6.3.1 Introduction Purpose

The Real-Time Streaming Protocol (RTSP) establishes and controls one or several time-synchronized continuous streams of media. Although it is possible for a continuous media stream to intersect* with a control

stream, it does not normally send a continuous stream itself. In other words, RTSP acts as a network remote control

of the multimedia server.The RTSP connection is not bound to a transport layer connection, such as TCP.During an RTSP connection, the RTSP user can open or close multiple *transportable* connections to the

server to make RTSP requests. In addition, a connectionless transport protocol, such as UDP, may be used.RTSP Stream Control

Streams may use RTP, but RTSP operations do not rely on the transport mechanism used to carry continuous media. The Real-Time Streaming Protocol is syntactically and operationally

similar to HTTP/1.1, so most of HTTP’s extension mechanisms can be added to RTSP. The operations supported by the protocol are as follows:

Retrieving media from a media server:

The user can submit a description of a demo via HTTP or other methods. If the presentation is multicast, the presentation contains the multicast address and port to be used for sequential media

. If the presentation is sent to the user via unicast only, the user should provide the destination address for security purposes.

Media Server Invitation to Conference:

A media server can be invited to participate in an ongoing conference, or to play back media, or to record part of it, or all of it. This mode

is useful in distributed educational applications, where several parties in a conference can take turns pressing remote control buttons.

Adding media to an existing lecture:

Particularly useful for live lectures is when the server tells the user that additional media content is available. As in HTTP/1.1, RTSP

requests can be handled by proxies, channels and caches. Protocol Features

The RTSP features are as follows:


New methods and parameters can be easily added to RTSP.

Easy to Parse:

RTSP can be parsed by a standard HTTP or MIME desorber.


RTSP uses web security mechanisms.

Transport independent:

RTSP can use the Un*datagram Protocol (UDP), the *Datagram Protocol (RDP), or, for application-level *ability, the *Streamable Protocol


Multi-server support:

Each stream can be placed on different servers, the user side automatically establishes several concurrent control connections with different servers, and media synchronization is performed at the

transport layer.

Recording device control:

The protocol can control recording and playback devices.

Separation of flow control from conference start:

Only required to be provided by the conference initialization protocol, or available to create a unique conference identification number. In special cases, SIP or H.323

can be used to invite servers into the conference.

Suitable for professional applications:

RTSP supports frame-level accuracy via SMPTE time stamps, allowing remote digital editing

Presentation description neutral:

The protocol does not impose special presentations or metafiles, and the type of format used can be transmitted; however, presentation descriptions must contain at least one RTSP


Proxy and firewall friendly. p>Proxy and firewall friendly:

Protocols can be handled by application and transport layer firewalls. Firewalls need to understand the SETUP method to open a “missing

port” for UDP media streams.

HTTP Friendly:

Here, RTSP wisely adopts the HTTP concept to make the current architecture reusable. The architecture includes the Platform for Internet Content Selection

(PICS). Since controlling continuous media in most cases requires server state, RTSP doesn’t just add methods to HTTP

. Proper server control:

If a user starts a stream, he must and can stop a stream.

Transport coordination;

The user can coordinate transport methods before actually processing successive media streams.

Performance coordination:

If the basic features are not valid, there must be some cleanup mechanism that allows the user to decide which method did not work. This allows the user to propose a suitable

user interface. Extending RTSP

Since not all media servers have the same functionality, it is necessary for media servers to support different sets of requests.RTSP can be extended in three ways, in this case by changing the size:

Extended with new parameters. If the user requires a rejection notification and the method extension does not support it, the corresponding token is added to the requested segment.

Added with new method. If the recipient of the message does not understand the request and returns a 501 error code (not yet implemented), the sender should not try this method again

. The user can query the server for supported methods using the OPTIONS method. The server lists the supported

methods using the public response header.

Defining a new version of the protocol allows all parts to be changed. (except for the protocol version number location) Modes of Operation

Each presentation and media stream can be identified with an RTSP URL. The entire presentation and media attributes of a presentation composition are defined by the presentation description file

. This file is available to the user using HTTP or other means and it is not necessary to save it on the media server.

For the sake of illustration, assume that the demo description describes multiple demos, where each demo maintains a common timeline. For simplicity

and without loss of generality, assume that the demo description does contain such a demo. A demo may contain multiple media streams. In addition to the number of media parameters

, the network destination address and port also need to be determined. The following distinguishes between several modes of operation:


Send the media to the RTSP request source on a port number selected by the user.

Multicast, server-selected address:

The media server selects the multicast address and port, which is commonly used for live or quasi-on demand broadcasts.

Multicast, user-selected address:

If the server joins an ongoing multicast conference, the multicast address, port and secret key are given by the conference description. RTSP Status

RTSP controls streams sent over a separate protocol, independent of the control channel. For example, RTSP control can be over a TCP connection while the data

stream passes through UDP. therefore, data continues to be sent even if the media server does not receive a request. During the lifetime of a connection, individual

media streams can be controlled by sequentially issuing requests over different TCP connections. Therefore, the server needs to maintain a

connection state that can contact the stream with an RTSP request.Many of the methods in RTSP are not related to state, but the following methods play an

important role in defining the allocation and application of resources to the server’s streams:


Allows the server to allocate resources to the stream and initiate an RTSP connection.


Initiates data transfer for SETUP allocation streams.


Temporarily stops the stream without releasing server resources.


Releases the resources of the stream and the RTSP connection stops.

The RTSP method of identifying status uses the connection header segment to identify the RTSP connection, and in response to a SETUP request, the server connection

generates a connection identification. Relationships with Other Protocols

RTSP overlaps functionally with HTTP, and the interaction with HTTP is reflected in the fact that the initial contact with the content of the stream is through a Web page. The purpose of the current protocol specification

is to allow for different delivery points between the web server and the media server implementing RTSP. For example,

presentation descriptions can be retrieved over both HTTP and RTSP, which reduces the round-trip delivery from the browser and also allows for independent RTSP servers to communicate with the user

without relying exclusively on *HTTP.

However, RTSP differs fundamentally from HTTP in that the data is sent over a different protocol.

In RTSP, both the media user and the server can issue requests, and their requests are stateless

; parameters can be set to control the media stream long after the request has been acknowledged. Reusing HTTP functionality is good

in at least two ways: security and proxying. The requirements are so close that there is value in employing HTTP functionality for caching, proxying, and authorization.

RTSP is not bound to RTP when most real-time media use RTP as the transport protocol.RTSP assumes the existence of presentation description grids

formulas that can represent the static and temporary attributes of presentations containing several media streams.

RTSP is not bound to RTP when most real-time media use RTP as the transport protocol.

6.3.2 Protocol Parameters

6.3.3 RTSP Information

RTSP is a text-based protocol with the ISO 10646 character set using the UTF-8 encoding scheme. Lines are interrupted with CRLF, but

the receiver itself can interpret CR and LF as line terminators. The text-based protocol makes it easier to add optional parameters in a self-describing manner

. Due to the low number of parameters and the frequency of commands, processing efficiency is not noted. If examined closely, text-based protocols can be easily

implemented in scripting languages (e.g., Tcl, VisualBasic, & Perl) for research prototypes.

The 10646 character set avoids sensitive character set switching, but is not visible to applications.RTCP also uses this encoding scheme. ISO 8859-1 characters with

significance bits represent e.g. 100001x10xxxxxxxx.. the RTSP message can be carried over any low-layer transport protocol


The request includes the method, the object on which the method acts, and parameters that further describe the method. Methods may also be designed to require little or no state maintenance on the server

side. When a body of information is included in a message, the length of the body is determined by the following:

Response messages that do not include a body of information are always terminated with the first and empty line after the header segment, regardless of whether the entity header segment appears in the message.

If the content length header segment appears, its value, in bytes, indicates the length of the message body. If no header segment appears, the value is zero.

The server closes the connection.

Note: RTSP does not currently support the HTTP/1.1 “block” transport encoding, which requires a content-length header. If a modest presentation description is returned

description length should be able to be determined by the server, even if it is dynamically generated, making block transfer encoding unnecessary. If there is an entity that

must have a content length, and the length is not explicitly given, the rules ensure reasonable behavior.

The request information from the user to the server side includes in the first line the method used by the source, the source identification and the version of the protocol used.RTSP

Additional status codes are defined without defining any HTTP codes.

6.3.4 Entities

If not restricted by the request method or response status code, request and response messages may transmit entities, which consist of an entity header file and a test

body, with some responses consisting of entity headers only. In this context, depending on who sends the entity and who receives the entity, the sender and receiver may

refer to the user and the server, respectively.

The entity header defines optional meta-information about the entity body, and if there is no entity body, refers to the resource identified by the request. The extended header mechanism allows the definition of additional

additional entity header segments without changing the protocol, but these segments cannot be assumed to be recognizable by the recipient. Unrecognizable header segments should be ignored

by the receiver and left to be forwarded by the proxy.

6.3.5 Connections

RTSP requests can be transmitted in several different ways:

1. Persistent transport connections for multiple request/response transmissions.

2. One connection per request/response transmission.

3. Connectionless mode.

The transport connection type is defined by the RTSPURI. For the “rtsp” scenario, a persistent connection is required; for the “rtspu” scenario, the call

RTSP request is sent without establishing a connection.

Unlike HTTP, RTSP allows media servers to send requests to media users. However, this is only supported for persistent connections; otherwise

the media server has no *way* to reach the user, and this is the only way for requests to pass through the firewall from the media server to the user


6.3.6 Method Definitions

The method mnemonic indicates the method executed on the resource, and it is case-sensitive. New methods may be defined in the future, but they cannot begin with $.

Some firewall designs and other environments may require the server to insert RTSP methods and streaming data. Because insertion would complicate client and

server operations and impose additional overhead, it should be avoided unless necessary. Inserting binary data is only available when RTSP is transmitted over

TCP. Streaming data (e.g., RTP packets) is encapsulated in an ASCII americana symbol, followed by a one-byte channel identifier

, followed by the length of the encapsulated binary data, a two-byte integer.

Webcam ONVIF/RTSP is what it means

Analysis is as follows:

The camera above the two marks “ONVIF/RTSP” is the camera in line with the “Network Video Standard Specification” and “Real Time Streaming Protocol” standard production out of the product to meet the quality requirements.

Extended Information

The ONVIF specification describes the model, interfaces, data types, and modes of data interaction for network video. It also reuses some existing standards, such as the WS series of standards, etc. The goal of the ONVIF specification is to realize a network video framework protocol that makes network video products produced by different vendors (including ingest and recording front-ends, video recording devices, etc.) fully interoperable.

RTSP (RealTimeStreamingProtocol), RFC2326, Real-Time Streaming Transport Protocol, is an application-layer protocol in the TCP/IP protocol family of standards submitted to IETFRFC by Columbia University, Netscape, and RealNetworks. The protocol defines how one-to-many applications can efficiently deliver multimedia data over an IP network.

Source: Baidu Encyclopedia: onvif

RTP, RTCP, RTSP and other network protocols what is the use and difference

1, RTP (Real-timeTransportProtocol) is used on the Internet for multimedia data streams of a transport protocol. rtp is defined to work in one-to-one or one-to-many transmission. Its purpose is to provide time information and synchronize streams. However, RTP usually uses UDP to transfer data.

2. The TCP protocol is a typical connected protocol while the UDP protocol is a typical connectionless service.Protocols and Tools Included in the TCP/IP ProtocolThe TCP/IP protocol is a collection of network protocols that consists of the following protocols and tools.

3. RTP generally works in conjunction with the transmission control protocol RTCP. RTP is responsible for real-time data transmission only, and RTCP is responsible for out-of-band management of RTP traffic and sessions (such as flow control, congestion control, session source management, etc.). rtcp uses an even number of ports, and the corresponding rtcp streams use the next (odd-numbered, incremental) port number. rtcp uses an even number of ports, and the corresponding rtcp streams use the next (odd-numbered, incremental) port number.

4. Network cameras often apply different combinations of RTSP, RTP, RTCP, HTTP, UDP, and TCP protocols to transmit real-time audio and video streams. Common protocol combinations are as follows.