0

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.

enter image description here

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 };
Zigglzworth
  • 6,645
  • 9
  • 68
  • 107
  • 2
    possible duplicate of [AVAssetExportSession giving me a green border on right and bottom of output video](http://stackoverflow.com/questions/22883525/avassetexportsession-giving-me-a-green-border-on-right-and-bottom-of-output-vide) – Lyndsey Scott Feb 15 '15 at 17:57
  • Because the iPhone 6's resolution isn't a multiple of 16. – OrangeDog Nov 10 '15 at 15:39
  • @EICaptain see the duplicate question. – OrangeDog Apr 26 '16 at 10:13

0 Answers0