mdominick
mdominick

Reputation: 1319

Directly Record Screen on Mac

OK so I want to record the screen of a Mac directly to a .mov or .m4v. I've taken a look at Son of Grab from Apple, but I would prefer not to deal with screenshots and individual images and just work with video.

I thought there should be something in QTKit but I can't find it. I know this can be done in OpenGL, but 1) I don't know how and 2) I'd like to avoid that if possible.

Just to elaborate, I am recording from iSight using QTCaptureDeviceInput and (obviously a QTDevice) because I need to solution to work on Snow Leopard.

It seems like there should be a way to just target the screen as the input device for QTMediaTypeVideo.

Any help would be greatly appreciated.

Upvotes: 3

Views: 886

Answers (3)

Andrew Norris
Andrew Norris

Reputation: 49

I have found that when faced with the question, will it be fast enough or not, just give it a try. Do a quick test by gabbing frame after frame say 1000 times and time it. CGDisplayCreateImageFromRect is not that hard to call at all. I have called it for single screen shots of the whole screen when the mouse was clicked, and it hardly slowed my mac down (only a basic dual core machine).

Apple has two samples showing the main two ways this can be done: :-

ScreenSnapshot SonOfGrab

It would be easy to modify these to do it say 1000 times in a loop!

Upvotes: 1

hamstergene
hamstergene

Reputation: 24429

You can use CGDisplayCreateImage/CGDisplayCreateImageFromRect APIs (10.6+) to obtain still images of screen and then making a movie out of them.

I'm not sure how good will be the performance though.

Upvotes: 1

Randall
Randall

Reputation: 14839

You can use AVFoundation to do screen recording on the Mac. It's only available on 10.7 though.

Upvotes: 3

Related Questions