ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.

Home Page:https://ossrs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do you support integration with GB28181? Monitoring, intelligent cameras, national standard streaming.

vickllny opened this issue · comments

Moved to ossrs/srs-gb28181#4

GB has been moved to a separate warehouse srs-gb28181, please refer to #2845.
For any issues, please submit them to the GB warehouse bug, or pr.

GB has been merged into the 5.0 branch, for version 5.0.74+. Please refer to #3176.

TRANS_BY_GPT3

Generally, it is to integrate with GB28181 devices to obtain video streams, and then push the streams to SRS to obtain a playback address. Development needs to be done by oneself.

TRANS_BY_GPT3

Roger that

I am not familiar with the RTSP monitoring industry. I warmly welcome friends in the field to work together.

  1. If the surveillance camera supports RTMP streaming, it can be directly pushed to SRS.
  2. If the monitoring device supports RTSP pulling, you can use SRS's ingester to start FFmpeg to pull the RTSP stream and convert it to RTMPT to push it to SRS.
  3. If the monitoring device can only push RTSP streams, you can use other RTSP servers to convert to RTMP, or you can use SRS's Stream Caster, which has RTSP protocol support. However, this requires development and maintenance. If any friend is willing to maintain it, they can have full authority to decide how to handle RTSP, and I can simply merge the PR.

Anyone there?

TRANS_BY_GPT3

It has been merged into the develop branch, thanks @xialixin, code reference: #1656 and #1679.

TRANS_BY_GPT3

I tested it and have a few questions to ask:

  • How can I obtain the list of registered camera devices?
  • Will the GB28181 live streaming support TCP mode in the future?

TRANS_BY_GPT3

Last year during this period, I discovered this project, and now there are new demands for the camera service. This time, I didn't expect to support the 28181 protocol while looking into this project. I sincerely appreciate your efforts.

TRANS_BY_GPT3

Thank you for the evaluation article written by Boss Tian: "Support of SRS4.0, a domestically produced open-source streaming media, for video surveillance GB28181". (link: https://mp.weixin.qq.com/s/VIPSPaBB5suUk7_I2oOkMw)

TRANS_BY_GPT3

Does it only support PS encapsulation and not basic stream encapsulation?
refer: GB28181 Appendix C

TRANS_BY_GPT3

Problem solved:
In version 4.0.23, when connecting to Hikvision NVR, it was found that the stream cannot be played when the NVR is set to push the SIP service IP address of SRS to the external network. However, it is possible to individually push the external network for a single camera. The SRS log is as follows.
333

Later, after Boss Xia's investigation, it was found that the problem was due to insufficient upstream bandwidth. The video and audio parameters of the NVR were adjusted, and attempts were made to lower the resolution and reduce the image quality. After these adjustments, the problem was solved.
111
Version 4.0.23 does not have any issues with the NVR.

TRANS_BY_GPT3

Consultation: After configuring according to the above document, it is possible to see the corresponding RTMP streaming through VLC for Hikvision devices. However, for Dahua devices, configuring the access to GB28181 does not work. The SRS backend keeps showing warnings like the following:
3 19:47:32.540][Trace][10883][264] gb28181: respone method=INVITE, uri=34020000002000000001@3402000000, version=SIP/2.0
[2020-05-13 19:47:32.540][Trace][10883][264] gb28181: INVITE response 34020000001310000091 client status=101
[2020-05-13 19:47:32.540][Trace][10883][264] gb28181: request client id=34020000001310000091, peer(117.61.246.237, 25642)
[2020-05-13 19:47:32.540][Trace][10883][264] gb28181: respone method=INVITE, uri=34020000002000000001@3402000000, version=SIP/2.0
[2020-05-13 19:47:32.540][Trace][10883][264] gb28181: INVITE response 34020000001310000091 client status=200
[2020-05-13 19:47:32.656][Trace][10883][265] <- GBS gb28181: client_id , peer(117.61.246.237, 21624) ps rtp packet 94B, age=-1815310828, vt=2/96, sts=1/3600/0, paylod=82B
[2020-05-13 19:47:32.948][Warn][10883][265][11] gb28181: ps sequence_number out of order, ssrc=0, pre=297, cur=299, peer(117.61.246.237, 21624)
[2020-05-13 19:47:32.948][Warn][10883][265][11] gb28181: ps sequence_number out of order, ssrc=0, pre=299, cur=298, peer(117.61.246.237, 21624)
[2020-05-13 19:47:32.949][Warn][10883][265][11] gb28181: ps sequence_number out of order, ssrc=0, pre=298, cur=300, peer(117.61.246.237, 21624)

My setup consists of devices on a local network, connected to an SRS hosted on Alibaba Cloud via a 4G wireless gateway.

TRANS_BY_GPT3

Excuse me for the trouble, when connecting to GB28181, the server communication has already been established, but after a while it will report this error and then exit the program. How should I troubleshoot this problem? Setting the logs to be detailed also didn't have any effect.
WechatIMG146

TRANS_BY_GPT3

gb28181 update the following features, waiting for Mr. Yang to merge into the main branch. If you want to try, you can obtain the latest features from the following branch.
https://github.com/xialixin/srs.git

  1. Implement a jitter buffer suitable for PS streams based on webrtc jitterbuffer.
  2. Optimize H264 start code replacement and NALU length calculation.
  3. Forward PS to RTMP through the source for stream forwarding.
  4. Modify to only forward the stream after receiving the first keyframe by default.
  5. Add a lock when updating the SIP device list.
  6. Set the receive buffer for the RTP listener.

TRANS_BY_GPT3

Some functionality requirements feedback from the gb28181 WeChat group, organized below. It may not be possible to implement all of them, but we can work together to achieve it!

  1. Introduce a feature, for example, the ability to call an interface based on the video channel ID/ssrc and receive a screenshot (URL).
  2. Basic functionalities include notifying the camera to record, retrieving the recording or playback files, getting the Nvr's recording file names, and playing the corresponding PS stream based on a specific time period.
  3. Real-time screenshots.
  4. Complete all functionalities provided by SPVMN:
    • Real-time on-demand commands (live on-demand, move left, move right, move up, move down, zoom in, zoom out, stop remote control).
    • Historical playback commands (playback, download, play, pause, fast forward, slow motion, start manual recording, stop manual recording, recording file retrieval).
    • Alarm-related commands (arm, trigger alarm, disarm, alarm reset).
    • Other commands (device directory query, device information query, device status query, device remote start, heartbeat).
  5. Support cascade.
  6. Support TCP transmission, support H.265 encoding.
  7. Compatibility testing.
  8. Alarm push callback, etc.
  9. Webpage backend.
  10. gb28181's voice intercom feature. Do we need to implement real-time voice communication for this?

TRANS_BY_GPT3

Can' or 'able to

I also encountered this problem.

TRANS_BY_GPT3

TRANS_BY_GPT3

TRANS_BY_GPT3

Hui

I also encountered this problem.

I am using version 4.0.20, but I found that this method cannot be used for subdomain integration. It seems that you can only directly integrate with the device. You can give it a try.

TRANS_BY_GPT3

@wkdepth, I also directly connect to the platform (Hikvision video platform). I also found that some video platforms require using rtcp to keep the media stream alive. (However, the platform can be configured to enable or disable the stream keep-alive feature).

TRANS_BY_GPT3

@wkdepth as the SIP server, have you solved the problem of aborting the startup?

TRANS_BY_GPT3

@xialixin As a streaming media server, I suggest SRS should focus on performing well in stream-related functionalities (such as: 3. Real-time screenshot and 4. Completing all functionalities provided by SPVMN).

TRANS_BY_GPT3

@wkdepth, I tried 4.0.20 and the SIP server started successfully.

TRANS_BY_GPT3

@wkdepth, I tried https://github.com/xialixin/srs.git and it can serve as a SIP server, allowing access to directories and streaming requests.

TRANS_BY_GPT3

@wkdepth, when I directly connect to the camera device, I can play the video normally. But when I cascade with other platforms, I encounter the following error and it exits: Segmentation fault (core dumped). Is this an error in the SRS4.0 program itself?
Image,
Image

TRANS_BY_GPT3

@wkdepth, I can play videos normally when directly connected to the camera device, but when I cascade with other platforms, the following error occurs and exits: segment fault (core dumped), segment fault (core dumped). Is this an error in the SRS4.0 program itself?
image,
image

Have you solved this problem? I am facing the same error when directly connecting to the camera. The registration is successful, but the program exits afterwards.

TRANS_BY_GPT3

@llq-llq I encountered this issue even when using the latest version 4.0.29, but when I rolled back to version 4.0.26, it was working fine.

TRANS_BY_GPT3

@wkdepth, I can play videos normally when directly connected to the camera device, but when I cascade with other platforms, the following errors occur and it exits. Segment fault (core dumped), Segment fault (core dumped). Is this an error in the SRS4.0 program itself?
Image,
Image

Have you resolved this issue? I am getting this error when directly connected to the camera. Registration is successful, but the program exits immediately.

I changed the local sip PORT from 5060 to 15060 in camera setting ,then it worked , don't know why

TRANS_BY_GPT3

commented

SIP Authentication

Image

When including the SIP username and SIP authentication ID parameters mentioned above, the correct format for the RTMP playback address is: rtmp://172.16.10.6:41935/live/34020000001320000001@34020000001320000001. This can be obtained by querying the "streams" via the HTTP API.

Image

TRANS_BY_GPT3

GB28181 manually created channel cannot be played.

SRS version: 4.0.35
SRS log as follows:
[2020-07-22 20:24:30.552][Trace][4594][303] gb28181: client id=13010100002000000115@13014109441310239901, stream idle timeout, stop!!!
[2020-07-22 20:24:30.552][Trace][4594][303] gb28181: client id=13010100002000000115@13014109441310239901 rtmp muxer is remove
[2020-07-22 20:24:30.553][Trace][4594][303] client finished.
SRS configuration is as follows:
push gb28181 stream to SRS.
listen 1935;
max_connections 1000;
daemon off;
srs_log_level info;
srs_log_tank file;
srs_log_file ./objs/srs.log;

http_api {
enabled on;
listen 1985;
}

stats {
network 0;
}

stream_caster {
enabled on;
caster gb28181;
output rtmp://13.32.203.128:1935/live/[stream];

listen 9000;

rtp_port_min 58200;

rtp_port_max 58300;

wait_keyframe on;

rtp_idle_timeout 60;

audio_enable off;

jitterbuffer_enable on;

host 13.32.203.128;

auto_create_channel on;

sip {

enabled on;


listen              5060;


serial              13010100002000000127;


realm               1301010000;


ack_timeout         60;


keepalive_timeout   120;


auto_play           on;

invite_port_fixed     on;

query_catalog_interval  60;

}
}

rtc_server {
enabled on;
listen 8000;
candidate 13.32.203.128;
}

vhost defaultVhost {
gop_cache off;
queue_length 10;
chunk_size 512;
rtc {
enabled on;
bframe discard;
}
}

Replay

How to replay the bug?

  1. Click on "Create Channel".
  2. Enter the channel ID as 13010100002000000115@13014109441310239901.

Expected behavior

Manually creating a channel can be played, or automatically creating a channel can determine which device it belongs to.

image
Open the built-in SRS demo, the API address and port displayed are http://13.32.203.128:9000:1985, but every time the 9000: part needs to be removed. Is it because of this incorrect IP address that manual channel creation does not work?

TRANS_BY_GPT3

Troubleshooting PS flow

image

Analysis of some possible reasons for the error in parsing PS stream 28181. If the above diagram indicates an error, analyze the following situations to determine the cause:

  1. Check if the bit rate is h264.
  2. Check for packet loss.
  3. Insufficient network bandwidth, excessive upstream bandwidth from the camera.
  4. Compatibility issues with camera manufacturers (Hikvision, Dahua, Uniview).
  5. If none of the above situations apply, analyze the packet capture.

TRANS_BY_GPT3

Hello @xialixin. May I ask if it is possible to directly modify the output in the configuration file to HLS format to cut the gb28181 stream?

TRANS_BY_GPT3

Hello. I would like to add username and password authentication functionality to connect to the gb28181 service. How can I add it? I noticed that version 4.0 doesn't have this feature available, right?

TRANS_BY_GPT3

[2020-09-10 11:47:21.002][Trace][19336][po728db8] <- GBS gb28181: client_id , peer(117.150.52.180, 18799) ps rtp packet 1412B, age=767694377, vt=2/96, sts=37978/33314400/0x8ac00a, paylod=1400B
[2020-09-10 11:47:31.002][Trace][19336][po728db8] <- GBS gb28181: client_id , peer(117.150.52.180, 18799) ps rtp packet 1412B, age=777694347, vt=2/96, sts=39005/34214400/0x8ac00a, paylod=1400B
[2020-09-10 11:47:41.003][Trace][19336][zr256404] gb28181: client id=34020000001320000001@34020000001320000001, ssrc=0x8ac00a, peer(117.150.52.180, 18799), rtmp muxer is alive
[2020-09-10 11:47:51.042][Trace][19336][po728db8] <- GBS gb28181: client_id , peer(117.150.52.180, 18799) ps rtp packet 1412B, age=797721127, vt=2/96, sts=41048/36018000/0x8ac00a, paylod=1400B
[2020-09-10 11:48:01.043][Trace][19336][po728db8] <- GBS gb28181: client_id , peer(117.150.52.180, 18799) ps rtp packet 1412B, age=807736007, vt=2/96, sts=42090/36918000/0x8ac00a, paylod=1400B
[2020-09-10 11:48:11.046][Trace][19336][zr256404] gb28181: client id=34020000001320000001@34020000001320000001, ssrc=0x8ac00a, peer(117.150.52.180, 18799), rtmp muxer is alive
[2020-09-10 11:48:11.712][Trace][19336][2o5dwz6y] gb28181: sip session=34020000001320000001 peer(117.150.52.180, 18440) status(RegisterOk,AliveOk) duration(511,60)
[2020-09-10 11:48:11.712][Trace][19336][2o5dwz6y] gb28181: sip session=34020000001320000001 device=34020000001320000001 status(ON, InviteOk), duration(420) How to solve this? Is there any missing configuration?

TRANS_BY_GPT3

commented

Here are some functional requirements collected from the gb28181 WeChat group. It may not be possible to implement all of them, but we can work together to complete them:

  1. propose a function, for example, to create an interface that can return a screenshot (URL) based on the video channel ID/ssrc.
  2. The basic functions are: 1) notify the camera to record, and then retrieve the recording files or playback files; 2) obtain the recording file names of the Nvr and retrieve the corresponding PS stream playback based on the time period.
  3. Real-time screenshots.
  4. Implement all the functions provided by SPVMN.
    Real-time on-demand related commands (real-time on-demand, left, right, up, down, zoom in, zoom out, stop remote control).
    Historical playback related commands (playback, download, play, pause, fast forward, slow down, start manual recording, stop manual recording, recording file retrieval).
    Alarm related commands (arming, alarm, disarm, alarm reset).
    Other commands (device catalog query, device information query, device status query, device remote startup, heartbeat).
  5. Support cascading.
  6. Support TCP transmission, support H.265.
  7. Compatibility testing.
  8. Alarm push callback, etc.
  9. Web backend.
  10. Is the gb28181 voice intercom different from voice instant communication?

Please add me to the gb28181 WeChat group.

TRANS_BY_GPT3

I am also seeking to join the GB28181 WeChat group.

TRANS_BY_GPT3

Seeking to join the GB28181 WeChat group

TRANS_BY_GPT3

commented

Snipaste_2021-01-18_22-38-17

Intention that is planned

[2021-01-18 22:37:17.336][Trace][500664][q9244g8v] gb28181: request client id=34020000001320000100, peer(115.53.147.211, 33733)
[2021-01-18 22:37:17.336][Trace][500664][q9244g8v] gb28181: respone method=INVITE, uri=34020000002000000001@3402000000, version=SIP/2.0 
[2021-01-18 22:37:17.336][Trace][500664][q9244g8v] gb28181: INVITE response 34020000001320000100 client status=400
[2021-01-18 22:37:17.435][Trace][500664][q9244g8v] sig=15, user terminate program, fast quit
[2021-01-18 22:37:17.699][Trace][500664][q9244g8v] gb28181: request client id=34020000001320000100, peer(115.53.147.211, 33733)
[2021-01-18 22:37:17.699][Trace][500664][q9244g8v] gb28181: respone method=INVITE, uri=34020000002000000001@3402000000, version=SIP/2.0 
[2021-01-18 22:37:17.699][Trace][500664][q9244g8v] gb28181: INVITE response 34020000001320000100 client status=100
[2021-01-18 22:37:17.700][Trace][500664][q9244g8v] gb28181: request client id=34020000001320000100, peer(115.53.147.211, 33733)
[2021-01-18 22:37:17.700][Trace][500664][q9244g8v] gb28181: respone method=INVITE, uri=34020000002000000001@3402000000, version=SIP/2.0 
[2021-01-18 22:37:17.700][Trace][500664][q9244g8v] gb28181: INVITE response 34020000001320000100 client status=400
[2021-01-18 22:37:18.229][Trace][500664][q9244g8v] gb28181: request client id=34020000001320000100, peer(115.53.147.211, 33733)
[2021-01-18 22:37:18.229][Trace][500664][q9244g8v] gb28181: respone method=INVITE, uri=34020000002000000001@3402000000, version=SIP/2.0 
[2021-01-18 22:37:18.229][Trace][500664][q9244g8v] gb28181: INVITE response 34020000001320000100 client status=400

The above information keeps showing me an error 400. It occurred once randomly before, but I'm not sure what configuration is incorrect now.

TRANS_BY_GPT3

SRS4.0 GB28181 Configuration Instructions and API Interface Documentation

Can this section be merged into the wiki http API page for easier access by users?

TRANS_BY_GPT3