Compressed data stream playback technology in VB environment (1)

zhaozj2021-02-08  251

1. introduction

The 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 comparable technologies 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: 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 developed in 1993 (ISO / IEC 11172), which is a digital storage medium and its audio code for digital storage medium for 1.5 Mbit / s. 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 records 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

Under Windows / System, you can find a dynamic link library quatrz.dll, 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. 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 the 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 = PMC

Pvw.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

A function can be individually defined including these code, or put it in the Click event of the CommandButton control.

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

New Post(0)