AVCaptureSession specify resolution and quality of captured images obj-c iphone app

社会主义新天地 提交于 2019-11-27 20:14:54

Refer to Apple's guide Capturing Still Images section regarding which sizes you'll get if you set one or another preset.

The parameter you should change is captureSession.sessionPreset

Try to go with something like this where cx and cy are your custom resolutions:

NSDictionary *videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                              AVVideoScalingModeResizeAspectFill,AVVideoScalingModeKey,
                           AVVideoCodecH264, AVVideoCodecKey,
                           [NSNumber numberWithInt:cx], AVVideoWidthKey,
                           [NSNumber numberWithInt:cx], AVVideoHeightKey,
                           nil];
_videoInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!