Conjecture on the implementation principle of screen recording software

Source: Internet
Author: User

There are many screen recording software on the Internet. You can record all your operations and save them as SwF or video format, which is very convenient for tutorial production.

It seems that I used wmencoder to implement one last year. However, wmencoder has a serious problem, that is, once the capture starts, double-click the eventBasically, screen recording software cannot be used. Therefore, we often see that screen recording software should not be implemented based on this implementation, but should be more underlying. I had another idea a few days ago.Implement such a software, so go to the InternetI found that I couldn't find the information. So I guess the implementation method.However, I have been busy with another things over the past two days, so this idea has not been implemented yet.

In fact, the implementation method of conjecture is very simple in principle, which is related to the principle of video files. As we all know, video files are played in frames,This is the same as the original film. Here we will not repeat the playing principle of the movie.

The format of a video file is generally a header, followed by a list of frames, and the frame data will be eventually restored to a bitmap, and then copied to the video card . This process is reversible, that is, a bitmap can also be converted into a video format frame (similar to decoder and Encoder) Then we can just cut off the bitmap of the whole screen or a certain area of the screen at an interval (this is much simpler, it is actually (Simple ). Then save the bitmap and its time, so that when you want to convert it to a certain format, you only need to extract The image is constructed into Consecutive Frames in the video file and then some header information is constructed. Of course, if you do not feel the card 20 ms, that is, 0.02 seconds, because the response speed of the human brain is the same. Of course, the actual situation will be less than this number, because the performance and Screenshots and saved time. Of course, in actual processing, you do not need to write a constructor for each format. You only need to implement the simplest one, and then Find the corresponding format conversion DLL from the Internet. As for some screen recording software, a prompt appears at the place where the mouse clicks (for example, a sight You can create a global system hook to record all events and time.

Supplement: After tests, screenshots are somewhat inefficient, but barely tolerable. The speed of accessing images is too slow. Another problem is the cursor problem. The screenshot cursor cannot be displayed.

Therefore, the idea for solving these problems is as follows,

1. the screenshot efficiency problem is that screenshots still need to be captured. After all, the implementation of no screenshots does not exist, but the screenshot method is changed and copied directly from the memory or the memory of the video card, efficiency should not be a problem.

2. Slow storage this is directly stored on the disk and is ignored. It is first cached in the memory to a certain extent and accessed to the disk using another thread for asynchronous compression.

3. The cursor problem records the current cursor position, the cursor type, and other related information during each screenshot (directly copying), converts it to a video frame, and manually draws a cursor at that position.

Supplement: After checking some information, Microsoft provides an AVI Development Kit, such as VFW (vfw32.lib), which can be used to generate an AVI file.

 

Related Article

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.