本文介绍了iPhone 4 AVFoundation:从前置和后置摄像头同时捕获的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以同时使用AVFoundation框架从两个摄像头捕获。具体来说,我的问题是前面和后面的AVCaptureDevices是否可以同时是活动的。

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.

目前我知道一个AVCaptureSession实例只能支持一个输入输出)。我创建两个AVCaptureSessions,将前置摄像头设备连接到一个和后端到另一个,然后指向会话的输出到不同的SampleBufferDelegate函数。我看到的是一个代理函数是活动的几帧,然后另一个接管。看起来好像AVFoundation不知何故关闭了相机设备,如果另一个正在使用。

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?

提前感谢

推荐答案

回答自己的问题:


  1. 这是不可能的。

  2. 前后相机模拟类似的行为太慢
    (根据我的测试,每个开关需要大约500ms)

源:

这篇关于iPhone 4 AVFoundation:从前置和后置摄像头同时捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 06:05