monibuca / plugin-gb28181 Goto Github PK
View Code? Open in Web Editor NEWgb28181 plugin for monibuca
License: GNU Affero General Public License v3.0
gb28181 plugin for monibuca
License: GNU Affero General Public License v3.0
设备上线后,好像没有订阅GPS定位消息,导致接收不到定位数据
/api/gb28181/list只能查询计划的录像,而特殊的如移动侦测、事件录像是没有的
sse.WriteJSON(list)
select {
case <-time.After(time.Second * 5):
case <-sse.Done():
return
}
restful的这里建议NewTimer,确保超时内存能及时释放
sse.WriteJSON(list)
timeOut := time.NewTimer(time.Second * 5)
defer timeOut.Stop()
select {
case <-timeOut.C:
case <-sse.Done():
return
}
同样的server.go建议增加
t := time.NewTicker(time.Duration(config.RemoveBanInterval) * time.Second)
defer t.Stop() //新增
局域网下可以成功通信,但是插件发送的invite消息出现可稳定复现的超时,只有极小的概率成功。
发送的消息如下
writing SIP message to UDP 192.168.0.108:5061 {"plugin": "GB28181", "prefix": "transport.Protocol", "connection_key": ""udp:0.0.0.0:5060"", "sip_server_ptr": ""0xc00021de00"", "protocol_ptr": ""0xc00024aa00"", "connection_ptr": ""0xc000314380"", "request_id": ""779f96d4-370d-4e54-a3af-83294d32a154"", "transport": ""UDP"", "source": ""192.168.0.106:5060"", "destination": ""192.168.0.108:5061"", "transport_layer_ptr": ""0xc00021dea0"", "transaction_ptr": ""0xc000244240"", "transaction_key": ""z9hG4bK.Dmv5akDdDsm8aLOsmeB8fT7mbnQgcUVf__INVITE""}
得到的报错如下(master分支暂时没有打印报错log,这个是自己改的)
do SipRequestForResponse faild transaction.TxTimeoutError<transaction_key=z9hG4bK.Dmv5akDdDsm8aLOsmeB8fT7mbnQgcUVf__INVITE transaction_ptr=0xc000244240>: transaction timed out
按照GB28181附录J或者SIP协议,设备在SIP服务器注册成功,服务器返回的200相应中应该是有Contact这一头部字段的,但是目前版本插件是没有的,导致注册成功服务器返回给设备的报文是200 OK (0bingdings),而正常的应该是200OK (1bingdings),所以希望插件在返回的报文里添加Contact这一头部字段,这样就返回正确了
plugin-gb28181插件怎样安装 呢?
首先这个项目太棒了,解决了多种视频流的接入问题。但我们有个场景,相机只有rtsp流,请问能否拉流并转成gb28181格式,然后推送给gb28181服务端?
请问Monibuca 和nvr需要在一个网段内吗?
使用设备为海康摄像头,配置如下:
config.yaml配置如下
llhls:
enable: false
hls:
enable: false
monitor:
enable: false
global:
pulseinterval: 5s # 心跳事件间隔时间
gb28181:
invitemode: 1 #0、手动invite 1、表示自动发起invite,当Server(SIP)接收到设备信息时,立即向设备发送invite命令获取流,2、按需拉流,既等待订阅者触发
position:
autosubposition: false #是否自动订阅定位
expires: 3600s #订阅周期(单位:秒),默认3600
interval: 61s #订阅间隔(单位:秒),默认6
sipip: "" #sip服务器地址 默认 自动适配设备网段
serial: "34020000001110000001"
realm: "3402000000"
username: "34020000001110000001"
password: "12345678"
registervalidity: 80s #注册有效期
mediaip: "" #媒体服务器地址 默认 自动适配设备网段
port:
sip: udp:5060 #sip服务器端口
media: tcp:58200-59200 #媒体服务器端口,用于接收设备的流
removebaninterval: 10m #定时移除注册失败的设备黑名单,单位秒,默认10分钟(600秒)
loglevel: debug
启用monibuca进程,查看8080/gb28181/api/list API接口返回如下:
[
{
"Channels": [
{
"Address": "192.168.254.3",
"CivilCode": "CivilCode",
"DeviceID": "34020000001310000001",
"GpsTime": "0001-01-01T00:00:00Z",
"Latitude": "",
"LiveStatus": 0,
"LiveSubSP": "",
"Longitude": "",
"Manufacturer": "Manufacturer",
"Model": "Camera",
"Name": "优曼测试",
"Owner": "Owner",
"ParentID": "",
"Parental": 0,
"Port": 0,
"RegisterWay": 1,
"SafetyWay": 0,
"Secrecy": 0,
"Status": "ON"
},
{
"Address": "192.168.254.19",
"CivilCode": "CivilCode",
"DeviceID": "34020000001310000002",
"GpsTime": "0001-01-01T00:00:00Z",
"Latitude": "",
"LiveStatus": 0,
"LiveSubSP": "",
"Longitude": "",
"Manufacturer": "Manufacturer",
"Model": "Camera",
"Name": "Camera 01",
"Owner": "Owner",
"ParentID": "",
"Parental": 0,
"Port": 0,
"RegisterWay": 1,
"SafetyWay": 0,
"Secrecy": 0,
"Status": "OFF"
}
],
"ID": "34020000001110000001",
"Name": "Network Video Recorder",
"Manufacturer": "HIKVISION",
"Model": "DS-7816N-R2/16P",
"Owner": "",
"RegisterTime": "2024-01-21T14:54:08.084150099+08:00",
"UpdateTime": "2024-01-21T15:06:18.120260297+08:00",
"LastKeepaliveAt": "2024-01-21T15:06:18.120381176+08:00",
"Status": "ONLINE",
"SN": 3,
"SipIP": "172.18.156.34",
"MediaIP": "172.18.156.34",
"NetAddr": "171.106.18.191:62977",
"GpsTime": "0001-01-01T00:00:00Z",
"Longitude": "",
"Latitude": ""
}
]
访问:8080/preview/34020000001110000001/34020000001310000001播放视频流失败,STD输出如下:
15:13:57 DEBUG Preview visit {"path": "/preview/34020000001110000001/decoder-pro-hard.js", "remote": "222.71.242.202:56737"}
15:13:57 DEBUG Preview visit {"path": "/preview/34020000001110000001/decoder-pro-audio.wasm", "remote": "222.71.242.202:56737"}
15:13:58 DEBUG HDL visit {"path": "/hdl/34020000001110000001/34020000001310000001.flv", "remote": "222.71.242.202:56737"}
15:13:58 INFO 已创建 {"流": "34020000001110000001/34020000001310000001", "id": 1}
15:13:58 DEBUG warp context {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "HDLSubscriber", "ID": "222.71.242.202:56737"}
15:13:58 INFO 订阅 {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "HDLSubscriber", "ID": "222.71.242.202:56737"}
15:13:58 DEBUG GB28181 TryAutoInvite {"id": "34020000001110000001", "channel": "34020000001310000001", "opt": "t=0 0", "condition": true}
15:13:58 INFO 订阅者+1 {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "HDLSubscriber", "ID": "222.71.242.202:56737", "remains": 1}
15:13:58 INFO GB28181 invite response {"id": "34020000001110000001", "channel": "34020000001310000001", "status code": 200}
15:13:58 DEBUG GB28181 Device support tcp {"id": "34020000001110000001", "channel": "34020000001310000001"}
15:13:58 DEBUG found {"流": "34020000001110000001/34020000001310000001", "id": 1}
15:13:58 DEBUG create context {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "PSPublisher"}
15:13:58 INFO 发布 {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "PSPublisher", "ptr": "0xc000c135e0"}
15:13:58 INFO ⌛->🟡 {"流": "34020000001110000001/34020000001310000001", "id": 1, "动作": "publish"}
15:13:58 INFO tcp listen 1 at :58200
15:14:03 WARN no tracks {"流": "34020000001110000001/34020000001310000001", "id": 1}
15:14:03 INFO 🟡->🔴 {"流": "34020000001110000001/34020000001310000001", "id": 1, "动作": "timeout"}
15:14:03 INFO close {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "HDLSubscriber", "ID": "222.71.242.202:56737", "event": "close"}
15:14:03 INFO close {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "PSPublisher", "event": "close"}
观察到的现象:
当播放失败后,8080/gb28181/api/list这个API的返回对象就会变为[]空数组
目前看起来连接是建立了,从报错内容来看是没有收到推流数据,想请教一下该如何排查问题。
服务器上的端口已经全部开放(1-60999)
大佬,我开启了rtsp插件和GB28181插件,使用http://127.0.0.1:8080/api/summary?json=1查询发现有视频流"Path":"34020000001110000001/34020000001320000002"的,但是播放rtsp://localhost/34020000001110000001/34020000001320000002却报错?
您好,
准备在利用该插件实现语音推送(摄像头播放).实现流程如下:
1)前端页面向sip服务发送HTTP请求(摄像头ID作为参数)。
2)sip服务接收到前端页面请求后根据ID查询到对应的摄像头设备,发送SIP广播通知,并接收摄像头的广播应答。应答中包含摄像头的IP地址,端口号,音频编码信息。
3)sip服务向流媒体服务发送HTTP请求,携带要发送的摄像头RTP相关信息。流媒体服务发送前端音频流。
4)前端页面接收到步骤1的HTTP返回后,进行拾音操作,将PCM格式的音频流发送给流媒体服务。
5)流媒体服务将接收到的PCM音频流转码为PCMA格式。
6)流媒体服务将PCMA音频数据进行RTP封装,以UDP的方式发送到对应的摄像头。
这个插件内置的sip server, sip通信都没有问题. 有个问题是: 步骤3 是插件同monibuca之间通信吗?这个该如何实现?
谢谢
GB28181互联网视频传输,丢帧乱码,怎么解决。
\pkg\mod\m7s.live\plugin\ps\[email protected]\main.go:182:18: tcpConf.Listen undefined (type config.TCP has no field or method Listen)
能不能把插件和引擎的版本对应关系贴一下
在创建sip请求时,Uri中少给了Param导致发送时产生空指针错误
请问已经可以用在生产环境了么,我看到更新时间还挺新的
RT: GB35114-2017可以支持起来了^.^
这里记录一下GB28181接入的常见问题
国标编码不一致,在nvr或者摄像头的国标配置页;外域编码需要配置和Monibuca一致
国标编码问题,nvr的本机的11-13位国标编码需要为200,并修改摄像机11-13位的为131,Monibuca编码为120
还有可能是nvr配置Monibuca的国标编码和国标域反了
接入 国标 配置好了 提示这个 gb28181 decode rtp error: size 481 < 49376: RTP header size insufficient for extension 什么问题啊
不知道为啥就timeout了
15:27:50 INFO tcp listen 1 at :58201
15:28:00 WARN no tracks {"stream": "34020000001320000001/34020000001320000001"}
15:28:00 INFO 🟢->⌛ {"stream": "34020000001320000001/34020000001320000001", "action": "publish lost"}
15:28:00 DEBUG wait publisher {"stream": "34020000001320000001/34020000001320000001", "wait timeout": "10ms"}
15:28:00 DEBUG timeout {"stream": "34020000001320000001/34020000001320000001", "state": "⌛"}
15:28:00 INFO ⌛->🔴 {"stream": "34020000001320000001/34020000001320000001", "action": "timeout"}
请问 ,发送控制命令接口/gb28181/api/control的ptzcmd参数传什么
panic: runtime error: slice bounds out of range [:-1]
goroutine 120 [running]:
m7s.live/plugin/gb28181/v4.(*GB28181Config).StoreDevice(0x1937440, {0xc000757645, 0x14}, {0x1235158, 0xc000c286e0}, 0xc00074d8e0)
/home/runner/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/device.go:88 +0x705
m7s.live/plugin/gb28181/v4.(*GB28181Config).OnRegister(0x1937440, {0x1235158?, 0xc000c286e0}, {0x7f635cf23318, 0xc000c07b80})
/home/runner/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/handle.go:95 +0x3f2
created by github.com/ghettovoice/gosip.(*server).handleRequest
/home/runner/go/pkg/mod/github.com/ghettovoice/[email protected]/server.go:270 +0x28a
panic: runtime error: slice bounds out of range [:9] with length 0
goroutine 1616 [running]:
m7s.live/plugin/gb28181/v4.(*Channel).CreateRequst(0xc0013ae1c0, {0xe6cbab, 0x6})
/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/channel.go:100 +0x725
m7s.live/plugin/gb28181/v4.(*Channel).Invite(0xc0013ae1c0, {0x0, 0x0, {0x0, 0x0}, {0xc000804b50, 0xa}, 0xbebd2f1, 0xe358})
/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/channel.go:358 +0xbbc
created by m7s.live/plugin/gb28181/v4.(*Device).UpdateChannels
/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/device.go:245 +0x9b6
直接在main。go 引用就行吗?我试了 运行不起来,请问有详细的教程吗 新手不懂怎么操作,有 demo 提供吗
间隔时间很短的时间内连续发送多个INVITE,而这些INVITE的CALL-ID可能一样,导致通道丢失,实际有3个通道,而在M7S里只能收到1个或2个通道
目前NVR的推流,播放都没问题,非常不错,就是不知道调取NVR存储的视频回放该怎么做?麻烦告知,谢谢!
AutoCloseAfter 如果设置大于等于0,则当某个流最后一个订阅者取消订阅时会延迟N秒,会自动发送bye,节省流量。如果为了响应及时,可以设置成-1,保持流的连接
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.