66

I found out that my Android phone's cam has a higher quality than the one of my PC and I'm wondering if there is a way to use my phone as a webcam for the computer. Is that possible?

USB (preferred), Bluetooth and LAN connections are all suitable as any other solution that doesn't require any expense (otherwise I would just buy a webcam), but I would prefer to use only open source software if possible.

Ntakwetet
  • 1,506

3 Answers3

56

You can use any Android phone as a webcam for your Ubuntu PC by using DroidCam.

  1. First download the DroidCam app on your android device via the Play Store.

  2. Next install adb on your Ubuntu PC:

    sudo apt install adb
    
  3. Follow the instructions to install the DroidCam Linux client.

  4. On your android phone, enable USB debugging (you need to enable developer mode to do this).

  5. Find the drivers for your device:

  6. Plug the device back into computer over USB. If you get a dialog asking Allow USB Debugging, you need to tap OK.

  7. Open DroidCam and select the USB option. On the phone you may get a dialog asking Allow USB Debugging, you need to tap OK. Sometimes you need to open USB Options from the notification area on the device and pick PTP mode for that to show up.

For more information on how to set up DroidCam, click here.


To use your android phone as a microphone, check out WO Mic.

To install the Linux client see this.

You will also need to download the WO Mic app from the PlayStore.

Theoretically you can use both WO Mic and DroidCam in conjunction to turn your Android device into a webcam with a microphone.

ldias
  • 2,055
  • According to their site, this is video only, no mic. Is there a simply way to make the mic work as well ?? – mark May 20 '20 at 19:37
  • @mark See my edited answer – ldias May 20 '20 at 19:54
  • Since posting here earlier I tried giving Droidcam and Iriun both a spin, and both failed because v4l2loopback isn't there yet. I have 18.04.3 with kernel 5.4.6-050406 and that seems to cause the problem as shown here: "FATAL: Module v4l2loopback not found in directory /lib/modules/5.4.6-050406-generic" The directions here are useless for my system: https://www.dev47apps.com/droidcam/linuxx/ It looks like Dev47Apps needs to do some updating...? – mark May 21 '20 at 02:10
  • Have you followed the instruction exactly? (including downloading the zip file, unzipping it, running the install script and checking if the video device is installed lsmod | grep v4l2loopback_dc) Also are you on a 32bit machine? – ldias May 21 '20 at 12:08
  • 2
    Yes, I did - even double-checked them to be sure. The v4l2loopback_dc module is not installed, as I said above. It is a 64 bit system & I did the step for that as well. Isn't the info I posted above about the FATAL error pointing to what I've just said as well ?? Thanks. – mark May 21 '20 at 16:45
  • @Idias After installing adb on my UBUNTU 20.04 64 bit PC, I tried to install droidcam. But it shows as under. anupam@anupam-ubuntu:~$ cd /tmp/ anupam@anupam-ubuntu:/tmp$ wget https://files.dev47apps.net/linux/droidcam_latest.zip --2020-07-05 21:03:30-- https://files.dev47apps.net/linux/droidcam_latest.zip Resolving files.dev47apps.net (files.dev47apps.net)... failed: No address associated with hostname. wget: unable to resolve host address ‘files.dev47apps.net’ Can you help me? – ANUPAM MITRA Jul 05 '20 at 15:59
  • This seems like an error with your DNS settings. what is the output of cat /etc/resolv.conf? Adding nameserver 8.8.8.8 to the first line of the /etc/resolv.conf file might solve your problem. Try that and see the install works. – ldias Jul 06 '20 at 18:35
  • So sad that the author of DroidCam seems unwilling to cooperate to make the Linux client packageable. – Alexey Sep 28 '20 at 04:52
  • @Alexey I agree :( – ldias Sep 28 '20 at 15:49
  • 1
    It worked for me with a newer cellphone. For older phones (such as mine Samsung galaxy S3) which Droidcam is not compatible, there is also a solution with IPcamera, but I have not been able to make it work in Ubuntu 20.04. Here are the details: https://github.com/bluezio/ipwebcam-gst/issues/100 – Yannis Dran Nov 30 '20 at 19:57
  • oh it seems I forgot the sound. Wo Mic doesn't seem to get working even if I get a connecftion status. As an alternative there could be a USB connection but this guy doesn't explain how to make a connection of the Wo Mic through USB. Any ideas? – Yannis Dran Nov 30 '20 at 21:24
  • I forgot to mention that 1st step he says to download the client and change it to be executable, however nothing happens. After a while I get a warning says "Home is ready". – Yannis Dran Nov 30 '20 at 21:32
  • 1
    @YannisDran For an alternative to Wo Mic, perhaps see if https://askubuntu.com/questions/889164/use-phone-as-microphone-in-linux or perhaps https://play.google.com/store/apps/details?id=net.bitplane.android.microphone works – ldias Dec 01 '20 at 01:54
  • Related blog post: https://medium.com/@freeyourdesktopblog/need-a-webcam-in-ubuntu-no-problem-thanks-to-android-5bec45e345cf – jarno Jan 05 '21 at 01:32
  • Droidcam worked for me with ubuntu 16.04, but the video quality is terrible, colour balance is off in all modes and weird gamma/contrast effect like VHS almost. If I use e.g. IP Webcam the image is crisp and the white balance is pretty good. I don't see anything in either the android app or the linux droidcam client that can help. – NeilenMarais Mar 15 '21 at 16:25
  • @NeilenMarais Huh. Maybe upgrade to 18.04 or 20.04 might do something? (you probably should do that anyway as 16.04 hits it's end of life soon – ldias Mar 16 '21 at 17:20
  • 1
    To fix the "quality" problem I installed the latest OBS (26.1.2) using snap since it includes a virtual camera feature by default, used IP Webcam on my phone and added that as an OBS camera source. Another advantage of this approach is that I can custom-crop my webcam view in OBS :) – NeilenMarais Mar 17 '21 at 13:20
  • Apparently the Droidcam Android app isn't libre/open source. It was a preference in the question, so not a deal breaker but it's worth noting. – tuxayo Sep 13 '22 at 10:09
  • Thanks! Note that I did not need to "find the drivers for" my device. In Ubuntu I did sudo apt install android-sdk. – krumpelstiltskin Jun 12 '23 at 16:00
9

Running the OBS Studio (on your PC) can use a smartphone (or other PC, as long as it has a recent browser) as Microphone/Camera input.

This requires OBS studio to have the "Browser Plugin", which is now a part of the Linux packages.

Then open a site like https://obs.ninja/ or https://kevin.c3voc.de/ on the smartphone, and copy the generated URL as "Browser Source" into OBS Studio on the receiving device.

azrdev
  • 333
  • So you can not use the OBS Studio in Ubuntu? – jarno Mar 10 '21 at 07:00
  • @jarno of course you can, but it doesn't (or didn't? have not checked since) include the "browser plugin" and therefore you cannot use obs.ninja or KEVIN to read in the microphone/camera of another device. – azrdev Mar 10 '21 at 13:17
  • Not sure about microphone but for camera, there are solutions. The easiest would be ScreenStream android app (which is also a Free/Libre and Open Source software) to share the screen over network. – Mostafa Ahangarha Sep 21 '21 at 08:38
  • 1
    As of 2022-03 the "Browser Source" is available in OBS on Linux (well, Ubuntu at least). – neo post modern Mar 08 '22 at 17:41
8

The solution suggested by @azrdev ist pretty neat, because now OBS Studio for Linux does have the "Browser Plugin" and with this solution you can also benefit from all the other nice OBS features.

Instead of using a site like obs.ninja, I installed the Android app "IP Webcam" on my phone. With the app, you can start "broadcasting" your phone's video signal in your wireless network. With your computer and your smartphone in the same wireless network, you just add an browser source in OBS with the IP adress given to you by IP Webcam.

And that's it! Got it to work in about three minutes...

miezbla
  • 136
  • 1
  • 5
  • I installed obs-studio (version 25.0.3) from universe repository of Ubuntu 20.04, but I can not see any browser source I could add the URL to. – jarno Mar 13 '21 at 01:09
  • 1
    I installed the version from snap store and it has the Browser source, but I can't get it show the video stream of IP Webcam, but just some kind of configuration window of it. – jarno Mar 13 '21 at 01:46
  • 1
    Then, can the output from OBS can be used in other software (e.g. Skype, Google Meet, Cheese)? – Archisman Panigrahi Mar 28 '21 at 05:27
  • 2
    Yes. In OBS click the button in the bottom right saying "Start Virtual Camera". It now emulates a webcam called "OBS Virtual Camera" that you need to choose as source for the video signal in the software (Skype, discord,...) your using. – miezbla Mar 29 '21 at 08:13
  • @jarno So you do see something in OBS? Did you start the streaming of the video signal in IPWebcam on your phone? When I used it, I never saw something like a configuration window. Maybe this video tutorial can give you a hint? https://www.youtube.com/watch?v=_MNFlfgKvz4 – miezbla Mar 29 '21 at 08:21