[TECH] Efficient screen recording

xiaoxiao2021-03-06  122

Http://blog.joycode.com/jiangsheng/archive/2004/01/10410.aspx

Efficient screen recording

The screen record has a wide range of purposes, mainly to establish demosted training, or remote screen monitoring and broadcasting. Since the size and color depth of the screen are typically high, and there is a characteristic such as a bulk background color, the window drag / roll caused by the content movement of the window and the menu pop-up, there is a need for data acquisition, compression, and transmission / storage. More considerations.

Before recording

Before recording, you should choose a recording method, compression method, and recording range.

It is necessary to reduce the recorded area to reduce the amount of data. Before the recording begins, you can specify the range of records, such as full screen, specify the window, specified / adaptive coordinates, and the like. Small recording area means less raw data.

Minimize recorded color depth to reduce the amount of data. Typically, recording for simple teaching requires only 256 colors.

Before recording, some features of screen protection, tablecloths, and active desktops should be disabled to avoid unnecessary recording.

Recording method

The recording is two ways, one is a push mode, that is, the recording module constantly recording data, one is the pull mode, the recording module records data when needed. For low bandwidth, the pull mode can effectively reduce the amount of raw data. For occasions that need to be substantially non-destructive playback, the push mode records data when monitoring the screen changes, and reduces the loss of video quality. In the push mode, you need to select a recorded timing to avoid a lot of duplicate data.

Compression coding

Suitable coding methods can effectively reduce resource occupation at the time of recording.

Joint Photographic Experts Group, JPEG encodes a comparative compression ratio for static images when it is damaged compression. However, lossless compression may make the text on the screen blur. Motion Image Expert (MPEG) group Code is suitable for motion-moving images, but a dramatic change image, such as a pop-up of a menu, may temporarily reduce the video quality of recorded video, and an increase in CPU resource. Remote frame buffer, RFB encoding includes rectangular replication caused by the content movement caused by window drag / rollup and background color. For each rectangle, there are various different coding methods, such as MPEG or JPEG. The block comparison encoding compares each recording screen block and the last recorded screen content, if a block is changed, then encodes the entire block. For each block, there can be a variety of different coding methods, such as MPEG or JPEG.

Depending on the recorded content, the above coding mode may have each other.

Extra consideration

Scan line interlaced instead of progressive scan screen data can effectively reduce recorded data, and recorded video quality is not large. Recording the timing virtual display device or the appropriate system hook allows you to get notified when the screen changes or is about to change, so that the number of recording can be reduced as much as possible. See http://ultravnc.sourceforge.net and the VNC source code provided by http://www.realvnc.com. DirectX uses DirectX to perform direct memory access, which is very beneficial to improve performance. However, due to DirectX features, some techniques such as DirectX may not be recorded, such as most games and media players. The method of solving is partial or globally disabled or all DirectX acceleration functions. The machine code can effectively enhance the performance of the program using the machine code module during recording and encoding. Many core modules, such as XVID are machine code. The block size of the block means that the number of times recorded during recording, but small blocks may mean less data. For coding methods depend on background colors, the block size also affects the amount of data.

Other recording content mouse, watermark and other images

While recording images, other images may be superimposed on the screen content, such as mouse or water printing. This can be done by superimposing the designated image on the specified position on each recording image.

// DRAW THE CURSOR IF (g_recordcursor == 1) {iconInfo iconInfo; Bool Ret; Ret; Ret; GeticonInfo (HCur, & iconInfo); if (re) {xpoint.x - = iconinfo.xhotspot; xpoint.y - = iconinfo.yhotspot ; // need to delete the hbmMask and hbmColor bitmaps // otherwise the program will crash after a while after running out of resource if (iconinfo.hbmMask) DeleteObject (iconinfo.hbmMask); if (iconinfo.hbmColor) DeleteObject (iconinfo.hbmColor } :: Drawicon (HMEMDC, XPoint.x, Xpoint.y, HCur);

Here HMEMDC contains recorded screen content, HCur indicates the current cache cursor (because the cursor is not changed each time, the cache is highly efficient).

Audio

In order to enrich the media content, it may be necessary to record audio while recording the screen. When the screen recorded a large amount of resources, it is possible to cause audio recording and compression slower than the expected frequency, and the result is a recorded media tone decrease, and possible synchronization issues.

encryption

If the recorded content needs to be confidential, you must consider implementing the performance and feasibility of encryption. In general, a different key is generated for each session to perform preliminary encryption.

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

New Post(0)