Android as an UVC Camera
Asked Answered
C

4

21

I'm stuck at home with a rather bad webcam. I was considering upgrading, but then it struck me: phones these days have really good cameras embedded in them. So why not use it as a webcam?

However, as I was researching this further I was really disappointed with the available apps for this. As far as I was able to find, we have Android apps that work roughly as follows:

  • Present phone camera as a network attached camera. Then you can use local software to use that feed as a webcam. See e.g., IP Webcam. This may be sufficient, but it's a complicated setup, and network latency makes this far from ideal.

  • The Android app sends the camera feed to an custom host application that in turn creates a virtual web camera. See e.g., DroidCam. This mostly solves the latency problem, but it is still rather complicated, and requiring us to install a specific third party application is troublesome in regard to user privacy. Especially since the applications are closed source.

So, I took the engineering approach and tried to see if it was even possible to improve the situation. As far as I was able to find, Android supports being used as a custom USB accessory. And looking over the USB video class documentation, it strikes me that it should be possible to create an Android app that presents the phone as a generic UVC webcam, such that we do not have to resort to tricks such as the ones above.

Ideally, I would have liked Android to add another USB device option ("Use USB connection as webcam") in addition to debug mode, file-transfer, etc. This seems quite unlikely to happen in the short term however.

So, my question is this: Does an application that does the above already exist? My searching thus far haven't yielded any results, but I might be missing something as googling for this turned out a bit harder than I expected.

Alternatively, am I wrong in my assumption above, such that there is some fundamental issue why an Android application cannot be made to work in that way?

Castrate answered 11/5, 2020 at 13:22 Comment(4)
Have similar needs, use mic/speaker in phone as the virtual mic/speaker in pc. It may not be able to avoid installing a third party virtual driver and a software.Woollen
Oh yes, I want this. Install an app on an old Android phone, don't mind rooting it for that purpose or even installing a custom Linux "firmware" instead of the stock Android. Main point is that the computer would see this as a regular UVC camera and UAC microphone so that it works without installing drivers. Input lag should be fairly low to be usable as a webcam.Credulity
There is no such app likely because this is an OS level feature, instead of app level feature, which means it needs root access to control USB. Apps don't have this privilegeNoteworthy
Here someone describes how they integrated this feature into their Android ROM: pathpartnertech.com/…Primus
B
6

There does not seem to be any complete app yet as of 2020-10, but the parts are mostly there:

Sources:

Bolick answered 11/10, 2020 at 7:12 Comment(0)
C
3

It appears Google has started to take notice on this issue and are currently working on a "DeviceAsWebcam" service, which is exactly the solution to this problem, as seen in the Android review below:

https://android-review.googlesource.com/c/platform/system/sepolicy/+/2410788

Naturally though, this is a Android 14 feature, so it will like take a while before this is usable on a lot of devices. Hopefully, someone is able to backport this feature to older versions of Android.

Castrate answered 18/2, 2023 at 18:10 Comment(0)
B
0

Android 14 will support this natively: https://www.esper.io/blog/android-14-adds-support-for-using-your-smartphone-as-a-webcam

Bolick answered 22/9, 2023 at 6:12 Comment(0)
M
-1

If android / the version of Android that comes on your target phone provides / permits use of the USB gadget driver, then libguvc,

https://developer.ridgerun.com/wiki/index.php?title=USB_Video_Class_Gadget_Library_-_libguvc

can be used to "make an application appear as a USB webcam".

Potentially relevant to get you started would be https://stackoverflow.com/search?q=Android+USB+gadget (other SO references to the use of the USB gadget driver on Android).

Macrophage answered 17/6, 2020 at 14:39 Comment(1)
This doesn't answer any of the questions above and is more appropriate as a comment. Also, libguvc is a proprietary library costing 2500 USD and only works for a very limited selection of SoCs, making it essentially impossible to try out.Castrate

© 2022 - 2024 — McMap. All rights reserved.