4

I'm trying to make an android app that preview a stream from an external USB camera. I can see the camera using UsbManager but for some reason, the CameraX doesn't list it in the connected camera list. Does anyone have an idea how to fix this?

Also, I've downloaded for my android device some random app that allows streaming from a USB camera and it worked so I don't think it is a problem that the camera isn't compatible to work with an android device or something like that.

IdH
  • 41
  • 4
  • can you post camera model and tested Android OS version? have you tried on newest 13? – snachmsm Jan 19 '23 at 09:13
  • @snachmsm Yes I tried using 2 different cameras their models are: Flir 3.5 thermal camera UVC and the other is Arducam 8MP IMX219 USB2.0 Camera and I'm mainly working on a device that has android version 12 but I also tried on one that has version 13 but it was the same – IdH Jan 19 '23 at 10:03

1 Answers1

4

afaik CameraX doesn't support UVC cameras yet/still and Android doesn't provide a driver... for Android system UVC camera is just "some USB" device (as you noticed - handled by UsbManager) and you need to provide a driver by self...

so you can use some other libraries for getting UVC video, probably currently best is AndroidUSBCamera by jiangdongguo

snachmsm
  • 17,866
  • 3
  • 32
  • 74
  • 1
    there is now an explicit declaration that CameraX supports UVC cameras but from the External cameras documentation it is implied that camera2 supports UVC cameras so I'm really hoping that cameraX does too. you can see the documentation here: https://source.android.com/docs/core/camera/external-usb-cameras – IdH Jan 19 '23 at 12:13
  • 1
    The reason I'm assuming this is because CameraX is built upon camera2 – IdH Jan 19 '23 at 12:14
  • 2
    I would be very glad if this would work in practise... theoretically it should, as you linked an instruction for manufacturer how to set up Android OS image. but if it isn't done it won't work and cam won't be "recognizeable" by system, thus by Camera2/CameraX. and from my tests, few very different devices, few different UVC cams - it never worked. I've ended up with 3rd-party lib (not linked above but planning migration), which ensures that my APK always contain driver and no matter of OS configuration it will work (well, when OTG works and gives proper power supply level) – snachmsm Jan 19 '23 at 12:37
  • can I ask which 3rd party lib are you using? I haven't found one that works (the one you listed above gives me errors when I'm importing it) – IdH Jan 19 '23 at 15:35
  • 2
    I've used [UVCCamera](https://github.com/saki4510t/UVCCamera), which is base of linked one in answer (mentioned in "Thanks" section). this repo isn't maintained and have some problems when importing app is targetting smth about 28-29+... And we have currently 33... so you can't publish such app in Google Play and some OS versions are showing "warings" when installing from apk. I've already implemented this new one just for preview(s) without problems (but this was just a test, still lot work to do for adjusting to my old code in a place of old lib impl, so TODO) – snachmsm Jan 19 '23 at 20:04