【视频】对RTSP抓包,分析通讯流程
1、C–>S(客户端向服务端):OPTIONS命令查询服务器提供的方法
Request: OPTIONS rtsp://192.168.1.10:554/12 RTSP/1.0\r\n
CSeq: 2\r\n
User-Agent: LibVLC/2.2.8 (LIVE555 Streaming Media v2016.02.22)\r\n
\r\n
2、S–>C:回应OPTIONS
Response: RTSP/1.0 200 OK\r\n
CSeq: 2\r\n
Cache-Control: no-cache\r\n
Server: Hisilicon RTSP Streaming Media Server/1.0.0\r\n
Date: Thu, Jan 01 1970 00:02:47 GMT\r\n
Public: OPTIONS, DESCRIBE, SETUP, PLAY, TEARDOWN, SET_PARAMETER, GET_PARAMETER\r\n
\r\n
3、C–>S:DESCRIBE命令查询媒体文件的SDP(Session Description Protocol)会话描述信息
Request: DESCRIBE rtsp://192.168.1.10:554/12 RTSP/1.0\r\n
CSeq: 3\r\n
User-Agent: LibVLC/2.2.8 (LIVE555 Streaming Media v2016.02.22)\r\n
Accept: application/sdp\r\n //请求获得sdp信息
\r\n
4、S–>C (RTSP/SDP):回应DESCRIBE,并携带SDP信息
Real Time Streaming Protocol
Response: RTSP/1.0 200 OK\r\n
CSeq: 3\r\n
Content-type: application/sdp
Cache-Control: no-cache\r\n
Server: Hisilicon RTSP Streaming Media Server/1.0.0\r\n
Content-length: 380
Date: Thu, Jan 01 1970 00:02:47 GMT\r\n
\r\n
v=0 //协议版本
o=StreamingServer 3331435948 1116907222000 IN IP4 192.168.1.10 //所有者和会话标识符
s=12 //会话名称
c=IN IP4 0.0.0.0
t=0 0
a=control:*
a=range:npt=0-
m=video 0 RTP/AVP 96 //m:媒体行
a=framerate:30 //a:属性行
a=transform:1,0,0;0,1,0;0,0,1
a=control:trackID=0
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42002A;sprop-parameter-sets=Z0IAKp41wPAET8s3AQEBAg==,aM48gA==
a=x-dimensions:1920,1080
5、C–>S:SETUP命令告诉服务器 客户端用于接受媒体数据的端口号
Request: SETUP rtsp://192.168.1.10:554/12/trackID=0 RTSP/1.0\r\n
CSeq: 4\r\n
User-Agent: LibVLC/2.2.8 (LIVE555 Streaming Media v2016.02.22)\r\n
Transport: RTP/AVP;unicast;client_port=51374-51375 //unicast表示单播,用以区别组播;传输参数,RTP使用偶数,RTCP使用奇数
\r\n
6、S–>C:回应SETUP;至此流媒体连接建立完成
Response: RTSP/1.0 200 OK\r\n
CSeq: 4\r\n
Session: 106932986252082
Server: Hisilicon RTSP Streaming Media Server/1.0.0\r\n
Date: Thu, Jan 01 1970 00:02:47 GMT\r\n
Transport: RTP/AVP;unicast;client_port=51374-51375;server_port=5000-5001;ssrc=23bdcc95;mode=”PLAY”
\r\n
7、C–>S:PLAY命令,告诉服务端开始传输媒体流数据。
Request: PLAY rtsp://192.168.1.10:554/12 RTSP/1.0\r\n
CSeq: 5\r\n
User-Agent: LibVLC/2.2.8 (LIVE555 Streaming Media v2016.02.22)\r\n
Session: 106932986252082
Range: npt=0.000-\r\n
\r\n
8、S–>C:回应PLAY后,开始传输媒体数据流
Response: RTSP/1.0 200 OK\r\n
Server: Hisilicon RTSP Streaming Media Server/1.0.0\r\n
CSeq: 5\r\n
Session: 106932986252082
Date: Date: Thu, Jan 01 1970 00:02:49 GMT\r\n
Range: npt=0.000-\r\n
RTP-Info: url=rtsp://192.168.1.10:554/12/trackID=0;seq=0;rtptime=0,\r\n
\r\n
9、IPv4 RTP
x、C–>S
Request: GET_PARAMETER rtsp://192.168.1.10:554/12 RTSP/1.0\r\n
CSeq: 6\r\n
User-Agent: LibVLC/2.2.8 (LIVE555 Streaming Media v2016.02.22)\r\n
Session: 106932986252082
\r\n
n、IPv4 RTP
n+1、C–>S:TEARDOWN命令,终止媒体流传输
Request: TEARDOWN rtsp://192.168.1.10:554/12 RTSP/1.0\r\n
Method: TEARDOWN
URL: rtsp://192.168.1.10:554/12
CSeq: 7\r\n
User-Agent: LibVLC/2.2.8 (LIVE555 Streaming Media v2016.02.22)\r\n
Session: 378514285583215
\r\n
n+2、C–>S:RTCP Goodbye
上一篇: 全文检索
下一篇: Lucene 全文检索
推荐阅读