Design and Implementation of A Video Monitoring System Based on cloud6410 [Figure]

Source: Internet
Author: User

Http://tech.c114.net/166/a669261.html http://www.c114.net (
)

Abstract:In order to realize a simple and highly reliable embedded video surveillance system, based on Samsung cloud6410 microprocessor system, combined with embedded technology and image processing technology, MPEG-4 coding is carried out by using hardware coding module MFC of cloud6410, the real-time transmission protocol is used for video transmission over the network. The local area network (LAN) test shows that the system has good video quality and stable performance, satisfying the embedded video monitoring requirements of low cost and high reliability. While describing the system framework, it also describes the key code examples for implementation.

Video Monitoring is widely used. With the rapid development of electronic information technology, multimedia technology and network technology, embedded video monitoring technology has also developed rapidly. Compared with the traditional monitoring system, the embedded monitoring system features low cost, small and flexible, and high reliability. In this paper, a simple and efficient video surveillance system is developed based on Samsung cloud6410 microprocessor arm11. The system can use either a network cable for transmission or a wireless USB Nic for wireless transmission. This article describes the system framework and focuses on the specific software implemented by the system.

1. system composition and working principle

The embedded video monitoring system consists of hardware and software. The hardware part consists of the video acquisition module, video encoding module, network transmission module, and embedded processor module. The software part is based on the embedded operating system platform, it includes the video data collection module, video encoding module, and network transmission module.

The general design principle of the system is as follows: the video data is collected through the 1.3 million pixel camera of ov9653, and then the video data is sent to the MFC (Multimedia encoding and decoding) module of the video to get the MPEG-4 video stream, finally, the data is sent to the receiving end through the network module. The system composition diagram 1 is shown in.

2 system hardware design

2.1 Data Collection Module

The video capture module uses an ov9653 camera sensor. The ov9653 camera sensor is a low-voltage CMOS image sensor. The output format of the captured image can be YUV/YCbCr or RGB.
.

2.2 video encoding Module

The system is developed based on the armsys6410 Development Board. The armsys6410 Development Board is based on Samsung cloud6410 microprocessor (ARM1176JZF-S kernel.

By using the MFC (Multimedia encoding/decoding) module provided by s36410, the YUV data collected by ov9653 is encoded into the MPEG-4 data stream. In addition, the RGB data collected by ov9653 can be directly displayed on the LCD screen.

2.3 network transmission module

The armsys6410 Development Board based on the processor offers one 10 m/100m network interface, one USB2.0-OTG, one USB host. In the network transmission module, you can directly use network interfaces for wired network data transmission, or use a USB interface network card for wireless data transmission. The difference is that the driver used in the software is different, but it has no impact on the program structure.

2.4 Embedded Processor Module

Samsung cloud6410 microprocessor (ARM1176JZF-S kernel) is a high-performance multimedia application processor, with powerful hardware multimedia format codec unit (MFC), perfect external device, at the same time, it has a running frequency of up to 667mhz.

3 System Software Design

An embedded operating system is an important part of an embedded system and provides a software platform for application development. Because the Linux system has good characteristics such as cropping and portability, many Linux systems are currently used for embedded system development.

The armsys6410 Development Board Based on has provided the operating system source code based on Linux 2.6.28 kernel. By cropping each functional module of the kernel, compiling an image file, and downloading it to the Development Board, You can port the LINUX embedded operating system and corresponding drivers.

The overall data flow of the system is shown in figure 2. In the figure ①, the raw data is from the external camera to the camera driver module. ② Indicates that the data is transmitted to the memory by the driver module after processing. Data can be in different formats. ③ Indicates the input buffer that the data is transmitted from memory to the video encoding module. The MFC encoding module reads data from the input buffer for MPEG-4 encoding. ⑤ Indicates that the data is transmitted to the output buffer of the video encoding module after the encoding is complete. 6. The encoded data is read from the video encoding output buffer and transmitted to the network transmission module for transmission.

Note that the video input buffer in the figure below is the input buffer for the decoding module, but the output buffer for the encoding module. The same is true for the output buffer in the figure.

3.1 video data collection program

The video capture program reads data using memory ing. By using memory ing, device files are directly mapped to the memory, bypassing the kernel buffer. The process accesses the device files just like accessing the common memory, which greatly improves the reading speed of video data.

The flowchart of video capture is shown in figure 3.

The following lists the key code for video capture.

First open the device, where codec_node is a predefined macro, indicating the camera node file path.
Dev_fp = open (codec_node, o_rdwr );
In the parameter settings section, you must first obtain the device capability parameters, check whether the required functions are available, and then set the parameters. Use the following code.
IOCTL (dev_fp, vidioc_querycap, & Cap );
The last line of code gets the device's function information and stores it in the parameter caf. After checking that the device has the required functions, set the parameters in the next line of code.
IOCTL (dev_fp, Vie) ioc_s_fmt, & codec_fmt );
Here, codec_fmt is a struct type parameter of the format information.
On the Linux platform, the implementation of image data collection is similar to that of file reading. The following code is used.
Read (dev_fp, g_yuv, yuv_fr_buf_size );
To transfer data to the MFC module, you can directly share the buffer, which reduces the data transmission in the memory and increases the efficiency.
Close the device file. Stop image acquisition, and then close the file.
IOCTL (dev_fp, vidioc_streamoff, & START );
Close (dev_fp );

The preceding code snippet is a key part of video capture. In the implementation section, there are many control procedures such as condition judgment and Branch selection, which are not described in detail here.

3.2 video encoding Program

The video encoding part uses the MFC Video Codec Module of to encode the video. Because hardware encoding is used, the encoding efficiency is very high. At the same time, in terms of program design, you do not need to involve specific hardware details, but only need to use the driver module provided by the cloud6410. The flowchart 4 of the encoding section is shown in.

The following lists the key code of video encoding.

Hopen = open (mfc_dev_name, o_rdwr | o_ndelay );
The last line of code opens the MFC device. The pre-defined macro mfc_dev_name specifies the path of the MFC device file.
In the initialization part of the module, you must specify the length and width of the Encoding Frame, the Encoding Frame Rate, and other parameters. The initialization information is not directly applied to devices, but stored in the structure type parameter pctx of an encoding parameter. Then, you can use the following code to set parameters, that is, to apply the parameters to actual devices.
IOCTL (pctx-> hopen, cmd_init, & mfc_args );
The encoding part is implemented using the next line of code.
Ioetl (pctx-> hopen, cmd_exe, & mfc_args );
After encoding, you can use the function to obtain the memory address of the encoded video frame. Function prototype:
Void * ssbsipmpeg4encodegetoutbuf (vold * openhandle, long * size ).
Close the device file.
Close (pctx-> hopen );

Similarly, the code of some process control sections is limited to space and not described in detail.

3.3 Network Transmission program

The network uses the RTP real-time transmission protocol for video data transmission. RTP (Real-Time Transport Protocol) is a transmission protocol used for network multimedia data streams. To make the implementation of the system simpler and more stable, the existing RTP Library is used for program development. This system uses the open-source C language library ortp for development.

Ortp library is an implementation of RTP protocol, which is fully written in C language. The ortp library uses simple and easy-to-use interfaces to implement the RTP protocol and can work on multiple platforms, such as Linux and Windows.

The process of the system network transmission module is relatively simple. The module first initializes the ortp library, transmits data, and releases the ortp library resources after the transmission is complete. Because the module process is relatively simple, the system flowchart is not listed here, and the specific implementation is described only. The following lists the key code of the network transmission module. Before transmitting data, perform some basic initialization operations on the ortp database. Initialize the timestamp and use the following code.

M_nUser-Timestamp = 0;
Then, call the initialization interface function provided by the ortp Library:
Ortp_init ();
Ortp_scheduler_init ();
After basic initialization, create a new RTP Session Object and set some parameters and attributes of the session object.
Session = rtp_session_new (rtp_session_sendonly );
The above Code creates a new RTP Session object, and then sets the parameters and attributes of the session using the following function.
Rtp_session_set_scheduling_mode (); rtp_session_set_blocking_mode (); rtp_session_set_remote_addr (); rtp_session_set _ payload_type ();

The preceding functions set the scheduling management, blocking mode, sending destination address, and load type of RTP session objects in sequence. Due to space limitations, the call parameters are omitted.

Call the library function to send data:

Rtp_session_send_wlth_ts ();
After sending data, destroy the RTP Session Object and release the resources of the ortp library.
Rtp_session_destroy (session );
Ortp_exit ();

In the network transmission module, it should be noted that due to the RTP protocol, the packet size is limited. Therefore, if the transmitted video frame is too large, packet transmission must be performed.

4 Conclusion

In this paper, a video surveillance system based on MPEG-4 coding is realized on the Development Platform Based on the microprocessor. Video Encoding is performed by using the Integrated MFC module of, achieving high coding efficiency. Finally, network data is transmitted through the RTP protocol. After the modular design, the network data transmission part of the system is independent of the specific wired or wireless transmission mode. Based on describing the implementation process of each part, this article describes the code implementation of the key part in detail. In the experiment, data encoding efficiency is very high. The MPEG-4 coding method is adopted. Under normal network conditions, the quality of video transmission is good, and the system runs stably. The experiment proves that the system is highly feasible.

Author: Hu Shimin Source: modern electronic technology

Disclaimer: This article only represents the author's personal opinion and has nothing to do with c114 China communication network. Its originality, as well as the statement text and content in this article have not been confirmed by this site, this article and all or part of the content, the authenticity, integrity, timeliness of this site do not make any warranty or commitment, for your reference only, please verify the relevant content on your own.

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.