2017-04-11 7 views
1

현재 개발중인이 카메라 응용 프로그램을 가지고 있습니다. 어떤 점에서 나는 비디오에 쓰기를 시도하고, 그래서 나는 assetWriter을 만드는 오전과 나는이 라인을 가지고 :720p @ 60fps에서 AVAssetWriter 출력 설정이 잘못되었습니다.

CGFloat videoFrameWidth = size.width; 
    CGFloat videoFrameHeight = size.height; 

    NSUInteger numPixels = videoFrameWidth * videoFrameHeight; 
    NSUInteger bitsPerSecond; 

    NSUInteger bitsPerPixel = 11.4; // This bitrate matches the quality produced by AVCaptureSessionPresetHigh... this was copied from a code from Apple 

    bitsPerSecond = numPixels * bitsPerPixel; 

    NSDictionary *videoCompressionSettings = @{AVVideoCodecKey     : AVVideoCodecH264, 
              AVVideoWidthKey     : @(videoFrameWidth), 
              AVVideoHeightKey     : @(videoFrameHeight), 
              AVVideoCompressionPropertiesKey : @{ AVVideoAverageBitRateKey  : @(bitsPerSecond), 
                        AVVideoMaxKeyFrameIntervalKey : @(fps)} 
              }; 

    if ([_assetWriter canApplyOutputSettings:videoCompressionSettings forMediaType:AVMediaTypeVideo]) 

나는이 방법이 완벽하게 작동 1080p의 30 @ fps로 기록하고있다하지만 난에 720p로 전환하면 @ 이 마지막 줄은 60fps 실패합니다.

+0

'AVVideoMaxKeyFrameIntervalKey' 키를 제거하면 어떻게됩니까? 60 프레임마다 1 개의 키 프레임을 말하는 것 같습니다. –

+0

당신이 말하는 것을 이해하는 것은 ... 나는 그것을 시도하고 여기로 돌아갈 것입니다. 이 모든 것들은 당신이 결코 알지 못하는 아주 가난한 문서입니다. 나는 애플이 사탄을 불에 태워 버렸으면 좋겠다. 오늘은 도구와 문서를 개발하는 책임이있다. – SpaceDog

+0

그 키를 제거하면 트릭을 만들었지 만, 비디오는 만들어 지지만 항상 60 fps로 찍어도 30 fps로 생성된다. – SpaceDog

답변

1

AVVideoMaxKeyFrameIntervalKey 키를 제거하면 어떻게됩니까? 60 프레임마다 1 개의 키 프레임을 말하는 것 같습니다.