2013-02-11 136 views
3

我需要流式传输我的Mac桌面,让其他人观看我正在做的事情。我试过使用VLC(它不再适用于当前的稳定版本)。我试过fxmpeg,它不再适用于osx上的x11grab选项。你知道任何商业或免费的软件,具有屏幕录制和流媒体功能吗?或者,也可以通过管道连接到ffmpeg或vlc?或者,也许你可以指点我学习如何构建一个捕捉屏幕的OSX非常基本的应用程序? 谢谢osx上的屏幕截图

+0

您是否阅读过[OSX上的C++捕获屏幕图像] [1]?很多链接,特别是最后一个。 [1]:http://stackoverflow.com/questions/1537587/capture-screen-image-in-c-on-osx – 2013-02-13 09:30:37

+0

我编程该C代码来捕捉的Mac的画面,并显示出它在OpenGL窗口中通过函数glDrawPixels: opengl-capture.c http://pastebin.com/pMH2rDNH – 2013-07-06 10:08:50

回答

0

这是一个示例代码捕获屏幕并将其保存为一个为我工作的文件。

/** 将当前屏幕记录到上述目标路径。 **/

- (空)screenRecording:(NSURL *)destPath {

//Create capture session 
mSession = [[AVCaptureSession alloc] init]; 

//Set session preset 
//mSession.sessionPreset = AVCaptureSessionPresetMedium; 
mSession.sessionPreset = AVCaptureSessionPreset1280x720; 

//Specify display to be captured 
CGDirectDisplayID displayId = kCGDirectMainDisplay; 

//Create AVCaptureScreenInput with the display id 
AVCaptureScreenInput *input = [[AVCaptureScreenInput alloc] initWithDisplayID:displayId]; 
if(!input) { 
    //if input is null 
    return; 
} 

//if input is not null and can be added to the session 
if([mSession canAddInput:input]) { 
    //Add capture screen input to the session 
    [mSession addInput:input]; 
} 

//Create AVCaptureMovieFileOutput 
mMovieFileOutput = [[AVCaptureMovieFileOutput alloc] init]; 
mMovieFileOutput.delegate = self; 

if([mSession canAddOutput:mMovieFileOutput]) { 
    //If movie file output can be added to session, then add it the session 
    [mSession addOutput:mMovieFileOutput]; 
} 

//Start running the session 
[mSession startRunning]; 

//Check whether the movie file exists already 
if([[NSFileManager defaultManager] fileExistsAtPath:[destPath path]]) { 
    NSError *err; 
    //If the movie file exists already, then delete it 
    if(![[NSFileManager defaultManager] removeItemAtPath:[destPath path] error:&err]) { 
     NSLog(@"Error deleting existing movie file %@", [err localizedDescription]); 
    } 
} 

//Start recording to destination path using the AVCaptureMovieFileOutput 
[mMovieFileOutput startRecordingToOutputFileURL:destPath recordingDelegate:self]; 

}

您可以在http://developer.apple.com/library/mac/#qa/qa1740/_index.html

找到示例代码请通过网址。这可以帮助您至少创建捕获屏幕的基本应用程序。