我正在使用AVCaptureSession将带有AVAssetWriter的视频录制到文件中,一切正常,但由于某种原因,视频的右侧和底部都有绿色边缘。我如何摆脱它们?
更新这在iPhone 6上发生,但不是iphone 5s。我还没有在其他设备上试过。
以下是我使用的设置:
//Video output settings for
NSDictionary *outputSettings = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kCVPixelFormatType_32BGRA],kCVPixelBufferPixelFormatTypeKey,
[NSNumber numberWithInt:videoWidth], AVVideoWidthKey,
[NSNumber numberWithInt:videoHeight], AVVideoHeightKey, nil];
//AssetWriter settings
NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:videoWidth], AVVideoCleanApertureWidthKey,
[NSNumber numberWithInt:videoHeight], AVVideoCleanApertureHeightKey,
[NSNumber numberWithInt:10], AVVideoCleanApertureHorizontalOffsetKey,
[NSNumber numberWithInt:10], AVVideoCleanApertureVerticalOffsetKey,
nil];
CGFloat videoBitRate = 960*1000;
NSInteger videoFrameRate = 30;
NSDictionary *compressionSettings = @{ AVVideoAverageBitRateKey : @(videoBitRate),
AVVideoMaxKeyFrameIntervalKey : @(videoFrameRate),
AVVideoCleanApertureKey : videoCleanApertureSettings };
NSDictionary *videoSettings = @{ AVVideoCodecKey : AVVideoCodecH264,
AVVideoScalingModeKey : AVVideoScalingModeResizeAspectFill,
AVVideoWidthKey : @(videoWidth),
AVVideoHeightKey : @(videoHeight),
AVVideoCompressionPropertiesKey : compressionSettings };