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

前端 未结 2 530
广开言路
广开言路 2020-12-05 12:00

Hi I want to setup AV capture session to capture images with specific resolution (and, if possible, with specific quality) using iphone camera. here\'s setuppi

相关标签:
2条回答
  • 2020-12-05 12:21

    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

    0 讨论(0)
  • 2020-12-05 12:32

    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];
    
    0 讨论(0)
提交回复
热议问题