织梦CMS - 轻松建站从此开始!

罗索

rtp/rtsp over http的学习(一)

落鹤生 发布于 2015-09-01 19:57 点击:次 
要做rtp/rtsp over http, 我对http也有点了解, 以前也做过rtp/rtsp over tcp/udp传输264视频流, 但刚开始还是没有一点思路,想着把http和rtp等联系到一起, 网上这方面的资料太少, 最后实在找不到想要的资料, 于是用开源的live555工程模拟了一个数据的交互过程,
TAG: RTSP  RTPoverHTTP  HTTP  

要做rtp/rtsp over  http, 我对http也有点了解, 以前也做过rtp/rtsp over tcp/udp传输264视频流,  但刚开始还是没有一点思路,想着把http和rtp等联系到一起, 网上这方面的资料太少, 最后实在找不到想要的资料, 于是用开源的live555工程模拟了一个数据的交互过程, 相信对要做这方面的人有很大的帮助, 至少对于我, 呵呵。 下面是交互的过程:

客户端用openrtsp来模拟, 服务器用mediaserver来模拟(黄色字体表示接收到的, 红色表示发送出去的)。

openrtsp的打印信息如下:

[root@www testProgs]# ./openRTSP  -F first_ -T 80  rtsp://127.0.0.1/slamtv60.264

Opening connection to 127.0.0.1, port 80...

...remote connection opened

Requesting RTSP-over-HTTP tunneling (on port 80)

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

Sending request:

 

GET /slamtv60.264 HTTP/1.0

CSeq: 1

User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.03.14)

x-sessioncookie: 754a0e506e8401d33572619

Accept: application/x-rtsp-tunnelled

Pragma: no-cache

Cache-Control: no-cache

 

Received 143 new bytes of response data.

Received a complete GET response:

 

HTTP/1.0 200 OK

Date: Thu, 19 Aug 1982 18:30:00 GMT

Cache-Control: no-cache

Pragma: no-cache

Content-Type: application/x-rtsp-tunnelled

 

 

Opening connection to 127.0.0.1, port 80...

...remote connection opened

Sending request:

 

POST /slamtv60.264 HTTP/1.0

CSeq: 1

User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.03.14)

x-sessioncookie: 754a0e506e8401d33572619

Content-Type: application/x-rtsp-tunnelled

Pragma: no-cache

Cache-Control: no-cache

Content-Length: 32767

Expires: Sun, 9 Jan 1972 00:00:00 GMT

 

 

Sending request:

 

OPTIONS rtsp://127.0.0.1/slamtv60.264 RTSP/1.0

CSeq: 2

User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.03.14)

 

 

The request was base-64 encoded to:

T1BUSU9OUyBydHNwOi8vMTI3LjAuMC4xL3NsYW10djY

wLjI2NCBSVFNQLzEuMA0KQ1NlcTogMg0KVXNlci1BZ2V

udDogLi9vcGVuUlRTUCAoTElWRTU1NSBTdHJlYW1pb

mcgTWVkaWEgdjIwMTEuMDMuMTQpDQoNCg==

 

Received 152 new bytes of response data.

Received a complete OPTIONS response:

 

RTSP/1.0 200 OK

CSeq: 2

Date: Wed, Apr 13 2011 07:15:56 GMT

Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER

 

 

Sending request:

 

DESCRIBE rtsp://127.0.0.1/slamtv60.264 RTSP/1.0

CSeq: 3

User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.03.14)

Accept: application/sdp

 

 

The request was base-64 encoded to:

 

REVTQ1JJQkUgcnRzcDovLzEyNy4wLjAuMS9zbGFtdH

Y2MC4yNjQgUlRTUC8xLjANCkNTZXE6IDMNClVzZXItQ

WdlbnQ6IC4vb3BlblJUU1AgKExJVkU1NTUgU3RyZWF

taW5nIE1lZGlhIHYyMDExLjAzLjE0KQ0KQWNjZXB0Oi

BhcHBsaWNhdGlvbi9zZHANCg0K

 

Received 689 new bytes of response data.

Received a complete DESCRIBE response:

 

RTSP/1.0 200 OK

CSeq: 3

Date: Wed, Apr 13 2011 07:15:56 GMT

Content-Base: rtsp://127.0.0.1/slamtv60.264/

Content-Type: application/sdp

Content-Length: 526

 

v=0

o=- 1302678956100984 1 IN IP4 192.168.77.111

s=H.264 Video, streamed by the LIVE555 Media Server

i=slamtv60.264

t=0 0

a=tool:LIVE555 Streaming Media v2011.03.14

a=type:broadcast

a=control:*

a=range:npt=0-

a=x-qt-text-nam:H.264 Video, streamed by the LIVE555 Media Server

a=x-qt-text-inf:slamtv60.264

m=video 0 RTP/AVP 96

c=IN IP4 <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><?xml:namespace prefix = st1 /><?xml:namespace prefix = st1 />0.0.0.0

b=AS:500

a=rtpmap:96 H264/90000

a=fmtp:96 packetization-mode=1;profile-level-id=4D4033;sprop-parameter-sets=Z01AM5JUDAS0IAAAAwBAAAAM0eMGVA==,aO48gA==

a=control:track1

 

Opened URL "rtsp://127.0.0.1/slamtv60.264", returning a SDP description:

v=0

o=- 1302678956100984 1 IN IP4 192.168.77.111

s=H.264 Video, streamed by the LIVE555 Media Server

i=slamtv60.264

t=0 0

a=tool:LIVE555 Streaming Media v2011.03.14

a=type:broadcast

a=control:*

a=range:npt=0-

a=x-qt-text-nam:H.264 Video, streamed by the LIVE555 Media Server

a=x-qt-text-inf:slamtv60.264

m=video 0 RTP/AVP 96

c=IN IP4 0.0.0.0

b=AS:500

a=rtpmap:96 H264/90000

a=fmtp:96 packetization-mode=1;profile-level-id=4D4033;sprop-parameter-sets=Z01AM5JUDAS0IAAAAwBAAAAM0eMGVA==,aO48gA==

a=control:track1

 

Created receiver for "video/H264" subsession (client ports 50736-50737)

Sending request:

 

 

 

SETUP rtsp://127.0.0.1/slamtv60.264/track1 RTSP/1.0

CSeq: 4

User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.03.14)

Transport: RTP/AVP/TCP;unicast;interleaved=0-1

 

 

The request was base-64 encoded to:

 

U0VUVVAgcnRzcDovLzEyNy4wLjAuMS9zbGFtdHY2MC4y

NjQvdHJhY2sxIFJUU1AvMS4wDQpDU2VxOiA0DQpVc2Vy

LUFnZW50OiAuL29wZW5SVFNQIChMSVZFNTU1IFN0cm

VhbWluZyBNZWRpYSB2MjAxMS4wMy4xNCkNClRyYW5zc

G9ydDogUlRQL0FWUC9UQ1A7dW5pY2FzdDtpbnRlcmxl

YXZlZD0wLTENCg0K

 

Received 171 new bytes of response data.

Received a complete SETUP response:

 

RTSP/1.0 200 OK

CSeq: 4

Date: Wed, Apr 13 2011 07:15:56 GMT

Transport: RTP/AVP/TCP;unicast;destination=127.0.0.1;source=127.0.0.1;interleaved=0-1

Session: 557663C7

 

 

Setup "video/H264" subsession (client ports 50736-50737)

Created output file: "first_video-H264-1"

Sending request:

 

PLAY rtsp://127.0.0.1/slamtv60.264/ RTSP/1.0

CSeq: 5

User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.03.14)

Session: 557663C7

Range: npt=0.000-

 

 

The request was base-64 encoded to:

 

UExBWSBydHNwOi8vMTI3LjAuMC4xL3NsYW10djYwL

jI2NC8gUlRTUC8xLjANCkNTZXE6IDUNClVzZXItQWdlb

nQ6IC4vb3BlblJUU1AgKExJVkU1NTUgU3RyZWFtaW5

nIE1lZGlhIHYyMDExLjAzLjE0KQ0KU2Vzc2lvbjogNTU3

NjYzQzcNClJhbmdlOiBucHQ9MC4wMDAtDQoNCg==

 

Received a complete PLAY response:

 

RTSP/1.0 200 OK

CSeq: 5

Date: Wed, Apr 13 2011 07:15:56 GMT

Range: npt=0.000-

Session: 557663C7

RTP-Info: url=rtsp://127.0.0.1/slamtv60.264/track1;seq=8747;rtptime=3741659354

 

 

Started playing session

Receiving streamed data (signal with "kill -HUP 6196" or "kill -USR1 6196" to terminate)...

Received RTCP "BYE" on "video/H264" subsession (after 58 seconds)

Sending request:

 

TEARDOWN rtsp://127.0.0.1/slamtv60.264/ RTSP/1.0

CSeq: 6

User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.03.14)

Session: 557663C7

 

 

The request was base-64 encoded to:

 

VEVBUkRPV04gcnRzcDovLzEyNy4wLjAuMS9zbGFtdHY2M

C4yNjQvIFJUU1AvMS4wDQpDU2VxOiA2DQpVc2VyLUFnZ

W50OiAuL29wZW5SVFNQIChMSVZFNTU1IFN0cmVhbWlu

ZyBNZWRpYSB2MjAxMS4wMy4xNCkNClNlc3Npb246IDU1N

zY2M0M3DQoNCg==

 

Received a complete TEARDOWN response:

 

RTSP/1.0 200 OK

CSeq: 6

Date: Wed, Apr 13 2011 07:16:54 GMT

(zqf_office)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201509/17373.html]
本文出处:CSDN博客 作者:zqf_office 原文
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容