2015-01-21 84 views
0

我想製作一個自定義錄像機的iPhone應用程序,我需要支持240 fps。但是,當我將AVCaptureDevice設置爲使用格式和activeVideoMaxFrameDuration時,整個視頻視圖就會被凍結。如果我使用60fps,120fps,一切正常,沒有任何問題。iOS慢動作記錄

對於輸出部分,我正在使用AVCaptureMovieFileOutput,並且我還設置了曝光自動對焦模式,如果這很重要的話。

[self.videoConnection setPreferredVideoStabilizationMode:AVCaptureVideoStabilizationModeOff]; 

if ([self.videoDevice isExposureModeSupported:AVCaptureExposureModeAutoExpose] && 
    [self.videoDevice lockForConfiguration:&error]) { 

    [self.videoDevice setExposureMode:AVCaptureExposureModeContinuousAutoExposure]; 

    [self.videoDevice unlockForConfiguration]; 
} 

if ([self.videoDevice isFocusModeSupported:AVCaptureFocusModeAutoFocus] && 
    [self.videoDevice lockForConfiguration:&error]) { 

    [self.videoDevice setFocusMode:AVCaptureFocusModeContinuousAutoFocus]; 

    [self.videoDevice unlockForConfiguration]; 

} 

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 

    [self tapInView:nil]; 

}); 

回答

0

該解決方案與自動對焦和曝光有關。當設備的相機處於120/240fps模式時​​,我們需要禁用手動對焦和曝光,但仍然保留自動對焦和自動曝光。這將防止任何相機凍結