I believe that you can just set the video settings to zero, and AVFoundation will use the most efficient format. For example, instead of executing
NSDictionary *videoSettings = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange] forKey:(id)kCVPixelBufferPixelFormatTypeKey]; videoOutput.videoSettings = videoSettings;
Do it instead
videoOutput.videoSettings = nil;
You can also try not to install it at all. I know that in the past I would just set it to zero if I didn't need to record images in a specific format.
change
To get the AVFoundation format, you decide to use.
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(source); CGColorSpaceRef cref = CVImageBufferGetColorSpace(imageBuffer);
source share