RTSP 单播流程

417 阅读2分钟

1. OPTIONS

# 请求 RTP Message
Request: OPTIONS rtsp://192.168.1.x:554/h264/ch1/main/av_stream RTSP/1.0\r\n
CSeq: 1\r\n
User-Agent: flywen\r\n
\r\n

# 响应 RTP Message
Response: RTSP/1.0 200 OK\r\n
CSeq: 1\r\n
Public: OPTIONS,DESCRIBE,GET_PARAMETER,PAUSE,SETUP,SET_PARAMETER,TEARDOWN\r\n
Date: Sat,Jan 03 1970 03:37:20 GMT\r\n
\r\n

2. Describe

# 请求 RTP Message
Request: DESCRIBE rtsp://192.168.1.x:554/h264/ch1/main/av_stream RTSP/1.0\r\n
Accept: application/sdp\r\n
CSeq: 2\r\n
User-Agent: flywen\r\n
\r\n

# 响应 RTP Message
Response: RTSP/1.0 401 Unauthorized\r\n
CSeq: 2\r\n
WWW-Authenticate: Digest realm="IP Camera(G8119)", nonce="43bxxxx8fe",stale="FALSE"\r\n
Date: Sat, Jan 03 1970 03:37:20 GMT\r\n
\r\n

3. Describe

# 请求 RTP Message
Request: DESCRIBE rtsp://192.168.1.x:554/h264/ch1/main/av_stream RTSP/1.0\r\n
Accept: application/sdp\r\n
Authorization: Digest username="admin", realm="IP Camera(G8119)", nonce="43bxxxx8fe",
               uri="rtsp://192.168.1.64:554/h264/ch1/main/av_stream",
               response="7dbxxxxcf6"\r\n
CSeq: 3\r\n
User-Agent: flywen\r\n
\r\n

# 响应 RTP Message
Response: RTSP/1.0 200 OK\r\n
CSeq: 3\r\n
Content-type: application/sdp
Content-Base: rtsp://192.168.1.64:554/h264/ch1/main/av_stream/\r\n
Content-length: 592
\r\n
Session Description Protocol

4. SetUp

# 请求 RTP Message
Request: SETUP rtsp://192.168.1.64:554/h264/ch1/main/av_stream/trackID=1 RTSP/1.0\r\n
Authorization: Digest username="admin", realm="IP Camera(G8119)", nonce="43bxxxx8fe",
               uri="rtsp://192.168.1.64:554/h264/ch1/main/av_stream/trackID=1",
               response="8fdxxxxc7f"\r\n
CSeq: 4\r\n
Transport: RTP/AVP;unicast;client_port=45040-45041;mode=play
User-Agent: flywen\r\n
\r\n

# 响应 RTP Message
Response: RTSP/1.0 200 OK\r\n
CSeq: 4\r\n
Session: 1328036010;timeout=60
Transport: RTP/AVP;unicast;client_port=45040-45041;mode=play;server_port=8458-8459;
           ssrc=122d3d83;mode="play"
Date:  Sat, Jan 03 1970 03:37:20 GMT\r\n
\r\n

5. Play

# 请求 RTP Message
Request: PLAY rtsp://192.168.1.64:554/h264/ch1/main/av_stream/ RTSP/1.0\r\n
Authorization: Digest username="admin", realm="IP Camera(G8119)", nonce="43bxxxx8fe",
               uri="rtsp://192.168.1.64:554/h264/ch1/main/av_stream/",
               response="b46xxxx717"\r\n
CSeq: 5\r\n
Range: npt=0-\r\n
Session: 1328036010
User-Agent: flywen\r\n
\r\n

# 响应 RTP Message
Response: RTSP/1.0 200 OK\r\n
CSeq: 5\r\n
Session: 1328036010
RTP-Info: url=rtsp://192.168.1.64:554/h264/ch1/main/av_stream/trackID=1;seq=45819;
          rtptime=3841750842\r\n
Date:  Sat, Jan 03 1970 03:37:20 GMT\r\n
\r\n