DroidCam in Ubuntu
You’ve already got an expensive smartphone that’s running Android OS of all things. Why would you need a webcam? Unless you’ve got money lying around (in which case, I’d be happy to take some off of you), I will show below how to use your android device as the webcam in Ubuntu with DroidCam. This will also work for all debian distros.
This post can easily become outdated, please keep an eye on the official guide here.
Step 1: Install DroidCam in your phone.
DroidCam is developed by Dev47Apps, and is one of the most useful software out there. I was very happy to pay for the pro version. It’s worth the purchase.
You can download the free one from the Play Store. Once downloaded, open the app and proceed to step 2.
Step 2: Install DroidCam client in Ubuntu
Ctrl + Alt + T and bring out the terminal.
cd /tmp to go to the temporary directory of the OS.
Download the client with the following command:
wget -O droidcam_latest.zip https://files.dev47apps.net/linux/droidcam_1.7.2.zip
It’s a good practice to verify downloaded files, to make sure they are not corrupted:
droidcam_latest.zip" | md5sum -c --
This will print out
OK if the file was not corrupted.
Time to unzip the file:
unzip droidcam_latest.zip -d droidcam && cd droidcam
This will unzip the file and navigate inside the folder it was extracted to: droidcam.
Let’s install the app:
You will be prompted for the root password. All should go well afterwards.
Install the Video Driver
I’m using the
v4l2loopback module and it should work just fine for almost all cases.
Install the required packages with:
sudo apt install linux-headers-uname -r gcc make
Then, install the video driver with:
According to the official guide:
If all goes well, you can ensure the video device is loaded via
lsmod | grep v4l2loopback_dc. You should see v4l2loopback_dc in the output.
Step 3: Start the client
Now, the command
droidcam is available to you in the terminal.
Run the command to start the GUI. You can also use the CLI client but I think this is simpler.
Step 4-a: Connect via WiFi
This is very straight forward. Grab the `Wifi IP` the app shows you on your phone. The port is usually 4747 unless you change it.
Give it to the Ubuntu Client and hit Connect.
Step 4-b: Connect Via Cable
You only need either the WiFi or the Cable connection. I find cable more stable. But it requires a bit of work.
First, install ADB:
apt install -y adb
Once that is done, connect your phone and accept the
Allow Data Access prompt if it shows up in your phone.
Then, select the
USB (Android) option in the desktop client and hit connect.
Important: Your phone will ask you for another permission. And the initial try to connect may fail on PC. Don’t be alarmed. Just accept the ADB connection prompt in your phone and click on the ‘Connect’ button again on the desktop client.
If you see no errors, you are done:
Step 5: Using the webcam source in your apps
Apps like Zoom, Skype, Web browsers will all now show
Droidcam Source X in their video source list. X is a number, sometimes it changes based on port but they will all work. You don’t have to keep changing it.
If you face any problems, drop me a comment below and I’ll do my best to help.