2

I am attempting to use 2 Surface Holder objects tied to 2 separate SurfaceViews. I am for the one set doing a Camera.Open(0) for the back camera and Camera.Open(1) for the front. I am able to get a perfect preview for whichever I call to open first, but am unable to open both Cameras at the same time, even though I am using separate SurfaceViews and SurfaceHolders for each Camera.

Is it just impossible to do this under Android ? I have seen a couple of post suggesting that it is either not possible, or that it is phone hardware dependent, but no concrete explanations as to why.

Could somebody explain why Android does not appear to support this ? If it is supported, could someone suggest the correct way of opening both Cameras at the same time ?

I have also seen some suggestions that it should be possible to do using OpenCV. If so, could someone please provide a link to an example or similar ?

Thanks and Regards,

Steed.

Steed
  • 287
  • 3
  • 15
  • this is a pretty vague topic, doesn't seem like it is possible, it is manufacturer/device specific with its own custom software. You will have to see whether you could get the manufacturer's API and or code to be able to do this. – Pierre Apr 05 '15 at 13:25
  • I am been looking for same thing. This might be helpful: https://stackoverflow.com/questions/12382322/is-it-possible-to-use-front-and-back-camera-at-same-time-in-android/24238301#24238301 – Waqar Rashid Sep 02 '15 at 19:21

2 Answers2

2

It is possible because I've done it on my Nexus 6, even recording video from both cameras simultaneously when using Camera1 APIs. However, it is very much limited to a few devices.

Any unsupported device should give an error during the 2nd Camera.open() call. It seems each hardware manufacturer provides a different implementation of the Camera APIs. You could pretty easily try/catch the exception if a camera does not allow it.

colintheshots
  • 1,992
  • 19
  • 37
1

This is possible on certain phones and pretty much all newer phones. I have found that devices which use the Snapdragon 801 and higher chipsets support this (OnePlus 1, HTC M8 etc). This was somewhere in 2014.

It all depends on the hardware/manufacturor and you should test this on real devices.

Also be aware that the first Camera API outputs in YUV so you will have to deal with this conversion to another format if you want to use the images/video; you can display it fine on a SurfaceView in realtime but saving to picture/video I suggest you save the YUV and convert later/on a seperate thread although you could save and convert single images in realtime on a seperate thread.

Sorry for the late answer but I hope you or someone else can use this info!

MacD
  • 783
  • 7
  • 23