RTSP协议报文交互过程全记录
一。rtsp拉流(UDP)
1.OPTIONS:
OPTIONS rtsp://10.0.16.111:554/Streaming/Channels/101 RTSP/1.0
CSeq: 1
User-Agent: Lavf59.26.100
RTSP/1.0 200 OK
CSeq: 1
Public: OPTIONS, DESCRIBE, PLAY, PAUSE, SETUP, TEARDOWN, SET_PARAMETER, GET_PARAMETER
Date: Thu, Mar 23 2023 18:37:12 GMT
2.DESCRIBE:
DESCRIBE rtsp://10.0.16.111:554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: Lavf59.26.100
RTSP/1.0 401 Unauthorized
CSeq: 2
WWW-Authenticate: Digest realm="IP Camera(11266)", nonce="abc4a07789be480e64f821c677104d37", stale="FALSE"
Date: Thu, Mar 23 2023 18:37:12 GMT
3.DESCRIBE:
DESCRIBE rtsp://10.0.16.111:554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
CSeq: 3
User-Agent: Lavf59.26.100
Authorization: Digest username="admin", realm="IP Camera(11266)", nonce="abc4a07789be480e64f821c677104d37", uri="rtsp://10.0.16.111:554/Streaming/Channels/101", response="4e94cd299a516d985f31aae4c3020c38"
RTSP/1.0 200 OK
CSeq: 3
Content-Type: application/sdp
Content-Base: rtsp://10.0.16.111:554/Streaming/Channels/101/
Content-Length: 894
v=0
o=- 1679596632450757 1679596632450757 IN IP4 10.0.16.111
s=Media Presentation
e=NONE
b=AS:5100
t=0 0
a=control:rtsp://10.0.16.111:554/Streaming/Channels/101/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1280,720
a=control:rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z0IAH52oFAFum4CAgKAAAAMAIAAABlCA,aM48gA==
m=audio 0 RTP/AVP 104
c=IN IP4 0.0.0.0
b=AS:50
a=recvonly
a=control:rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=2
a=rtpmap:104 mpeg4-generic/44100/1
a=fmtp:104 profile-level-id=15; streamtype=5; mode=AAC-hbr; config=1208;SizeLength=13; IndexLength=3; IndexDeltaLength=3; Profile=1;
a=Media_header:MEDIAINFO=494D4B4801020000040000010120011044AC0000007D000000000000000000000000000000000000;
a=appversion:1.0
4.SETUP:
SETUP rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=1 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;client_port=33118-33119
CSeq: 4
User-Agent: Lavf59.26.100
Authorization: Digest username="admin", realm="IP Camera(11266)", nonce="abc4a07789be480e64f821c677104d37", uri="rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=1", response="cf9d37aafe4a4cfa1b4bf9ea784dc368"
RTSP/1.0 200 OK
CSeq: 4
Session: 557408106;timeout=60
Transport: RTP/AVP/UDP;unicast;client_port=33118-33119;server_port=8260-8261;ssrc=7845ed13;mode="play"
Date: Thu, Mar 23 2023 18:37:12 GMT
5.SETUP:
SETUP rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=2 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;client_port=33120-33121
CSeq: 5
User-Agent: Lavf59.26.100
Session: 557408106
Authorization: Digest username="admin", realm="IP Camera(11266)", nonce="abc4a07789be480e64f821c677104d37", uri="rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=2", response="968bae386bf2ff48793b1ab7f0f643be"
RTSP/1.0 200 OK
CSeq: 5
Session: 557408106;timeout=60
Transport: RTP/AVP/UDP;unicast;client_port=33120-33121;server_port=8262-8263;ssrc=45962de4;mode="play"
Date: Thu, Mar 23 2023 18:37:12 GMT
6.PLAY:
PLAY rtsp://10.0.16.111:554/Streaming/Channels/101/ RTSP/1.0
Range: npt=0.000-
CSeq: 6
User-Agent: Lavf59.26.100
Session: 557408106
Authorization: Digest username="admin", realm="IP Camera(11266)", nonce="abc4a07789be480e64f821c677104d37", uri="rtsp://10.0.16.111:554/Streaming/Channels/101/", response="ab319a7d0f7c5f9491c2b3cb24695634"
RTSP/1.0 200 OK
CSeq: 6
Session: 557408106
RTP-Info: url=rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=1;seq=36723;rtptime=2574626712,url=rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=2;seq=23132;rtptime=3280209523
Date: Thu, Mar 23 2023 18:37:12 GMT
二。rtsp拉流(TCP)
1.OPTIONS:
OPTIONS rtsp://10.0.16.111:554/Streaming/Channels/101 RTSP/1.0
CSeq: 1
User-Agent: Lavf59.26.100
RTSP/1.0 200 OK
CSeq: 1
Public: OPTIONS, DESCRIBE, PLAY, PAUSE, SETUP, TEARDOWN, SET_PARAMETER, GET_PARAMETER
Date: Fri, Mar 24 2023 11:15:59 GMT
2.DESCRIBE:
DESCRIBE rtsp://10.0.16.111:554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: Lavf59.26.100
RTSP/1.0 401 Unauthorized
CSeq: 2
WWW-Authenticate: Digest realm="IP Camera(11266)", nonce="f6995a36c2ed0cccfb4e6c2a33a882c9", stale="FALSE"
Date: Fri, Mar 24 2023 11:15:59 GMT
3.DESCRIBE:
DESCRIBE rtsp://10.0.16.111:554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
CSeq: 3
User-Agent: Lavf59.26.100
Authorization: Digest username="admin", realm="IP Camera(11266)", nonce="f6995a36c2ed0cccfb4e6c2a33a882c9", uri="rtsp://10.0.16.111:554/Streaming/Channels/101", response="9858265ba07711a41cb2ab44c9547c98"
RTSP/1.0 200 OK
CSeq: 3
Content-Type: application/sdp
Content-Base: rtsp://10.0.16.111:554/Streaming/Channels/101/
Content-Length: 894
v=0
o=- 1679656559712847 1679656559712847 IN IP4 10.0.16.111
s=Media Presentation
e=NONE
b=AS:5100
t=0 0
a=control:rtsp://10.0.16.111:554/Streaming/Channels/101/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1280,720
a=control:rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z0IAH52oFAFum4CAgKAAAAMAIAAABlCA,aM48gA==
m=audio 0 RTP/AVP 104
c=IN IP4 0.0.0.0
b=AS:50
a=recvonly
a=control:rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=2
a=rtpmap:104 mpeg4-generic/44100/1
a=fmtp:104 profile-level-id=15; streamtype=5; mode=AAC-hbr; config=1208;SizeLength=13; IndexLength=3; IndexDeltaLength=3; Profile=1;
a=Media_header:MEDIAINFO=494D4B4801020000040000010120011044AC0000007D000000000000000000000000000000000000;
a=appversion:1.0
4.SETUP:
SETUP rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 4
User-Agent: Lavf59.26.100
Authorization: Digest username="admin", realm="IP Camera(11266)", nonce="f6995a36c2ed0cccfb4e6c2a33a882c9", uri="rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=1", response="baeb31267ec09ef055e840db6100d3cc"
RTSP/1.0 200 OK
CSeq: 4
Session: 995122684;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=1ef00f82;mode="play"
Date: Fri, Mar 24 2023 11:15:59 GMT
5.SETUP:
SETUP rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=2 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 5
User-Agent: Lavf59.26.100
Session: 995122684
Authorization: Digest username="admin", realm="IP Camera(11266)", nonce="f6995a36c2ed0cccfb4e6c2a33a882c9", uri="rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=2", response="24f2a019ea2a9a468279a43058d40170"
RTSP/1.0 200 OK
CSeq: 5
Session: 995122684;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=4832454a;mode="play"
Date: Fri, Mar 24 2023 11:15:59 GMT
6.PLAY:
PLAY rtsp://10.0.16.111:554/Streaming/Channels/101/ RTSP/1.0
Range: npt=0.000-
CSeq: 6
User-Agent: Lavf59.26.100
Session: 995122684
Authorization: Digest username="admin", realm="IP Camera(11266)", nonce="f6995a36c2ed0cccfb4e6c2a33a882c9", uri="rtsp://10.0.16.111:554/Streaming/Channels/101/", response="128ce9612d84af58bfb2a5a78b4e61db"
RTSP/1.0 200 OK
CSeq: 6
Session: 995122684
RTP-Info: url=rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=1;seq=41402;rtptime=3673114076,url=rtsp://10.0.16.111:554/Streaming/Channels/101/trackID=2;seq=47264;rtptime=1628033996
Date: Fri, Mar 24 2023 11:15:59 GMT
三。rtsp推流(TCP)
1.OPTIONS:
OPTIONS rtsp://172.168.1.38:554/live/test RTSP/1.0
CSeq: 1
User-Agent: -_-
RTSP/1.0 200 OK
CSeq: 1
Date: Fri, Mar 24 2023 01:09:38 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, ANNOUNCE, RECORD, SET_PARAMETER, GET_PARAMETER
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
2.ANNOUNCE:
ANNOUNCE rtsp://172.168.1.38:554/live/test RTSP/1.0
Content-Type: application/sdp
CSeq: 2
User-Agent: -_-
Session:
Content-Length: 304
v=0
o=- 91679620178 1 IN IP4 10.0.16.115
t=0 0
a=control:*
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=control:track0
m=audio 0 RTP/AVP 97
a=rtpmap:97 MPEG4-GENERIC/44100/1
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1208
a=control:track1
RTSP/1.0 200 OK
CSeq: 2
Date: Fri, Mar 24 2023 01:09:38 GMT
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: Kzao4p5Wdp7u
3.SETUP(视频H264):
SETUP rtsp://172.168.1.38:554/live/test/track0 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;mode=record;interleaved=0-1
CSeq: 3
User-Agent: -_-
Session: Kzao4p5Wdp7u
RTSP/1.0 200 OK
CSeq: 3
Date: Fri, Mar 24 2023 01:09:38 GMT
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: Kzao4p5Wdp7u
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=00000000
x-Dynamic-Rate: 1
x-Transport-Options: late-tolerance=1.400000
4.SETUP(音频AAC):
SETUP rtsp://172.168.1.38:554/live/test/track1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;mode=record;interleaved=2-3
CSeq: 4
User-Agent: -_-
Session: Kzao4p5Wdp7u
RTSP/1.0 200 OK
CSeq: 4
Date: Fri, Mar 24 2023 01:09:38 GMT
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: Kzao4p5Wdp7u
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=00000000
x-Dynamic-Rate: 1
x-Transport-Options: late-tolerance=1.400000
5.RECORD:
RECORD rtsp://172.168.1.38:554/live/test RTSP/1.0
Range: npt=0.000-
CSeq: 5
User-Agent: -_-
Session: Kzao4p5Wdp7u
RTSP/1.0 200 OK
CSeq: 5
Date: Fri, Mar 24 2023 01:09:38 GMT
RTP-Info: url=rtsp://172.168.1.38:554/live/test/track0,url=rtsp://172.168.1.38:554/live/test/track1
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: Kzao4p5Wdp7u
6.TEARDOWN:
TEARDOWN rtsp://172.168.1.38:554/live/test RTSP/1.0
CSeq: 6
User-Agent: Lavf59.26.100
Session: Kzao4p5Wdp7u
RTSP/1.0 200 OK
CSeq: 6
Date: Fri, Mar 24 2023 02:51:35 GMT
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: Kzao4p5Wdp7u
四。rtsp推流(UDP)
1.OPTIONS:
OPTIONS rtsp://172.168.1.38:554/test/live4 RTSP/1.0
CSeq: 1
User-Agent: Lavf59.26.100
RTSP/1.0 200 OK
CSeq: 1
Date: Fri, Mar 24 2023 02:57:49 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, ANNOUNCE, RECORD, SET_PARAMETER, GET_PARAMETER
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
2.ANNOUNCE:
ANNOUNCE rtsp://172.168.1.38:554/test/live4 RTSP/1.0
Content-Type: application/sdp
CSeq: 2
User-Agent: Lavf59.26.100
Content-Length: 327
v=0
o=- 0 0 IN IP4 127.0.0.1
s=Media Presentation
c=IN IP4 172.168.1.38
t=0 0
a=tool:libavformat LIBAVFORMAT_VERSION
m=video 0 RTP/AVP 96
b=AS:1938
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z00AKp24HgCJ+WbgICAoAAADAAgAAAMBlCA=,aO48gA==; profile-level-id=4D002A
a=control:streamid=0
RTSP/1.0 200 OK
CSeq: 2
Date: Fri, Mar 24 2023 02:57:49 GMT
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: BnMb7rU90LPW
3.SETUP(视频H264):
SETUP rtsp://172.168.1.38:554/test/live4/streamid=0 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;client_port=29326-29327;mode=record
CSeq: 3
User-Agent: Lavf59.26.100
Session: BnMb7rU90LPW
RTSP/1.0 200 OK
CSeq: 3
Date: Fri, Mar 24 2023 02:57:49 GMT
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: BnMb7rU90LPW
Transport: RTP/AVP/UDP;unicast;client_port=29326-29327;mode=record;server_port=30054-30055;ssrc=00000000
4.RECORD:
RECORD rtsp://172.168.1.38:554/test/live4 RTSP/1.0
Range: npt=0.000-
CSeq: 4
User-Agent: Lavf59.26.100
Session: BnMb7rU90LPW
RTSP/1.0 200 OK
CSeq: 4
Date: Fri, Mar 24 2023 02:57:49 GMT
RTP-Info: url=rtsp://172.168.1.38:554/test/live4/streamid=0
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: BnMb7rU90LPW
5.TEARDOWN:
TEARDOWN rtsp://172.168.1.38:554/test/live4 RTSP/1.0
CSeq: 5
User-Agent: Lavf59.26.100
Session: BnMb7rU90LPW
RTSP/1.0 200 OK
CSeq: 5
Date: Fri, Mar 24 2023 02:57:52 GMT
Server: ZLMediaKit(git hash:00c9749,branch:master,build time:Sep 5 2022 09:20:08)
Session: BnMb7rU90LPW