RTSP Protocol Analysis

Source: Internet
Author: User
Tags http request rewind unsupported valid

1. Overview: RTSP (real Time streaming Protocol), live streaming protocol, is an application-level protocol in the TCP/IP protocol system, and is submitted by the IETF RFC standard by Columbia University, Netscape, and RealNetworks Corporation. This protocol defines how a one-to-many application can efficiently transmit multimedia data over an IP network. A flow control protocol similar to the HTTP protocol. They all use plain text to send information , and the RTSP protocol syntax is similar to HTTP. RTSP was initially designed to be compatible with parsing code using previously written HTTP protocols. The main difference is that the HTTP protocol is stateless, and the HTTP protocol disconnects the connection after sending a command, and there is no dependency between the commands. The RTSP command needs to know what state it is in now, which means that RTSP commands are always sent in sequence, and a command is always sent before another command. RTSP does not break the connection, no matter what state it is in. RTSP maintains a session to maintain the transformation of its state. The default port for the RTSP protocol is 554, and the default hosting protocol is TCP.


characteristics of the 2.RTSP: (1) Flow control separation: From the control logic, RTSP and FTP similar, control flow and data flow is separate.
(2) Extensibility: Because the RTSP protocol is a text-based protocol, it has strong extensibility.
(3) Security: RTSP uses the web security mechanism.

3.RTSP protocol Format: the format of the request command is: METHOD URL CR LF
Field1:value CR LF
Field2:value CR LF
......
Fieldn:value CR LF
CR LF


Compare HTTP requests:

Method Request-uri http-version CRLF http request only one more Http-version http example: get/index.asp http/1.0

The format of the answer is: Rtsp/major_version.minor_version Status CR LF
Field1:value CR LF
Field2:value CR LF
......
Fieldn:value CR LF
CR LF


Compare HTTP response status lines:

Http-version status-code reason-phrase CRLF HTTP response is followed by a Reason-phrase http example: http/1.1 OK

the main command method for 4.RTSP:


State Transition table for 5.RTSP commands


6.RTSP Status Code

Status-code = "100"; Continue
| "200"; Ok
| "201"; Created
| "250"; Low on Storage Space
| "300"; Multiple Choices
| "301"; Moved Permanently
| "302"; Moved temporarily
| "303"; See other
| "304"; Not Modified
| "305"; Use Proxy
| "400"; Bad Request
| "401"; Unauthorized
| "402"; Payment Required
| "403"; Forbidden
| "404"; Not Found
| "405"; Method not allowed
| "406"; Not acceptable
| "407"; Proxy Authentication Required
| "408"; Request time-out
| "410"; Gone
| "411"; Length Required
| "412"; Precondition Failed
| "413"; Request Entity Too Large
| "414"; Request-uri Too Large
| "415"; Unsupported Media Type
| "451"; Parameter not understood
| "452"; Conference not Found
| "453"; Not enough Bandwidth
| "454"; Session not Found
| "455"; Method not Valid
| "456"; Header Field not Valid for Resource
| "457"; Invalid Range
| "458"; Parameter is read-only
| "459"; Aggregate Operation not allowed
| "460"; Only aggregate operation allowed
| "461"; Unsupported transport
| "462"; Destination Unreachable
| "500"; Internal Server Error
| "501"; Not implemented
| "502"; Bad Gateway
| "503"; Service unavailable
| "504"; Gateway time-out
| "505"; RTSP Version not supported
| "551"; Option not supported
| Extension-code
Extension-code = 3DIGIT
Reason-phrase = *<text, excluding CR, LFExample

The following is the RTSP negotiation process for a province IPTV: request

Media URL


Accept:application/sdp
Negotiated to describe the media information protocol


Cseq:1

User-agent:zte ltd.co RTSP protocal verion 1.0 guid-2.1.1.100/b519d290-c0ec-ee35-7368-893be4c0b347

User agnet information, display is ZTE's server, 1.0 version. If it is a helix server, there will be the identity of the Helix server.


x-nat:2.1.1.100:20081
Primarily for NAT penetration


X-zmssrtxsdp:yes


Answer

rtsp/1.0 OK
Answer number


SERVER:ZXUSS100 1.0

Cache-control:no-cache

content-base:rtsp://118.122.89.27:554/live/ch10083121594790060557.sdp/

content-length:320
Content Length Information


Content-type:application/sdp
The protocol used to describe the content information


Cseq:1

date:wed, Sep 10:20:38 GMT

expires:wed, Sep 10:20:38 GMT
SDP Description Information


V=0

o=-296874273 1 in IP4 118.122.89.27

S=envivio

C=in IP4 0.0.0.0

b=as:1500

T=0 0

a=range:clock=20100929t095038.00z-20100929t102038.00z

M=video 5140 RTP/AVPF 33 96

a=control:trackid=2

A=rtpmap:33 mp2t/90000

A=3gpp-adaptation-support:5

A=rtcp-fb:33 Nack

a=rtpmap:96 rtx/90000

a=fmtp:96 apt=33;rtx-time=0

SETUP rtsp://118.122.89.27:554/live/ch10083121594790060557.sdp/trackid=2 rtsp/1.0


Used to establish an RTSP connection and negotiate a transfer protocol.
Cseq:2

3gpp-adaptation:url=rtsp://118.122.89.27:554/live/ch10083121594790060557.sdp/trackid=2;size=1061400; target-time=2200

transport:mp2t/rtp/udp;unicast;destination=2.1.1.100;client_port=8360-8361,mp2t/rtp/tcp;unicast;destination= 2.1.1.100;interleaved=0-1,mp2t/udp;unicast;destination=2.1.1.100;client_port=8360-8361,mp2t/tcp;unicast; Destination=2.1.1.100;interleaved=0-1
MP2T/RTP/UDP indicates that the TS stream is used for RTP packaging, based on UDP transmission. MP2T/RTP/TCP indicates that the TS stream is used for RTP packaging, based on TCP.



User-agent:zte ltd.co RTSP protocal verion 1.0 guid-2.1.1.100/b519d290-c0ec-ee35-7368-893be4c0b347

rtsp/1.0 OK

SERVER:ZXUSS100 1.0

Cseq:2

date:wed, Sep 10:20:38 GMT

expires:wed, Sep 10:20:38 GMT

session:65565885

Transport:mp2t/rtp/udp;unicast;destination=2.1.1.100;client_port=8360-8361;server_port=13306-13307;source= 118.122.89.29

By negotiating mp2t/rtp/udp, it means that the TS stream is used for RTP packaging, based on UDP transmission. Server-side port: 13306-13307. Client Port: 8360-8361


3gpp-adaptation:url=rtsp://118.122.89.27:554/live/ch10083121594790060557.sdp/trackid=2;size=1061400; target-time=2200

PLAY rtsp://118.122.89.27:554/live/ch10083121594790060557.sdp?playtype=1&boid=001&backupagent= 118.122.89.27:554&clienttype=1&time=20100929182111+08&life=172800&ifpricereqsnd=1&vcdnid= 001&userid=123&mediaid=ch10083121594790060557&ctype=2&tstvtimelife=1800&contname=& Authid=0&userlivetype=1&nodelevel=3 rtsp/1.0

Play the video. For some videos, you may want to play the audio video separately.


Cseq:3

session:65565885

User-agent:zte ltd.co RTSP protocal verion 1.0 guid-2.1.1.100/b519d290-c0ec-ee35-7368-893be4c0b347

scale:1.0

range:npt=end-

Npt=end-has its own definition in IPTV2.0 (see Shanghai Telecom IPTV2.0 Standard)


rtsp/1.0 OK

SERVER:ZXUSS100 1.0

Cseq:3

range:npt=end-

scale:1.0

session:65565885

rtp-info:url=rtsp://118.122.89.29:13306/live/ch10083121594790060557.sdp/trackid=2

......

PLAY rtsp://118.122.89.27:554/live/ch10083121594790060557.sdp?playtype=1&boid=001&backupagent= 118.122.89.27:554&clienttype=1&time=20100929182111+08&life=172800&ifpricereqsnd=1&vcdnid= 001&userid=123&mediaid=ch10083121594790060557&ctype=2&tstvtimelife=1800&contname=& Authid=0&userlivetype=1&nodelevel=3 rtsp/1.0

Another use of play. For fast forward and rewind.


cseq:43

session:65565885

User-agent:zte ltd.co RTSP protocal verion 1.0 guid-2.1.1.100/b519d290-c0ec-ee35-7368-893be4c0b347

Scale:-32.0

Scale:-32.0, which indicates a 32 times-speed rewind. Scale:32.0, expressed in 32 times times fast forward.


range:npt=now-

rtsp/1.0 OK

SERVER:ZXUSS100 1.0

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.