The new version of chrome plays the RTSP full scheme and supports h.265

Time:2021-12-9

1、 Historical background

Today, when there are cameras everywhere, it is often necessary to integrate video playback functions in various B / s information systems. Cameras of large manufacturers such as Haikang, Dahua and Huawei follow the monitoring industry standards and generally only support RTSP transmission protocol, while mainstream versions of modern browsers such as chrome, Firefox and edge do not support direct native playback of RTSP streams!

2、 Existing programmes

There are three common options for playing RTSP streams in web pages without plan support in the future:

1. First transfer the RTSP transfer code to the video stream that can be directly played by the browser on the server side, and then provide it to the terminal browser for playback. This is also known as the plug-in free playback method. Although this scheme has good compatibility with the operating system and browser, the delay is often very high, often as long as a few seconds, especially the first screen display is very slow and the experience is poor. In actual use, since it is necessary to build a video transcoding and streaming service with high load operation on the server, it consumes a lot of CPU and memory, occupies a lot of bandwidth, and has a high long-term use cost. If there are more cameras or more terminals playing video online, the server will be under great pressure. When the terminal wants to see multi-channel, high-resolution or h.265 video, this scheme often plays Caton and flower screen in the actual use process, and the defects become more and more obvious. Especially in some very critical applications, if we can’t find the danger earlier and eliminate it in time through the monitoring video, we may not be able to avoid the unbearable risk and lose the significance of video monitoring.

2. Different from the first scheme, this scheme transfers the server-side transcoding process to the front end, and the pressure is transferred to the terminal computer. Because modern high-level browsers already support wasm Technology (except IE), they have adopted this technology to realize RTSP transfer code playback at the front end. Due to the uneven hardware of the terminal computer, it is difficult to obtain a better playback effect on some low and medium-sized computers. The main problem is limited by the defects of wasm, which can only be decoded by software, can not take advantage of the hardware acceleration ability of the terminal computer, and does not support multithreading, which makes it very difficult to play multi-channel RTSP streams. In the face of high-resolution and h.265 video streams, the same effect is not good, and it takes up a lot of CPU and memory of the terminal computer, so it is impossible to do other things, Therefore, it is basically unable to meet the hard requirements of Party A’s customers.

3. Using the original plug-in technology scheme, when chrome and other browsers can still use npapi plug-in technology before 2015, the problems encountered in the first two schemes are not problems. They can be played directly through local native player controls, and there is little pressure on the server. The terminal can also make full use of the acceleration ability of local hardware, and multi-threaded technology is used in multi-channel playback, Can achieve better playback effect. The disadvantage is that plug-ins need to be installed, and the compatibility of the operating system is poor. If this solution can solve the compatible use of high-version chrome and other browsers, it is undoubtedly the best technical solution to realize low delay multi-channel stable playback, and there is no pressure to meet the hard playback indicators of Party A’s customers.

2、 Final plan

The ape master middleware VLC web page playback applet fully simulates and realizes the playback effect of ActiveX controls and npapi plug-ins in high versions of modern browsers such as chrome, and calls VLC at the bottom (it is a free and open source cross platform multimedia player and framework that can play most multimedia files, DVD, audio CD, VCD and various streaming media protocols) The ActiveX control of the desktop client can directly play the standard RTSP stream of Haikang, Dahua, Huawei and other cameras with low delay on the web page. Since the actual call is the VLC local native playback control, it can make full use of the acceleration ability of the local hardware to realize efficient hard decoding and playback of multi-channel or high-definition video (h.265). It can support up to 25 channels of simultaneous playback, and can be used at least in chrome 41 Firefox 50, edge 80 (chromium kernel), 360 speed / security, ie, Oprea 36, QQ and other browsers are also compatible with the latest versions of these browsers.

The VLC web page playing applet has the following advantages:

1. On the premise of supporting mainstream browsers, it is an exclusive playback scheme that can achieve low delay (300 milliseconds) in the current market;

2. Support multi-channel simultaneous playback, dynamic switching of playback sources, playback and capture, especially high-resolution video or large screen playback experience;

3. The underlying playback technology adopts the VLC open source scheme, the follow-up service of the player is guaranteed, the playback format is compatible, and supports H.264 and h.265 without pressure;

4. VLC web page playing applet can obtain its source code for customized development after additional payment, which is self controllable;

5. Support the cameras of Haikang, Dahua, Huawei and other manufacturers. As long as the standard RTSP stream can be provided, it can be played;

6. The mobile terminal can directly use VLC open source app without separate development, with less investment and quick effect;

7. This technical scheme can realize the smooth upgrading under the original technical system, reduce the technical route and delayed delivery risk caused by the large-scale transformation of the scheme, and save a lot of R & D costs.

When the terminal computer adopts the VLC web page playback scheme, it needs to deploy the ape master middleware, cooperate with the VLC web page playback applet, and install the VLC desktop client. In order to simplify the deployment process, decompress the VLC green package and put it into the VLC applet directory of the middleware, Then make these program files into an MSI or exe installation package and put them on the B / s server to prompt the user to download and install or the implementation engineer to deploy them uniformly. Generally speaking, the places that need to watch video surveillance are basically concentrated in the monitoring room. The number of computers is limited. It is not difficult to install some software during deployment. Then, with the help of the online upgrade mechanism of master ape middleware, the problem of traditional client software upgrade and maintenance can be completely solved, killing two birds with one stone.

A good technical implementation scheme should first meet the rigid needs of customers, secondly reduce the total cost of procurement, development, implementation and maintenance as much as possible, thirdly, have good compatibility and stability, and finally try to ensure that the technical scheme cannot fail due to the upgrade of browser, and it is better to realize the requirements of independent control of the company. VLC web page playing applet provides such a low-cost semi open source technical scheme with stability, reliability, good compatibility, low delay and stable playing of multi-channel RTSP at the same time. It is undoubtedly the best choice for the security industry to play RTSP stream on the web page.