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

GB28181国标流媒体服务解决方案_2016版本-INVITE请求视频(UDP、TCP active、 TCP passive)

程序员文章站 2022-03-17 14:13:44
...

安防监控视频流媒体平台EasyGBS能够通过简单的网络摄像机通道配置,将传统监控行业里面的高清网络摄像机IP Camera、NVR等GB28181国标协议输出的设备、平台接入到EasyGBS,EasyGBS能够将这些视频源的音视频数据进行拉取,转换为RTMP/HLS/FLV/RTSP,进行全平台终端H5直播(Web、Android、iOS),并且EasyGBS能够将视频源的直播数据对接到第三方CDN网络,实现互联网级别的直播分发。

GB28181国标流媒体服务解决方案_2016版本-INVITE请求视频(UDP、TCP active、 TCP passive)

 

在GB28181里面,视频请求是最重要的环节,GB28181 2016版本最主要的新增内容 估计就是请求视频的时候支持tcp active和tcp passive, 其实早在GB28181 2014版本的时候都已经定义了tcp传输码流,tcp最大的好处就是对下载的时候能保证不丢包,下面简要说一下INVITE请求视频的流程:

GB28181国标流媒体服务解决方案_2016版本-INVITE请求视频(UDP、TCP active、 TCP passive)

GB28181国标流媒体服务解决方案_2016版本-INVITE请求视频(UDP、TCP active、 TCP passive)

下面简要粘贴一下抓包信息:

udp:

INVITE sip:aaa@qq.com SIP/2.0
Call-ID: aaa@qq.com
CSeq: 1 INVITE
From: <sip:aaa@qq.com>;tag=35565509_53173353_01b54c44-9ff9-49bf-b63a-58e0c1064b22
To: <sip:aaa@qq.com>
Max-Forwards: 70
Contact: "34020000002000000001" <sip:192.168.1.81:5060>
Subject: 64000000001310000001:0-4-0,34020000002000000001:1
Content-Type: application/sdp
Route: <sip:aaa@qq.com:5060;lr>
Via: SIP/2.0/UDP 192.168.1.81:5060;branch=z9hG4bK01b54c44-9ff9-49bf-b63a-58e0c1064b22_53173353_34843235799148
Content-Length: 221
 
v=0
o=34020000002020000001 0 0 IN IP4 192.168.1.81
s=Play
c=IN IP4 192.168.1.81
t=0 0
m=video 6000 RTP/AVP 96 98 97
a=recvonly
a=rtpmap:96 PS/90000
a=rtpmap:97 MPEG4/90000
a=rtpmap:98 H264/90000
f=v/2/4///a///
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.1.81:5060;branch=z9hG4bK01b54c44-9ff9-49bf-b63a-58e0c1064b22_53173353_34843235799148
From: <sip:aaa@qq.com>;tag=35565509_53173353_01b54c44-9ff9-49bf-b63a-58e0c1064b22
To: <sip:aaa@qq.com>
Call-ID: b8055bcaaa@qq.com
CSeq: 1 INVITE
Content-Length: 0
 
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.81:5060;branch=z9hG4bK01b54c44-9ff9-49bf-b63a-58e0c1064b22_53173353_34843235799148
Record-Route: <sip:aaa@qq.com:5060;lr>
From: <sip:aaa@qq.com>;tag=35565509_53173353_01b54c44-9ff9-49bf-b63a-58e0c1064b22
To: <sip:aaa@qq.com>;tag=j3cF7SuJ
Call-ID: aaa@qq.com
CSeq: 1 INVITE
Contact: <sip:aaa@qq.com:5060>
Content-Type: application/sdp
Content-Length:   220
 
v=0
o=64000000001310000001 0 0 IN IP4 192.168.1.93
s=Play
c=IN IP4 192.168.1.93
t=0 0
m=video 20120 RTP/AVP 96 98 97
a=sendonly
a=rtpmap:96 PS/90000
a=rtpmap:98 H264/90000
a=rtpmap:97 MPEG4/90000
y=0000000003
ACK sip:aaa@qq.com:5060 SIP/2.0
Call-ID: aaa@qq.com
CSeq: 1 ACK
From: <sip:aaa@qq.com>;tag=35565509_53173353_01b54c44-9ff9-49bf-b63a-58e0c1064b22
To: <sip:aaa@qq.com>;tag=j3cF7SuJ
Max-Forwards: 70
Route: <sip:aaa@qq.com:5060;lr>
Via: SIP/2.0/UDP 192.168.1.81:5060;branch=z9hG4bK01b54c44-9ff9-49bf-b63a-58e0c1064b22_53173353_34843344467988
Content-Length: 0

tcp active:

INVITE sip:aaa@qq.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.93:5060;rport;branch=z9hG4bK-3d09000-2b0348fd-yeqPDaq1
From: <sip:aaa@qq.com:5060>;tag=98EB157C7A7D4152B78D2B9E097AF8C9
To: <sip:aaa@qq.com>
Call-ID: 98EB157C7A7D4152B78D2B9E097AF8C9
CSeq: 12 INVITE
Contact: <sip:aaa@qq.com:5060>
Content-Type: application/sdp
Max-Forwards: 70
Subject: 34020000001310000001:1,64000000002000000001:1
Content-Length:   258
 
v=0
o=64000000002000000001 0 0 IN IP4 192.168.1.93
s=Play
c=IN IP4 192.168.1.93
t=0 0
m=video 20108 TCP/RTP/AVP 96 98 97
a=recvonly
a=rtpmap:96 PS/90000
a=rtpmap:98 H264/90000
a=rtpmap:97 MPEG4/90000
a=setup:active
a=connection:new
y=0000000002
SIP/2.0 200 OK
To: <sip:aaa@qq.com>;tag=70848741_53173353_6a72b837-2678-46e9-9320-8db5a86f208c
Via: SIP/2.0/UDP 192.168.1.93:5060;rport=5060;branch=z9hG4bK-3d09000-2b0348fd-yeqPDaq1;received=192.168.1.93
CSeq: 12 INVITE
Call-ID: 98EB157C7A7D4152B78D2B9E097AF8C9
From: <sip:aaa@qq.com:5060>;tag=98EB157C7A7D4152B78D2B9E097AF8C9
Contact: <sip:192.168.1.81:5060>
Content-Type: application/sdp
Content-Length: 245
 
v=0
o=64010000002020000001 0 0 IN IP4 192.168.1.81
s=Play
c=IN IP4 192.168.1.81
t=0 0
m=video 5000 TCP/RTP/AVP 96 97 98
a=sendonly
a=rtpmap:96 PS/90000
a=rtpmap:97 MPEG4/90000
a=rtpmap:98 H264/90000
a=setup:passive
a=connection:new
y=0200000025
ACK sip:aaa@qq.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.93:5060;rport=5060;branch=z9hG4bK-3d09000-2b0348fd-yeqPDaq1;received=192.168.1.93
From: <sip:aaa@qq.com:5060>;tag=98EB157C7A7D4152B78D2B9E097AF8C9
To: <sip:aaa@qq.com>;tag=70848741_53173353_6a72b837-2678-46e9-9320-8db5a86f208c
Call-ID: 98EB157C7A7D4152B78D2B9E097AF8C9
CSeq: 12 ACK
Max-Forwards: 70
Content-Length: 0

tcp passive:

INVITE sip:aaa@qq.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.93:5060;rport;branch=z9hG4bK-3d09000-16938bd4-JmZPS4tF
From: <sip:aaa@qq.com:5060>;tag=DAD260A2BECC485BAFDDA3736EC724D9
To: <sip:aaa@qq.com>
Call-ID: DAD260A2BECC485BAFDDA3736EC724D9
CSeq: 190 INVITE
Contact: <sip:aaa@qq.com:5060>
Content-Type: application/sdp
Max-Forwards: 70
Subject: 34020000001310000001:1,64000000002000000001:1
Content-Length:   326
 
v=0
o=64000000002000000001 0 0 IN IP4 192.168.1.93
s=Download
u=34020000001310000001:3
c=IN IP4 192.168.1.93
t=1495173756 1495174056
m=video 20372 TCP/RTP/AVP 96 98 97
a=recvonly
a=rtpmap:96 PS/90000
a=rtpmap:98 H264/90000
a=rtpmap:97 MPEG4/90000
a=setup:passive
a=connection:new
a=downloadspeed:8
y=1000000025
SIP/2.0 200 OK
To: <sip:aaa@qq.com>;tag=01493985_53173353_fb041e78-db58-4fec-9660-625f28bd5e9a
Via: SIP/2.0/UDP 192.168.1.93:5060;rport=5060;branch=z9hG4bK-3d09000-16938bd4-JmZPS4tF;received=192.168.1.93
CSeq: 190 INVITE
Call-ID: DAD260A2BECC485BAFDDA3736EC724D9
From: <sip:aaa@qq.com:5060>;tag=DAD260A2BECC485BAFDDA3736EC724D9
Contact: <sip:192.168.1.81:5060>
Content-Type: application/sdp
Content-Length: 268
 
v=0
o=64010000002020000001 0 0 IN IP4 192.168.1.81
s=Download
c=IN IP4 192.168.1.81
t=0 0
m=video 5000 TCP/RTP/AVP 96 97 98
a=sendonly
a=rtpmap:96 PS/90000
a=rtpmap:97 MPEG4/90000
a=rtpmap:98 H264/90000
a=setup:active
a=connection:new
a=filesize:59770877
y=1200000016
ACK sip:aaa@qq.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.93:5060;rport=5060;branch=z9hG4bK-3d09000-16938bd4-JmZPS4tF;received=192.168.1.93
From: <sip:aaa@qq.com:5060>;tag=DAD260A2BECC485BAFDDA3736EC724D9
To: <sip:aaa@qq.com>;tag=01493985_53173353_fb041e78-db58-4fec-9660-625f28bd5e9a
Call-ID: DAD260A2BECC485BAFDDA3736EC724D9
CSeq: 190 ACK
Max-Forwards: 70
Content-Length: 0

流媒体这块就需要自己做处理了,一般检测的时候需要等待几秒钟,检测软件SPVMN不是那么快速,还有就是tcp active的时候,spvmn的端口不是协议中的端口,所以也不需要针对tcp端口进行筛选。

下面是GB/T28181流媒体服务器的播放效果

 

GB28181国标流媒体服务解决方案_2016版本-INVITE请求视频(UDP、TCP active、 TCP passive)