2013-02-11 2 views
3

Мне нужно повернуть рабочий стол моего Mac и сделать так, чтобы другие люди смотрели, что я делаю. Я пробовал использовать VLC (который больше не работает в текущей стабильной версии). Я пробовал ffmpeg, который больше не работает с опцией x11grab в osx. Знаете ли вы какое-либо программное обеспечение, коммерческое или бесплатное, с функцией записи и потоковой передачи экрана? Или, альтернативно, что-то, что можно передать в ffmpeg или vlc? Или, может быть, вы можете указать мне где-нибудь, чтобы изучить, как создать очень простое приложение для osx, которое захватывает экран? ThanksЗахват экрана на osx

+0

Вы прочитали это [Capture Screen Image в C++ на OSX] [1]? Много ссылок, особенно последний. [1]: http://stackoverflow.com/questions/1537587/capture-screen-image-in-c-on-osx –

+0

Я запрограммировал этот код C для захвата экрана Маков и показать он в окне OpenGL через функцию glDrawPixels: opengl-capture.c http://pastebin.com/pMH2rDNH –

ответ

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

Перейди через URL. Это может помочь вам при создании базового приложения, которое захватывает ваш экран.

Смежные вопросы