Design and Implementation of Remote network monitoring system for Embedded MPEG-4 based on ARM

Source: Internet
Author: User

Design and Implementation of Remote network monitoring system for Embedded MPEG-4 based on ARM

Abstract: This paper introduces in detail the Design of Video Acquisition, compression, transmission and system control of the embedded MPEG-4 remote network monitoring system based on ARM, provides the TCP/IP-based C/S software architecture and the design and implementation of multi-threaded communication.

In the application of remote monitoring systems, it is often required that the host of the monitoring center can receive one or more monitoring data at the same time, and can send one or more control commands at the same time. Therefore, how to conveniently and efficiently transmit monitoring data from multiple sites to the monitoring host over a computer network under the condition of limited bandwidth is the main problem to be solved by such systems.

Overall System Structure
To implement an embedded remote digital video surveillance system based on TCP/IP network, the system structure 1 of this design is shown in.
In Figure 1, the camera is controlled by the outside world through the RS-232 interface, the control command for a series of ASCII code, you can adjust the camera focal length and control the rotation of the cloud platform. The embedded hard coding Board also has a RS-232 interface that can be used to set the source standard (PAL/NTSC), encoding brightness, encoding color, audio rate, encoding volume and encoding rate. The encoding board is integrated with the network server into a chassis, and the encoding board outputs data to the network server through the PCI interface. The network server has multiple RS-232 interfaces connected to the RS-232 interfaces of the camera and the hard-coding board, respectively.
The playback device consists of an embedded hard decoding board and a TV. The decoding Board uses a rate adaptive method, and the decoding rate automatically matches the encoding rate of the remote encoder. The decoder board and network server are also integrated into a single chassis. The system also implements soft decoding. In this mode, the playback device is composed of a PC with a video capture card installed, and the decoding software and Media Player are run on it, output images and sound through a PC monitor and speaker.
The recording device of the system is composed of a DVR and placed on the display point side to store system images.
The console is implemented by a PC running Windows operating system, and the control software of the client is run on the PC. The Management Server is also implemented by a PC running the Windows2000 operating system, and the system management software is run on the PC. In a simplified system implementation, the Management Server and console can be implemented on the same PC. In this case, the management software and control software run on the same host, but it still communicates through the network interface.

System Hardware Design
Network Server is the core component of the system hardware. It consists of embedded computers running embedded operating systems, and runs the core software of the system on the embedded operating system.
Network Server is based on ARM Kernel CPU--S3C44B0X. The chip is an ARM 7 TDMI-based chip. On the one hand, it has the advantages of ARM processor: low power consumption, high performance, and a wealth of On-Chip resources, it is very suitable for the development of embedded products.
MPEG-4 multimedia Encoding Chip is produced by South Korea intime ime6400, the chip provides a wide range of peripheral hardware interfaces: supports 16-bit Video Decoder interfaces, 32-bit data, MHz SDRAM data bus interfaces, I2C bus interfaces, I2S external audio/PCM encoder/DSP interfaces, and flexible host interfaces recommended by ccir601, multiple types of CPUs are supported.
Figure 2 briefly introduces the structure and network interface of MPEG-4 hardware video compression processing. With ime6400 chip as the core, the MPEG-4 Video Acquisition and compression module completes a/D Conversion of standard video signal (PAL or NTSC signal), MPEG-4 compression and the communication function between the two modules. In Figure 2, the video decoding ADC converts the analog video signal input from the camera into a digital video signal, and then performs encoding preprocessing, that is, the ccir601 format signal output by video decoding is converted to the CIF or qcif format that can be processed by the encoder, and then compressed and encoded by MPEG-4. The software on b0x controls the parameter settings of the encoder and reads the compressed code stream data through the bus interface unit. The video data processing module consists of the following functional units: bt829 as the core of the video ADC Unit; ime6400 as the core of the MPEG-4 Video Compression unit; the control logic and bus interface unit composed of the core of b0x. The bus interface unit is the channel through which the video data processing module interacts with the b0x. It can exchange video streams and control data with the host. The control logic is the core of the video capture and compression module. It controls and coordinates the work of each module and provides control signals, you can use commands to select, buffer, read/write enabling, and switch between the data bus and the address bus.
Lens cloud control is through the RS-232 port on the b0x, allowing users to adjust the system according to their own requirements. You can adjust the image quality by adjusting the depth of field, focal length, and aperture of the lens, or by adjusting the upper, lower, and left sides of the cloud platform to obtain images of different angles. The client software of the monitoring center sends adjustment information to the server through the Socket network interface. After the server receives the control command, it identifies the command, then send commands to the corresponding RS-232 port to control the cloud platform, complete the adjustment task.

Design and Implementation of the video data transmission and Instruction Control Module
The monitoring host uses the video data transmission module to encode the video stream data collected on site, and then sends the data through the computer network in the form of IP multicast. For the sent video data, the video data receiving and playing module running on the host of the monitoring center can be saved as a database for later query and playback. On the other hand, the video data can be played in real time.
The software structure of the system adopts the client server structure. The two ends establish TCP/IP connections through the network, and exchange data according to the custom data communication protocol to complete data communication and system control functions. The client of the monitoring center applies to the server to establish a connection. After the server listens to the connection request, it establishes a socket connection with the client. The client sends a control signal to the server, and the server sends a video code stream to the client.
The server software runs on b0x. The main idea of the software design is as follows: synchronization between reading threads, sending threads, and control threads to prevent the waste of limited resources.
To make full use of the CPU computing power and improve the overall performance of the system, the system adopts the multi-thread technology to schedule tasks.
Considering that the host in the monitoring center must monitor multiple sites at the same time, it is necessary to add Multiple Multicast Groups. When designing the system, the monitoring center must send data requests to the corresponding monitoring site before receiving video data. Therefore, we need to establish two communication channels: one is the control channel and the other is the data channel. The control channel is used to establish a session between the sender and the receiver, including sending some data request and validation control information. The receiving end sends a data request to the corresponding sending end before receiving the video stream data. After receiving the data request, the sending end sends back the corresponding IP multicast address and port to the receiving end, the receiving end is added to this group to receive video stream data. To ensure that the control information is accurate to the other party, we choose a TCP protocol with high reliability for the control channel. The data channel is used for Video Stream Data communication. We use the VxWorks IP multicast group. These two communication channels are independent from each other and each other executes their own tasks.

Design of the video data transmission module
During video transmission, the server requires that the stream reading and sending do not interfere with each other, so as to avoid mutual waiting or conflict between reading and sending. Similarly, there is a relationship between client decoding and reception. We can use the inter-task communication function to coordinate activities between multiple independent tasks. VxWorks provides a rich set of inter-task communication mechanisms, including shared memory, semaphores, message queues, and pipelines. The most direct and obvious way to communicate between tasks is to access the shared data structure. Because all VxWorks tasks coexist in a single linear address space, it is very easy to share the data structure among multiple tasks. Various types of global variables are defined in any program, can be directly accessed by all tasks.
Because the real-time Multicast Video Stream comes from the MPEG-4 encoder, we need to obtain the video data from the encoder first, which is mainly done by accessing the I/O port provided by the encoder. This design uses a multi-task Video Transmission Technology Based on the ring buffer, which better solves the problem of non-interference between reading and sending of code streams. The system's circular buffer not only achieves the mutex Effect of data separation, but also serves as a smooth code stream. The read and send tasks are mutually exclusive. A read Task reads 4 K video data from the encoding module for processing by the sending task. To avoid competition during reading, use semaphores to lock the ring buffer to ensure mutual access. The access to the circular buffer for sending tasks is similar. By using the ring buffer and mutex lock, the synchronization problem of these two tasks can be completely solved.
Design of Instruction Control Module
The system defines its own command system and command transmission protocol. Commands can be divided into the following types: Work Control (transmission start, transmission stop, storage control, etc.); lens cloud platform control (focal length, aperture, automatic rotation, etc ); system settings (user management, communication parameter settings, etc.). Each Command has a unique identification mark before it. After receiving the command, the server can distinguish it from other commands.
The select function of the multiplexing input/output model enables efficient socket management. Using a socket that works in the non-blocking mode improves the program efficiency (compared with blocking socket) to a certain extent ). However, the program needs to constantly poll each socket descriptor, which wastes a lot of CPU time. If the process does not actively poll the socket, but registers the socket to be monitored to the system, and then waits passively. When some events occur on the socket, the system then notifies the process in some way, and then the process detects the socket, discovers the corresponding event and processes it. In this way, the process detects the socket only when it knows that an event has occurred on the socket. In the absence of an event, the process will sleep, therefore, this method saves a lot of CPU time and greatly improves the overall performance of the system for systems with insufficient resources.

Conclusion
The embedded MPEG-4 remote network monitoring system based on ARM b0x is designed in this paper. It has been applied in highway monitoring of a province and has achieved good application effect. The monitoring system is highly stable and supports Internet-based data transmission. The C/S architecture allows users to remotely manipulate the system. Each sub-module of the system is relatively independent, through the use of MPEG-4 video compression technology, high-definition images, picture quality can be close to the DVD effect, can achieve single screen rotation monitoring and 1 ~ Monitoring of 16 images on the same screen. Supports remote and local cloud platform control, supports multi-task operations, and supports synchronous image storage, monitoring, and remote control. The monitoring distance is extended with the network extension, which has a good prospect for development and application.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.