Using an Android device as a webcam for Linux

This guide shows how to use any Android device as a webcam on a Linux system. It becomes very handy for when you are like “oh shit, i’m late for my video meeting”, or when you just dont want to bother with aquire additional hardware. There exists no updated software for dealing with this as the only solution i’ve come across is Droidcam. Droidcam only works for older Ubuntu versions sadly. But fear not, because the solution is quite simple.

As a quick note: This was tested on Ubuntu 17.10, but should be compatible with most Linux based systems.

Prerequisites:

  • GIT
  • ffmpeg
  • c compiler (build-essential)
  • Your Android device must be on the same network as your computer

1. Install dependencies

sudo apt-get install git build-essential

2. Install FFMPEG, (You may need to compile this for some distributions)

sudo apt-get install ffmpeg

3. Install v4l2 loopback driver

# Clone
cd /opt/ && git clone https://github.com/umlaeute/v4l2loopback

# Install
cd v4l2loopback && sudo make && sudo make install

# Load Kernel Module videodev
sudo modprobe videodev

# Just incase you have loaded v4l2 previously
sudo rmmod v4l2loopback

# Load v4l2 module
sudo insmod ./v4l2loopback.ko exclusive_caps=1


4. Find your newly created video device:

find /dev/ -name "video*"

# Output (Example, may be different, video0-9):
/dev/video1

 

We are now ready to set up your Android device!

5. Go to Google Play and Install IP Webcam (

6. Scroll down and press “Start Server”

Your device are now streaming your webcam via whatever protocol you set it to use. Note down the IP adress and the port of your webcam steam. Now back to your linux machine!

7. Download the existing (WOHO!) webcam hook:

cd ~/
wget https://raw.githubusercontent.com/bluezio/ipwebcam-gst/master/prepare-videochat.sh
chmod +x

8. Edit the file and find the line saying WIFI_IP. Fill in your Android device IP.

9. Run prepare-videochat.sh

./prepare-videochat.sh &

You should now be up and running with a brand new webcam for your Linux machine. You can verify that it is working at https://www.onlinemictest.com/webcam-test/

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *