VIDEOAUDIO compressed data stream playback technology in Visual Basic

zhaozj2021-02-08  472

Zhang Hanhua Metropolitan Peak

National Defense University

-------------------------------------------------- ------------------------------

---- 1. introduction

---- Bank's digital monitoring monitoring system is currently developing a development project with market and application prospects, and the monitoring monitoring system developed by different MPEG acquisition cards and hardware peripherals has comparative technology at home and abroad. In order to meet real-time monitoring, real-time collection of compression, playback, compressed data stream propagation, etc. In this system, a video data acquisition card for network video / audio multi-point transmission (video broadcast) is used, providing AVI (MPEG I FRAME compression coding) collection, MPG collection. The sender broadcasts the MPEG stream, the accepting end accepts the MPEG stream and displays, and network transmission uses Winsock 2 IP-Multicast. If the unit is a transmitting end, another PC on the network can be used as a receiving end. As long as the different port numbers are specified, there may be multiple PCs as the sender, and multiple PCs are used as the video data of the different transmitters as the receiving end, or the data can be stored as the MPEG file while transmitting data. This article mainly introduces some programming techniques for developing an Audio / Video data playback of MPEG cards in a VB environment.

---- 2. Introduction to the content and development of MPEG

---- Multimedia information mainly includes three major categories of images, sounds, and text. Among them, the amount of information such as video and audio is very large, and the expression and output of this information are also different. Effective expression and appropriate treatment for these data are important, which makes multimedia information compression technology a key technologies in the field of multimedia communications. ISO and IEC jointly established MPEG (MOVING PICTURE EXPERT Group) established in 1988, is committed to sports images and their sound coding global standardization. It includes MPEG system: MPEG video, MPEG audio. In order to promote the society from the era of text information to the multimedia information era, ISO followed by MPEG-1, 2 and 4, MPEG-7 was launched.

---- MPEG-1 is set in 1993 (ISO / IEC 11172), which is an international standard for digital storage medium for 1.5 Mbit / s or less data transfer rates. The video compression ratio is 26: 1. MPEG-2 is set in 1995 (ISO / IEC 13818), which is the 3-10 Mbit / S of 3-10 Mbit / s 3-10 Mbit / s of 3-10 Mbit / s. The waveform coding theory based on information theory is different for a certain bit rate video. The audio encoded MPEG standard is different, and the international standard MPEG-4 announced in November 1998 pays more attention to the interactivity and flexibility of the multimedia system. It introduces Audio / Visual Objects, making more interactions possible. October 1998 International Standardization has launched the MPEG-7 concept, which is expected to be finalized in early 2001 and published, its official name is "MultiMedia Content Description Interface). It proposes a standardized description plan for various multimedia contents in real life to extract aspects of the objects to be described, facilitate people to quickly and effectively retrieve the desired multimedia materials.

---- 3. VB development MPEG - Audio / Video data stream playback technology

---- 3.1. MultiMedia MCI control, MediaPlayer control to play the shortcomings of MPEG data streams

---- Multimedia controls in VB are MultiMedia MCI controls, which manage the record and playback of multimedia files on the media control interface (MCI) device. It is used to issue an MCI command to devices such as sound cards, MIDI sequence generators, CD-ROM drives, video CD players, and video tape recorders and players, and also support playback of Windows (* .avi) video files. The MULTIMEDIA MCI control is used to play the acquired MPEG data stream. The playback speed is displayed fast than real-time display. When the MPEG file length is found to be shortened to 500k-600K, it will not be seen. The shortcomings of the MEDIAPLAYER control in VB still exist. The cause of the analysis is that because the MPEG file is too short, the playback device has just turned off, which is programming that cannot be controlled. Moreover, for some of the information on the compressed data stream, some of the functions of the compressed data stream, such as the scaling display, the beauty of the interface, the beauty of the interface, the appearance of the interfacia, and the appearance of the upper story control. The high-level interface used by the developers is not applicable. To achieve some operations on the underlying, it is difficult to know on this basis. When solving the actual problem problem, we call the dynamic link library quatrz.dll. ---- 3.2. Provide a dynamic link library of the underlying operation and high-level interface for MPEG streams, QUATRZ.DLL

---- You can find a dynamic link library quatrz.dll under Windows / System, which is a type library for controlling the playback of moving images in Windows, as long as it adds it in the "reference" menu of VB. You can use it. This library defines iBasicaudio, IBASICVIDEO, and IBASICVIDEO2, IMEDIAEVENT, IMEDIAEVENTEX, IMEDIAEVENT, etc., which can easily add code settings and read AUDIO-related values, setting or read VIDEO input and output sources. Related parameters, calls no access events, PAUSE, STOP, etc., and use the IMEDIAPSITION class to operate the specific playback details. The output display of the compressed MPEG data is not required, in VisualBasic, you can select a form as a container or a PictureBox control as a container. For the beauty of the interface and the user's convenience of the information, we use the PictureBox control as the MPEG data stream that is displayed as a container.

---- 3.3. Display MPEG data stream with the PictureBox control

---- The PictureBox control from Visual Basic can display graphics from bitmaps, icons, or metafiles, and from enhanced meta files, JPEG, or GIF files. Graphical properties and methods can also be operated in your code to create an animation or simulation. Place a PictureBox control Pictv on the form, on the basis of calling the Windows / System Dynamic Link Library Quatrz.dll, define a global Object object PMC, let PMC point to a new instance of FilgraphManager, open the MPEG played File; then define a new instance of the local object PVW for iVideoWindow, open a window of playing video; let PVW = PMC, assign the PVW assignment to the object, assign the PICTV's properties value hwnd to the Owner of PVW, so PICTV can display the reception MPEG data flow. The specific operation is as follows:

Set PMC = New FilgraphManager

Pmc.renderfile "c: /bank/montior/example.mpg"

Set pvw = pmcpvw.windowstyle = ClNG (& H6000000)

pvw.left = 0

Pvw.top = 0

Oldwidth = pvw.width

Oldheight = pvw.Height

Pictv.width = pvw.width * 15

Pictv.height = pvw.Height * 15

pvw.owner = pictv.hwnd

---- You can individually define a function including these code, or place it in the Click event of the CommandButton control.

---- 3.4. Scaling display of MPEG data stream

---- Enlarged or narrow the MPEG image is a means of image display processing commonly used in various multimedia playback software. VisualBasic is scaled for the static picture to use the Image control, set the STRETCH attribute of the control to True, and the loaded picture will change the scale to accommodate the range of the Image control, so the zoom processing of the image becomes the Height of the image control. The size of the width property value is changed. Since the size of the control changes, the display points cannot be changed, resulting in the pixel point and the picture of the display point, and the display quality is obvious. Only the image control can be scaled to the picture. If the PictureBox control is not enough to display an entire image, the crop image is made to accommodate the size of the control. To implement the scaling of the output MPEG image with the PictureBox control, you must change the output ratio of the MPEG data stream, and adjust the size of the PictureBox control to adapt to the output MPEG image. In fact, in the third section above, it has been done in order to display the output MPEG image. It is not only to read the MPEG image OldWidth, Oldheight, which gives an example of outputting an MPEG image with the original 1/2 size.

Pvw.width = Oldwidth / 2

Pvw.height = Oldheight / 2

Pictv.Left = 135

Pictv.top = 135

Pictv.width = pvw.width * 15

Pictv.height = pvw.Height * 15

pvw.owner = pictv.hwnd

---- Be careful when magnifying or shrinking the size of the MPEG image is consistent, so as to avoid the output of the image.

---- 3.5. Mouse dragging play MPEG data stream

---- Drag the scroll bar with the mouse to play the MPEG data stream is a common technology for multimedia player playing VCD in Windows. The SLIDER control in VB is a window including the slider and the selective scale, which can be dragged with the slider, and use the mouse to move the slider using the keyboard. The Slider control is useful when selecting a discrete value or a set of continuous values ​​within a range. By moving the slider to the scale mark, the MPEG data stream can be positioned. Place a slider control SLIDER 1 on the form, setting the maximum step size of the cursor movement LargeChange = 5, the minimum step size smallchange = 1, the maximum mobile range max = 50, the implementation program is as follows:

Private sub slider1_scroll ()

'

DIM PMP as ImediaPosition

DIM V As Double

IF not Bopen thr

BSeeking = TRUE

PMC.Pause

SET PMP = PMC

v = slider1.value - Slider1.min

v = v / slider1.max * pmp.durationpmp.currentPosition = v

Set PMP = Nothing

PMC.Run

'

End Sub

---- 3.6. MPEG data stream acquisition time

---- VisualBasic provides a function FileDateTime available to get file establish or update date and time. Define a local object PMP new instance of iMediaPosition, order PMP = PMC, to reference PMP assignment; then define two Double type variables CURPOS, Length, assign PMP.CurrentPosition to CURPOS, get the current relative position of MPEG data stream Time, PMP. Duration is assigned to Length, and the time length value of the MPEG data stream is obtained; the acquisition time of the MPEG data stream can be obtained. The acquisition time of the MPEG data stream can be obtained according to the characteristics established by the MPEG acquisition file.

---- During the playback of the entire MPEG, you are required to display the acquisition time of the MPEG data stream in real time, which can define a function that gets the acquisition time, and uses the TIMER event of the Timer control to drive. By triggering TIMER events, the Timer control can perform a function to get a function to acquire a function of the MPEG data stream over a period of time.

---- 4. Conclude

---- It is of great significance to use mature image compression technology for television monitoring monitoring. For example: In the bank's monitoring monitoring system, due to the particularity of the customer (bank) identity, the collected compression is in the investigation of the normal working order of the bank's deposit, bank stolen or robbery. Data flow is very important to handle clues and evidence. In this system, not only requires clear monitoring screens, low data redundancy, and MPEG data stream play technology is also important. This article describes the play technology of AUDIO / VIDEO data to develop MPEG cards with VisualBasic itself and the original controls in a Windows environment. Make full use of the superior conditions of VB, flexibly combined with various existing controls in VB, the development of MPEG media player is perfect, playback MPEG screen can clearly reproduce the data collection time, and do its voice , See own people, and accurately determine the time moment of incident. The AUDIO / VIDEO data stream that only records a single frame can also be played. The above technique has been used in the monitoring system and has good effect.

转载请注明原文地址:https://www.9cbs.com/read-443.html

New Post(0)