Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How might one develop a program like FRAPS?

Tags:

c++

I would like to make a program to capture video.

  • What is the best way to capture video?
  • I know C++ and I'm learning assembly. I found in my assembly book that I can get data from the video card. Would that be the best way?
  • I know FRAPS hooks into programs, but I would like my program to take video of the entire screen.

I would like something something fast, with low memory usage if possible. A requirement is that the program must be usable on other computers, despite dissimilar hardware.

like image 631
blood Avatar asked Apr 20 '10 04:04

blood


2 Answers

The way Fraps works, it's impossible to capture the entire screen (unless you're running a full-screen DirectX application, of course). You're apparently trying to emulate the functionality of CamStudio, more so than Fraps.

CamStudio is open-source (here is the SorceForge page) so perhaps you could start by studying the source code? I would wager that it's not really for beginners, however.

like image 172
Dean Harding Avatar answered Oct 31 '22 13:10

Dean Harding


Capturing an entire screen is simple, in short you get a desktop handle (GetWindowHandle(0)) and BitBlt() it to your bitmap.

Now you need to encode it to video, potentially full HD or more, in real time, using the best possible compression, ideally lossless because of text on the screen and vector graphics nature of traditional desktops. I don't know any good custom codec for such requirements so would recommend to use traditional h.264 and tune tradeoff between quality and performance. FFMPEG is probably the most popular library for this, just check license of h.264 encoding.

like image 2
Andriy Tylychko Avatar answered Oct 31 '22 13:10

Andriy Tylychko