欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

RTSP及RTP报文分析

程序员文章站 2022-07-12 18:54:56
...

一.RTSP报文分析

DESCRIBE rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream RTSP/1.0    //URL
CSeq:0   //信令***
Accept:application/sdp   //表示接受SDP描述
User-Agent:NKPlayer-1.00.00.081112    //客户端名称

RTSP/1.0 401 Unauthorized      //摘要认证
CSeq: 0
WWW-Authenticate: Digest realm="c056e3859e59", nonce="df570961862d38456ececf841a94d580", stale="FALSE"
WWW-Authenticate: Basic realm="c056e3859e59"
Date:  Fri, Aug 21 2020 12:37:44 GMT

DESCRIBE rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream RTSP/1.0
CSeq:1
Accept:application/sdp
Authorization: Digest username="admin", realm="c056e3859e59", nonce="df570961862d38456ececf841a94d580", uri="rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream", response="5960ead765125bea0a9e8434493ab7a7"
User-Agent:NKPlayer-1.00.00.081112

RTSP/1.0 200 OK     //摘要认证通过
CSeq: 1
Content-Type: application/sdp    //content内容为SDP描述
Content-Length: 641

v=0      //SDP版本信息
o=- 1598013464692169 1598013464692169 IN IP4 10.21.84.180
s=Media Presentation   //会话名称
e=NONE   //Email地址
b=AS:5100
t=0 0
a=control:*
m=video 0 RTP/AVP 96    //视频描述
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1920,1080
a=control:trackID=1    //表示视频流用的是trackID1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z2QAKKw0yAeAIn5ZuAgICgAAB9AAAF3B0MAOygAAvrwXeXGhgB2UAAF9eC7y4UA=,aO44MA==
m=audio 0 RTP/AVP 8    //音频描述
c=IN IP4 0.0.0.0
b=AS:50
a=recvonly
a=control:trackID=2
a=rtpmap:8 PCMA/8000
a=Media_header:MEDIAINFO=494D4B48010200000400000111710110401F000000FA000000000000000000000000000000000000;      //H私有头部
a=appversion:1.0  //SDP版本号
SETUP rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream/trackID=1 RTSP/1.0
CSeq:2
Authorization: Digest username="admin", realm="c056e3859e59", nonce="df570961862d38456ececf841a94d580", uri="rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream", response="9152b4092ddc3d8e6656843ebb600be0"
Transport:RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=0
User-Agent:NKPlayer-1.00.00.081112

RTSP/1.0 200 OK
CSeq: 2
Session:        999030455;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=5167d33b;mode="play"
Date:  Fri, Aug 21 2020 12:37:44 GMT

SETUP rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream/trackID=2 RTSP/1.0
CSeq:3
Authorization: Digest username="admin", realm="c056e3859e59", nonce="df570961862d38456ececf841a94d580", uri="rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream", response="9152b4092ddc3d8e6656843ebb600be0"
Session:999030455;timeout=60
Transport:RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=0
User-Agent:NKPlayer-1.00.00.081112

RTSP/1.0 200 OK
CSeq: 3
Session:        999030455;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=28ffc0b7;mode="play"
Date:  Fri, Aug 21 2020 12:37:44 GMT

PLAY rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream RTSP/1.0
CSeq:4
Authorization: Digest username="admin", realm="c056e3859e59", nonce="df570961862d38456ececf841a94d580", uri="rtsp://10.21.84.180:554/mpeg4/ch01/main/av_stream", response="6f52e06fd17fb2d4975f4e1fdaa570f9"
Session:999030455;timeout=60
Range:npt=0.000000-0.000000
User-Agent:NKPlayer-1.00.00.081112

RTSP/1.0 200 OK
CSeq: 4
Session:        999030455
RTP-Info: url=trackID=1;seq=35420,url=trackID=2;seq=50777
Date:  Fri, Aug 21 2020 12:37:44 GMT
相关标签: 码流