I am using AVCaptureSession to record video with AVAssetWriter to a file and everything is working fine except that for some reason the video has green edges on the right and bottom. How do I get rid of them?
UPDATE This is happening on iPhone 6 but NOT iphone 5s. I haven't tried on other devices yet.
Here are the settings I use :
//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 };