一個RTSP的過程,瞭解一下RTSP

來源:互聯網
上載者:User

從裝置廠家下載了一份其RTSP的協議說明,按文檔上的說發,怎麼發都沒有回應,暈菜,最後用它的DEMO串連,再用WireShark工具跟蹤一個完整的過程,

自己再搞了一次完整的過程。

一個RTSP的過程,使用的是一個支援RTSP的攝像機,用Delphi的TClientSocket一個TCP控制項發送字串,

  str := 'DESCRIBE rtsp://192.168.9.88/ch1-s2 RTSP/1.0' + #13#10;
  str := str + 'CSeq: 1' + #13#10;
  str := str + 'Accept: application/sdp' + #13#10;
  str := str + 'Bandwidth:512000' + #13#10;
  str := str + 'Accept-Language: de-DE' + #13#10;
  str := str + 'User-Agent: ma_player' + #13#10+#13#10;

  clntsckt1.Socket.SendText(str);

資料的來回過程如下:

DESCRIBE->SETUP->PLAY->TEARDOWN 

DESCRIBE rtsp://192.168.9.88/ch1-s2 RTSP/1.0
CSeq: 1
Accept: application/sdp
Bandwidth:512000
Accept-Language: de-DE
User-Agent: ma_player

RTSP/1.0 401 Unauthorized
Server: ESS/2.3.1.6
CSeq: 1
WWW-Authenticate: Basic realm="ESS"


DESCRIBE rtsp://192.168.9.88/ch1-s2 RTSP/1.0
CSeq: 2
Accept: application/sdp
Bandwidth:512000
Accept-Language: de-DE
User-Agent: ma_player
Authorization: Basic YWRtaW46YWRtaW4=

RTSP/1.0 200 OK
Server: ESS/2.3.1.6
CSeq: 2
Content-Type: application/sdp
Content-Length: 606
Pragma: no-cache
Cache-Control: no-cache
Date: Sat, Mar 24 2012 22:18:24 GMT

v=0
o=- 1332627108 1332627108 IN IP4 0.0.0.0
s=ch1-s2
c=IN IP4 0.0.0.0
a=DevVer:pusher2
a=GroupName:IPCAM
a=NickName:CIF
a=CfgSection:PROG_CHN1
a=voiceout:0
m=video 0 RTP/AVP 96
a=control:trackID=1
a=rtpmap:96 H264/1000
a=fmtp:96 profile-level-id=42E014; sprop-parameter-sets=Z0LgFNoFB8Q=,aM4wpIA=; packetization-mode=1
b=AS:512
a=framesize:96 320-240
a=cliprect:0,0,240,320
a=framerate:25
m=audio 0 RTP/AVP 0
a=control:trackID=2
a=rtpmap:0 PCMU/8000/1
a=fmtp:0 octet-align=1
b=AS:64
m=data 0 RTP/AVP 98
a=control:trackID=3
a=rtpmap:98 X-KATA/1000
a=fmtp:98 octet-align=1
b=AS:2


SETUP rtsp://192.168.9.88/ch1-s2/trackID=1 RTSP/1.0
CSeq: 3
Transport:RTP/AVP/TCP;unicast;interleaved=0-1
Accept-Language:de-DE
user-Agent:ma_player
Authorization:Basic YWRtaW46YWRtaW4=

RTSP/1.0 200 OK
Server: ESS/2.3.1.6
CSeq: 3
Pragma: no-cache
Cache-Control: no-cache
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=07FAC83B
Session: 0x5f290
Date: Sat, Mar 24 2012 22:35:39 GMT


SETUP rtsp://192.168.9.88/ch1-s2/trackID=2 RTSP/1.0
CSeq: 4
session:0x5c8a0
Transport:RTP/AVP/TCP;unicast;interleaved=2-3
Accept-Language:de-DE
user-Agent:ma_player
Authorization:Basic YWRtaW46YWRtaW4=

RTSP/1.0 200 OK
Server: ESS/2.3.1.6
CSeq: 4
Pragma: no-cache
Cache-Control: no-cache
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=07FAC83B
Session: 0x5f290
Date: Sat, Mar 24 2012 22:38:22 GMT


PLAY rtsp://192.168.9.88/ch1-s2 RTSP/1.0
CSeq: 5
Range:npt=0.000000-
session:0x5c8a0
Accept-Language:de-DE
user-Agent:ma_player
Authorization:Basic YWRtaW46YWRtaW4=

RTSP/1.0 200 OK
Server: ESS/2.3.1.6
CSeq: 5
Range: npt=now-
Pragma: no-cache
Cache-Control: no-cache
Session: 0x73ed0
Date: Sat, Mar 24 2012 22:43:49 GMT
RTP-Info: url=rtsp://192.168.9.88/ch1-s2/trackID=1,url=rtsp://192.168.9.88/ch1-s2/trackID=2
。。。。。。。。。。

這裡開始收到流資料了。。。。。。。。。


TEARDOWN rtsp://192.168.9.88/ch1-s2 RTSP/1.0
CSeq:7
session:0x5c80a
Accept-Language:de-DE
user-Agent:ma_player

RTSP/1.0 200 OK
Server: ESS/2.3.1.6
CSeq: 7
Pragma: no-cache
Cache-Control: no-cache
Date: Sat, Mar 24 2012 22:50:11 GMT
斷開

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.