2010-12-19 5 views
2

iPhone 카메라를 사용하여 비디오를 녹화하는 카메라 응용 프로그램을 작성하고 싶지만 녹화 된 비디오의 프레임 속도를 변경할 수있는 방법을 찾을 수 없습니다. 예를 들어 기본 30 대신 초당 25 프레임으로 녹화하고 싶습니다.iPhone에 비디오를 녹화 할 때 어떻게 프레임 속도를 설정합니까?

이 프레임 속도는 어떤 방식 으로든 설정할 수 있습니까?

답변

0

내가 알 수있는 한, 녹음을 위해 FPS를 설정할 수 없습니다. AVFoundation에 대한 WWDC 2010 비디오를보십시오. 내가 알 수있는 한, 프레임 데이터를 캡처하는 것만 가능하다는 것을 다시 한 번 제시 할 수 있습니다.

나는 틀린 것을 입증하고 싶지만, 그럴 수 없다고 확신합니다. 죄송합니다!

+0

여기가 europa에 있습니다. 우리는 30fps로 녹음하고 싶지 않으므로 25로 변경하고 싶습니다. (블리핑 사과 – Tammo

+0

녹음을 위해 FPS를 확실히 바꿀 수 있습니다. 아래 코드를 참조하십시오. – Praxiteles

+0

https://github.com/shu223/SlowMotionVideoRecorder –

0

당신은 여기에 코드를 작동하고 여기에

AVCaptureDevice.h

필요합니다

- (void)attemptToConfigureFPS 
{ 

    NSError *error; 
    if (![self lockForConfiguration:&error]) { 
     NSLog(@"Could not lock device %@ for configuration: %@", self, error); 
     return; 
    } 

    AVCaptureDeviceFormat *format = self.activeFormat; 
    double epsilon = 0.00000001; 

    int desiredFrameRate = 30; 

    for (AVFrameRateRange *range in format.videoSupportedFrameRateRanges) { 

     NSLog(@"Pre Minimum frame rate: %f Max = %f", range.minFrameRate, range.maxFrameRate); 


     if (range.minFrameRate <= (desiredFrameRate + epsilon) && 
      range.maxFrameRate >= (desiredFrameRate - epsilon)) { 

      NSLog(@"Setting Frame Rate."); 

      self.activeVideoMaxFrameDuration = (CMTime){ 
       .value = 1, 
       .timescale = desiredFrameRate, 
       .flags = kCMTimeFlags_Valid, 
       .epoch = 0, 
      }; 
      self.activeVideoMinFrameDuration = (CMTime){ 
       .value = 1, 
       .timescale = desiredFrameRate, 
       .flags = kCMTimeFlags_Valid, 
       .epoch = 0, 
      }; 

      // self.activeVideoMinFrameDuration = self.activeVideoMaxFrameDuration; 

      // NSLog(@"Post Minimum frame rate: %f Max = %f", range.minFrameRate, range.maxFrameRate); 

      break; 
     } 
    } 

    [self unlockForConfiguration]; 


    // Audit the changes 
    for (AVFrameRateRange *range in format.videoSupportedFrameRateRanges) { 

     NSLog(@"Post Minimum frame rate: %f Max = %f", range.minFrameRate, range.maxFrameRate); 

    } 



} 
관련 문제