Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone 4 AVFoundation : Capture from front and rear cameras simultaneously

I was wondering if it was possible to capture from both cameras simultaneously using AVFoundation framework. Specifically, my question is whether both front and rear AVCaptureDevices can be active at the same time or not.

Currently I know that an AVCaptureSession instance can support only one input (and output). I create two AVCaptureSessions, attach front camera device to one and rear to other, I then point the outputs of the sessions to different SampleBufferDelegate functions. What I see is that one delegate function is active for a few frames, then the other takes over. It seems as if AVFoundation somehow turns off a camera device if another one is being used. Can anyone confirm this or share their experiences regarding this subject?

Thanks in advance

like image 440
Abai Avatar asked Jan 26 '11 17:01

Abai


People also ask

Can iPhone use front and back camera at the same time?

All you have to do is take help from some third-party apps like the Double Camera app through which you can use both the front and rear cameras of the iPhone at the same time. You can take pictures and shoot videos with both cameras by changing the camera layout.

Does iPhone have dual video recording?

In AVCapture on iOS 13 it is now possible to simultaneously capture photos and video from multiple cameras on iPhone XS, iPhone XS Max, iPhone XR, and the latest iPad Pro.


2 Answers

Answering my own question:

  1. This is not possible.
  2. Switching between front and rear camera to emulate similar behavior is too slow (Takes about 500ms per switch according to my tests)

Source: https://devforums.apple.com/message/369748#369748

like image 114
Abai Avatar answered Oct 16 '22 14:10

Abai


From iOS 13, it's possible. One can now simultaneously record the output from the front and back cameras into a single movie file by using a multi-camera

https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/avmulticampip_capturing_from_multiple_cameras

like image 1
user3686123 Avatar answered Oct 16 '22 15:10

user3686123