Web web page real-time broadcast RTSP video streaming solution for cameras such as Hikvision and Dahua

1. Background analysis

With the advent of the mobile Internet era, in order to adapt to the development requirements of the Internet, the security monitoring field has taken the lead in developing Internet video clouds such as EZVIZ Cloud, LeCheng Cloud and so on. service, providing high-quality video Internet surveillance services to the majority of individual or corporate surveillance users; in fact, whether it is an established surveillance manufacturer such as Hikvision Dahua or an emerging video cloud service provider, they basically transfer to RTMP, HLS, etc. A protocol adapted to the requirements of Internet development to realize live broadcast on demand on Internet web pages or mobile APPs. Then most of the streaming media formats output by our commonly used network cameras (IPC) or hard disk video recorders (NVR) and other security equipment or the GB/T28181 standard national security platform are RTSP formats. The RTSP protocol is known for its high degree of standardization, low latency, and protocol compatibility. It has strong (supports both live broadcast and on-demand playback) and other features, so that it is still the best streaming media protocol that is irreplaceable in the security industry.

2. How to perform RTSP live broadcast and on-demand without plug-ins on browser web pages (WEB)

First of all, we can obtain the RTSP stream from the network camera, but this RTSP stream cannot be played directly on the web page. At the current technical level, there are two solutions for playing the RTSP protocol on the browser:

1. Install the plug-in to play RTSP streams through the browser plug-in;

2. Play RTSP stream through HTML5 js engine video decoding;

At present, the first method is still used by some security monitoring equipment manufacturers, but has basically been eliminated. The main reason is that major browser manufacturers have banned web plug-ins, and web plug-ins have various problems such as installation trouble and poor compatibility.

The second solution is because H5 does not support the RTSP protocol, so the RTSP stream cannot be played directly through the H5 JS engine;

3. How to play RTSP live on-demand stream through html5?

First of all, we know that the RTSP protocol is a streaming media text negotiation protocol transmitted through the TCP protocol, and RTP streaming media messages are transmitted through TCP or UDP. Therefore, we need to send the rtsp layer text protocol proxy through Websocket, and pass it on the WEB page The Javascript engine establishes the rtsp interaction process and establishes the RTP data sending channel;

Then the RTP streaming media data is sent to the WEB side through the http protocol, and then the RTP data packet is assembled and parsed through the js engine. The H264 is parsed out and then software decoded or hardware decoded through H5, and then rendered and played through the web page.

We have already implemented this process in livewebPlayer.js, the H5 plug-in-free player on the web page, and also supports protocols such as HTTP-FLV/WS-FLV/HLS/RTMP for live broadcast and on-demand playback.

With the liveweb streaming service, we can easily implement RTSP streaming through the Websocket protocol for plug-in-free live broadcast and on-demand solutions through H5 on the web page.

About liveweb streaming platform

Liveweb comprehensive security video cloud service provides one-stop privatized deployment of integrated video security management system solutions. We adhere to the concepts of networking, integration, and intelligence, and use advanced software and hardware development technologies to solve problems such as centralized management of comprehensive security systems, multi-level networking, information sharing, interconnection, and multi-service integration.

Our original streaming media live broadcast technology is compatible with traditional security streaming media and does not require the installation of browser plug-ins. It solves problems such as high Internet access security monitoring delays and slow start-up; it supports live broadcast on-demand on all platform terminals.

Guess you like

Origin blog.csdn.net/xiehuanbin/article/details/135293989