National standard GB28181 video platform EasyGBS national standard platform device playback problem solution

The security video surveillance EasyGBS platform is based on the national standard GB28181 protocol, supports multi-channel device access, and distributes video streams in various formats such as RTSP, RTMP, FLV, HLS, and WebRTC to multiple platforms and terminals. The platform can provide strong video capabilities for comprehensive supervision platforms such as big data, and has been applied in a large number of projects, such as Bright Kitchen Bright Stove, Safe Village, Xueliang Project, etc.

According to user feedback, when the security video monitoring EasyGBS is running, the connected device can play normally at the beginning. After the cloud recording is turned on, there is no stop and replay operation, but the video stream is cut off.

The technician immediately carried out a packet capture analysis on the feedback, and found out that the program sent a request to stop streaming to the device.

But at this time, the status of the device is indeed in the state of playing, as shown in the figure:

So the troubleshooting code found that when the device network is poor, the device will cut off the flow, and the streaming media service will be actively cleared if the specified time exceeds 30s (the default value of the EasyGBS platform), but the streaming data in redis is still there, and when the device is in When recording, the automatic keep-alive will fetch the keep-alive stream data from redis, so there will be cases where the device status shows that it is playing, but the stream has disappeared.

The solution is as follows:

When the device is playing keep alive, judge the stream information, add a final processing stream time, and automatically re-pull the stream if it exceeds the specified time.

if stream != nil {
		latestGetFrameTime := stream.LatestGetFrameTime
		if latestGetFrameTime != "" {
			lastStreamTime, err := time.ParseInLocation("2006-01-02 15:04:05", latestGetFrameTime, time.Local)
			if err != nil {
				log.Printf("stop stream [%s] lastStreamTime %s err [%s]", streamid, latestGetFrameTime, err.Error())
				StreamStop(streamid)
				stream = nil
			}
			d := time.Since(lastStreamTime)
			if int(d.Seconds()) >= 60 {
				log.Printf("stop stream [%s] lastStreamTime %s", streamid, latestGetFrameTime)
				StreamStop(streamid)
				stream = nil
			}
		}
	}

After modifying according to the above method, the recording and playback are back to normal.

National standard video cloud service security video surveillance EasyGBS can provide streaming media access, processing, forwarding and other services, and supports monitoring equipment on the intranet and public network to conduct video surveillance live broadcast through the national standard GB/T28181 protocol. The video capabilities that can be realized by the platform include: security video surveillance, real-time live broadcast, video recording, voice intercom, cloud storage, retrieval and playback, alarm, cascade, etc. Interested users can go to the demonstration platform for experience or deployment testing.

Guess you like

Origin blog.csdn.net/EasyNTS/article/details/132302357