1
我有这个相机应用程序,我正在开发。在某些时候,我试图写的视频,所以我创建一个assetWriter,我有这些行:AVAssetWriter失败输出设置与720p @ 60fps
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])
如果我记录在1080 @ 30 fps的这种方法,完美的作品,但如果切换为720P @这60帧最后一行失败。
如果您移除AVVideoMaxKeyFrameIntervalKey键,会发生什么情况?我想你是说每60帧就有一个关键帧。 –
它是有道理的,你说...我会尝试,并回到这里。所有这些东西都是如此糟糕的文件,你永远不知道。我希望苹果发射撒旦,今天是负责创建他们的开发工具和文档... – SpaceDog
删除该键做了诀窍,但现在的视频创建,但始终在30帧/秒,即使我在60或更高的FPS拍摄.. – SpaceDog