0

On iOS, I would like to :

  • record on disk in slow motion (240 fps) the stream from the back camera
  • get the stabilized frames at 30 fps from the back camera

I manage to do one or the other but I don't know how to set up AVCaptureSession, AVCaptureDeviceInput, ... to have two inputs.

I thought at the beginning one input would be enough but AVCaptureVideoStabilizationModeCinematic doesn't exist for 240 fps

Thanks

Note: it is different from: Run multiple AVCaptureSessions or add multiple inputs where the author asks to run 2 cameras at the same time, and one answer is for OSX (not working on iOS)

EDIT: part of the code

I kind of know this is not going to work as the UIDevice is the same and can't have two properties, but since AV has some state machine properties I thought I would give it a go.

_inputCameraStabilized = [self getCameraForPosition:AVCaptureDevicePositionBack];
_videoInputStabilized = [AVCaptureDeviceInput deviceInputWithDevice:_inputCameraStabilized error:&error];
if ([_captureSession canAddInput:_videoInputStabilized]) {
    [_captureSession addInput:_videoInputStabilized];
}
[self setZoomAndRate:_inputCameraStabilized];

_inputCameraHighFPS = [self getCameraForPosition:AVCaptureDevicePositionBack];
[self setZoomAndRateHighFPS:   _inputCameraHighFPS];
_videoInputHighFPS = [AVCaptureDeviceInput deviceInputWithDevice:_inputCameraHighFPS error:&error];
if ([_captureSession canAddInput:_videoInputHighFPS]) {
    [_captureSession addInput:_videoInputHighFPS];
}

// setZoomAndRate... finds and sets the right active format for 240fps or 30fps
Community
  • 1
  • 1
Thomas
  • 8,306
  • 8
  • 53
  • 92

0 Answers0