Need a webcam in Ubuntu? No problem thanks to Android.

Recently upgrading my Ubuntu desktop machine, I spent a long time looking at the peripherals in the stores, asking myself, do I need a new keyboard? or mouse? What about a webcam? I stood for a while contemplating whether I would actually ever use a webcam if I bought it. Constantly thinking about what I would use it for?  I don’t tend to take pictures apart from on my phone. I don’t do video calls. As I stood there browsing through the webcams I realised that the webcam on my laptop doesn’t really get any use, apart from unlocking my computer with facial recognition (if the lighting and distance from the camera are right). So I left the store happily in the fact that I wouldn’t need to purchase one. However, when I completed upgrading my machine I couldn’t help thinking, what if?

Then I thought why can’t I use a camera I already own somewhere? Eventually, I came to the conclusion why not use the camera on my phone?

Step In Droidcam

Droidcam is an android application and corresponding v4l2 (Video for Linux 2) driver that enables a Linux system to access the camera on an android phone over a local area network, USB connection or through a web browser.

Installing Droidcam

Install the Android app, head over to the google play store here and install the app.

Installing the V4L2 Driver

Open a terminal (Ctrl+Alt+T) and type the following to download the prerequisites and install.

sudo apt-get install linux-headers-uname -r

For 32bit

wget https://www.dev47apps.com/files/600/droidcam-32bit.tar.bz2
tar xjf droidcam-32bit.tar.bz2
cd droidcam-32bit/
sudo ./install

For 64bit

wget https://www.dev47apps.com/files/600/droidcam-64bit.tar.bz2
tar xjf droidcam-64bit.tar.bz2
cd droidcam-64bit/
sudo ./install

Create a Startup Launcher

gedit ~/.local/share/applications/droidcam.desktop

Then enter the following into the file,

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=DroidCam
Exec=droidcam
Comment=Use your Android phone as a wireless webcam or an IP Cam!
Icon=droidcam
Categories=GNOME;GTK;Video;
Name[it]=droidcam

You can add a custom icon by changing the icon path above or using a menu editor like   MenuLibre or Alacarte.

Connecting the application.

Wifi

Open the Droidcam application on your android device and make a note of the IP address.

Screenshot_20181025-111912_DroidCam

 

Open the Droidcam application on your desktop and enter the Ip address noted from the phone

Screenshot-20181025112531-388x168.png

Click connect and open cheese or a similar application. and test out the picture quality.

Connecting over ADB with a cable.

The ability to connect over wifi great for portability, if you’ve configured skype for example not having to be tied to the machine and being able to suddenly get up mid-call is a bonus. It does however come at a cost of slight quality loss and latency. connecting by cable will eliminate this but at the cost of loss of portability (dependent on cable length)

To connect over ADB

Open the app on the phone, and enable USB debugging in the developer menu.

On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom. Then on the PC open a terminal and type:

sudo apt-get install adb

when installed plug the USB data cable into the computer and the phone. you can check whether the connection is functioning by typing:

adb devices

You will need to authorise the connection on the phone. Once done select USB (over ADB) in the Droidcam client and click connect.

Connecting by IP address.

Screenshot-20181025123052-1088x846.png

Open a browser window and enter the address given by the phone eg. http://192.168.1.94:4747 and you will connect to the phone camera through an interface webpage. It should be possible in theory to find your external IP and enable port forwarding on your router to also access the camera from an external IP. (I haven’t however tested this yet)

Changing the resolution

you can change the resolution by editing the droidcam.conf file, in the terminal type:

gksudo gedit /etc/modprobe.d/droidcam.conf

change the width and height value as required, recommended values are

  • 320×240
  • 480×360
  • 640×480
  • 960×720
  • 1280×720

Save the file and restart the client to implement the changes.

Options available in the Droidcam client.

Click on the 3 dot menu and a menu with extra options appears. the options are:

  • Auto-Focus (Ctrl+A)
  • Turn On LED Flash (Ctrl+L)
  • Zoom In (+)
  • Zoom Out (-)

Uninstall the client

To uninstall Droidcam from Linux simply type the following in a terminal:

sudo /opt/droidcam-uninstall

Notes:

Wifi Server mode

This option is only available on the paid version of the app from google play. Instead of connecting to the phone app from the PC client, DroidCam can connect to the PC client from the phone.

Driver Install Location

If Droidcam is installed on a device that already has a camera located at /dev/video0  (like an existing integrated webcam) Droidcam will overwrite it at /dev/video0 and push the integrated device to /dev/video1. Any pre-configured applications will have to be altered to use the integrated device.

The driver is able to fully utilise the microphone of the android device as well as the camera. Setting up for use with Skype, cheese and other applications is easy and painless as the driver integrates brilliantly with the OS.

Do you harness the camera of your phone in Linux? Let us know in the comments below.

 

 

 

0
%d bloggers like this: