我需要流式传输我Mac的桌面,让其他人能够观看我正在做什么。我尝试过使用VLC(在当前稳定版本中不再起作用)。我尝试过使用ffmpeg,在osx上不再支持x11grab选项。您知道有没有商业或免费的软件可以录屏和流媒体?或者是一些可以通过管道传输到ffmpeg或vlc的东西?或者你能否指导我学习如何构建一个非常基本的用于捕获屏幕的osx应用程序? 谢谢
我需要流式传输我Mac的桌面,让其他人能够观看我正在做什么。我尝试过使用VLC(在当前稳定版本中不再起作用)。我尝试过使用ffmpeg,在osx上不再支持x11grab选项。您知道有没有商业或免费的软件可以录屏和流媒体?或者是一些可以通过管道传输到ffmpeg或vlc的东西?或者你能否指导我学习如何构建一个非常基本的用于捕获屏幕的osx应用程序? 谢谢
/**
Record the current screen to the destination path mentioned.
**/
-(void)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找到示例代码。
请查看该网址。这可能会帮助您至少创建一个捕获屏幕的基本应用程序。