đź”§ Turn Your Spare Android Phone into a Webcam for Linux!
Ever had that awkward moment when you're all set for a video interview on your PC—only to find out your webcam quality is atrocious?
Breathe easy. You can turn that spare Android phone lying around into a high-quality webcam for your Linux PC!
Chances are, that old phone has a camera that's leagues better than your laptop's built-in one. Since webcams are pricey, this budget-friendly guide has you covered.
âś… What You Need:
- An Android Phone
- USB Cable
- A Linux PC
This is a beginner-friendly tutorial. Just follow along step-by-step, and you’ll be ready to roll.
📚 Table of Contents:
- Prepare the Android Phone
- Install Dependencies on the PC
- Configure the Phone with the PC
- Launch the Phone’s Camera as Webcam
- Conclusion
🛠️ Prepare the Android Phone
Android runs on the Linux kernel. A few tweaks and we’re good to go.
- Go to
Settings > About Phone
- Tap Build Number 7 times to activate Developer Mode
- Go back, open Developer Options
- Toggle on USB Debugging
- Connect your phone via USB to your Linux PC
📦 Install Dependencies on the PC
- Open a terminal and run:
sudo apt install android-tools-adb -y
adb devices
Your Android phone will ask to allow USB debugging. Accept it.
🔹 ADB stands for Android Debug Bridge.
- Install scrcpy (Screen Copy tool):
sudo apt install scrcpy
Then launch:
scrcpy
This mirrors your phone screen to the PC.
⚙️ Configure the Camera with PC
- Install
ffmpeg
:
sudo apt install ffmpeg -y
- Clone and install v4l2loopback to create a virtual camera:
git clone https://github.com/umlaeute/v4l2loopback
cd v4l2loopback
make && sudo make install
sudo depmod -a
sudo modprobe v4l2loopback
📲 Setting Up the Android Camera
-
Install IP Webcam from the Play Store.
Note: The free version has ads. Consider going premium for a smoother experience.
Open the app and scroll down to tap Start Server
You'll see an IPv4 address at the bottom (e.g.,
http://192.168.x.x:8080
)
🔄 Port Forwarding via ADB
- List devices:
adb devices -l
Output:
List of devices attached
affhh41a device usb: product:phone brand device transport_id:2
- Export the device ID:
export ANDROID_SERIAL=affhh41a
- Forward the port:
adb forward tcp:8080 tcp:8080
Now visit:
-
http://localhost:8080
– full IP Webcam interface -
http://localhost:8080/video
– direct video stream (use Firefox only)
🎥 Create a Virtual Webcam
- Run this to create the virtual webcam:
sudo modprobe v4l2loopback
- List available devices:
v4l2-ctl --list-devices
Your new virtual webcam is likely /dev/video2
.
🚀 Redirect the Video Stream
Use ffmpeg
to pipe the stream to your virtual webcam:
sudo ffmpeg -i http://localhost:8080/video -vf format=yuv420p -f v4l2 /dev/video2
Now, applications like Google Meet, Zoom, OBS, or OpenCV can use your phone as a webcam 🎉
🎬 Webcam in Google Meet (via Firefox):
đź”´ OBS Studio Preview:
âś… Conclusion
While there isn’t a GUI to handle all this, the command-line workflow with tools like scrcpy
, adb
, and ffmpeg
makes it totally doable—even for beginners.
Questions? Suggestions? Drop them in the comments—your feedback is golden!
Top comments (0)