Intelligent bus video monitoring method based on BS
Technical Field
The invention belongs to the technical field of public transport systems, and particularly relates to a method for analyzing information of a passenger getting on/off bus stop based on an IC card and GPS data.
Background
The bus is an important component in a public transport system, plays an important role in improving the urban transport pattern and facilitating the trip of citizens, is also a symbol of urban image, and is an attractive landscape in cities. In order to maintain the safety of the vehicle form and count the people on the trip, people install a video monitoring system on the vehicle.
For example, patent application 201310044697.8 discloses a video monitoring system, which includes a management server module, a client module, a streaming media forwarding module, an electronic map module, an alarm host management module, a centralized storage module, an analog quantity acquisition module, a digital matrix module and a WEB function management module, wherein the management server module is bridged with each module, the streaming media forwarding module, the electronic map module, the centralized storage module, the analog quantity acquisition module, the digital matrix module or the WEB function management module is provided with an alarm subsystem, the alarm subsystem is connected with the alarm host management module through a serial port or a network, the video monitoring system is a distributed cluster architecture, the monitoring system manages monitoring nodes through cascading, and the video monitoring system is provided with at least one secondary development interface. The video monitoring system has compatibility, can perform parameter level management on the front-end camera, and can modify the configuration of the front-end camera.
In a video monitoring system with a traditional C/S framework, a user needs to additionally install a client program to play streaming media, and smooth user experience cannot be provided.
Disclosure of Invention
In view of the above problems, an object of the present invention is to provide an intelligent bus video monitoring method based on BS, which can play real-time video, request video, and download video in a mainstream browser without additionally downloading and installing software.
The invention also aims to provide an intelligent bus video monitoring system method based on the BS, which is convenient for realizing rapid data transmission and user experience.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a BS-based intelligent bus video monitoring system method is characterized in that vehicle-mounted terminal equipment carries a 3G/4G mobile network for communication and supports access of a network camera, an analog camera and a sound pickup, and the method comprises the following specific implementation steps:
101. equipment plug flow;
the vehicle-mounted terminal equipment firstly collects video images and audio data of a camera, compresses the audio and video data by adopting H.264 and G.711 codes, packages the compressed audio and video data through a real-time control protocol, and then pushes the compressed audio and video data to a video access gateway server.
The packets are FU-A packets, and the FU-A packet pattern is described as follows:
1) single NAL packet unit
A 12 byte RTP header is followed by audio-video data.
2) FU-A slicing format
H264 video packets with larger frame data are sent by RTP fragments. A 12 byte RTP header is followed by an FU-a slice,
3) unpacking and packing
Unpacking: when an encoder needs to slice an original NAL according to FU-A during encoding, a unit header of the original NAL and a unit header of the FU-A after slicing have the following relationship:
the first three bits of the original NAL head are the first three bits of the FU indicator, the last five bits of the original NAL head are the last five bits of the FU header, and the remaining bits of the FU indicator and the FU header are determined according to actual conditions.
And (3) group packaging: when a receiving end receives fragment data of FU-A and needs to combine and restore all fragment packets into an original NAL packet, the relationship between the FU-A unit header and the restored NAL is as follows:
the eight bits of the restored NAL header are composed of the first three bits of the FU indicator plus the last five bits of the FU header, namely:
nal_unit_type=(fu_indicator&0xe0)|(fu_header&0x1f)。
102. issuing the media stream;
the video access gateway server receives the audio and video stream of the equipment and performs framing; and according to the RTMP (real-time message transfer protocol) standard, pushing the audio and video stream to the SRS stream server cluster to form a real-time live video source.
Meanwhile, the video access gateway server stores the audio and video stream data into the disk array, and establishes a video index in the MySQL database to realize a cloud storage function; and the video files in the array are called through the video index, so that the on-demand playback function is realized.
103. The media stream is distributed.
The Web client player firstly logs in a service platform, calls online equipment, acquires a real-time live broadcast path of the online equipment, is connected with an SRS streaming server cluster through the live broadcast path, and the SRS streaming server sends real-time audio and video streams to the Web client through an RTMP standard protocol.
And after receiving the real-time audio and video stream, the Web client player decodes and displays the real-time audio and video stream.
The method can play real-time videos, request videos and download videos in a mainstream browser under the condition of not additionally downloading and installing software, and compared with the traditional C/S framework, the user experience is more convenient, fast and smooth.
Drawings
FIG. 1 is a diagram of an architecture in which the present invention is implemented.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 is an architecture diagram of a method for implementing the present invention, and the method for implementing the intelligent bus video monitoring system based on the BS according to the present invention is shown in the figure, and the method for implementing the intelligent bus video monitoring system based on the BS according to the present invention includes that a vehicle-mounted terminal device carries a 3G/4G mobile network for communication, and supports access of a network camera, an analog camera, and a sound pickup.
The method specifically comprises the following steps:
a. equipment plug flow
The vehicle-mounted terminal equipment firstly collects video images and audio data of a camera, compresses the audio and video data by adopting H.264 and G.711 codes, packages the compressed audio and video data through a real-time control protocol, and then pushes the compressed audio and video data to a video access gateway server.
The packets are FU-A packets, and the FU-A packet pattern is described as follows:
1. single NAL packet unit
A 12 byte RTP header is followed by audio-video data.
2. Sliced format of FU-A
H264 video packets with larger frame data are sent by RTP fragments. The 12 byte RTP header is followed by the FU-a slice:
FU indicator has the following format:
+---------------+
|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+
|F|NRI|Type|
+---------------+
FU indicates that the Type field Type of byte 28 denotes FU-a. The value of the NRI field must be set according to the value of the NRI field of the sliced NAL unit.
The format of the FU header is as follows:
+---------------+
|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+
|S|E|R|Type|
+---------------+
S:1bit
when set to 1, the start bit indicates the start of the sliced NAL unit. The start bit is set to 0 when the following FU payload is not the start of the sliced NAL unit payload.
E:1bit
When set to 1, the end bit indicates the end of the fragmentation NAL unit, i.e. the last byte of the payload is also the last byte of the fragmentation NAL unit. The end bit is set to 0 when the following FU payload is not the last slice of a sliced NAL unit.
R:1bit
The reserved bit must be set to 0 and the receiver must ignore the bit.
Type:5bits
NAL unit payload type definitions are given in the following table
Type
|
packet
|
Type name
|
0
|
undefined
|
-
|
1-23
|
NAL unit
|
Single NAL unit packet per H.264
|
24
|
STAP-A
|
Single-time aggregation packet
|
25
|
STAP-B
|
Single-time aggregation packet
|
26
|
MTAP16
|
Multi-time aggregation packet
|
27
|
MTAP24
|
Multi-time aggregation packet
|
28
|
FU-A
|
Fragmentation unit
|
29
|
FU-B
|
Fragmentation unit
|
30-31
|
undefined
|
- |
3. Unpacking and packing
Unpacking: when an encoder needs to slice an original NAL according to FU-A during encoding, a unit header of the original NAL and a unit header of the FU-A after slicing have the following relationship:
the first three bits of the original NAL head are the first three bits of the FU indicator, the last five bits of the original NAL head are the last five bits of the FU header, and the remaining bits of the FU indicator and the FU header are determined according to actual conditions.
And (3) group packaging: when a receiving end receives fragment data of FU-A and needs to combine and restore all fragment packets into an original NAL packet, the relationship between the FU-A unit header and the restored NAL is as follows:
the eight bits of the restored NAL header are composed of the first three bits of the FU indicator plus the last five bits of the FU header, namely:
nal_unit_type=(fu_indicator&0xe0)|(fu_header&0x1f)。
b. publishing media streams
The video access gateway server receives the audio and video stream of the equipment and performs framing; and according to the RTMP (real-time message transfer protocol) standard, pushing the audio and video stream to the SRS stream server cluster to form a real-time live video source.
Meanwhile, the video access gateway server stores the audio and video stream data into the disk array, and establishes a video index in the MySQL database to realize the cloud storage function. And the video files in the array are called through the video index, so that the on-demand playback function is realized.
c. Distributing media streams
The Web client player firstly logs in a service platform and calls the online equipment. And acquiring a real-time live broadcast path of the online equipment. The method comprises the steps that an SRS streaming server cluster is connected through a live broadcast path, and real-time audio and video streams are sent to a Web client by the SRS streaming server through an RTMP standard protocol;
and after receiving the real-time audio and video stream, the Web client player decodes and displays the real-time audio and video stream.
The system mainly comprises terminal equipment, a stream server cluster, a video management server and a service system server. The terminal video acquisition equipment is installed on the bus, and after the bus is powered on, the equipment automatically registers to the video management server and pushes audio and video stream data to the stream server cluster.
A browser client logs in a service system server, acquires a terminal list and a playing address, and plays a real-time video; inquiring a device video list, ordering video and the like.
Therefore, the method can play real-time videos, request videos and download videos in a mainstream browser under the condition of not additionally downloading and installing software, and compared with the traditional C/S framework, the user experience is more convenient and smooth.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.