Linux

The GNU/Linux module (prototype) is a combination of a Video4Linux2 device driver, and an executable app that will transfer the stream from the phone to the driver.

It’s assumed you are somewhat familiar with the system and how to use the Terminal. Also please keep in mind other posts on the blog are Windows oriented.

Install

1. You must first remove any old versions of the client you have. Scroll down to the “Removal” section below.

2. If you are using an older Android device, check the version of DroidCam that was installed from the play store and run the appropriate commands from below.

For DroidCam & DroidCamX version 6 and above (newest):
cd /tmp/
sudo apt-get install linux-headers-`uname -r`
bits=`getconf LONG_BIT`
wget https://www.dev47apps.com/files/600/droidcam-${bits}bit.tar.bz2
[[ ${bits} -eq 32 ]] && checksum=c8baa64b3f1e1d9b9051ece23474e58f
[[ ${bits} -eq 64 ]] && checksum=ad14437f0556d80f981d1027766afe29
echo "${checksum}  droidcam-${bits}bit.tar.bz2" | md5sum -c --
# OK?
tar xjf droidcam-${bits}bit.tar.bz2
cd droidcam-${bits}bit/
sudo ./install

For DroidCam & DroidCamX below 6: [show]

Please download one the following packages to /tmp, extract and run sudo ./install 640 480
64-bit (f937c3510615af68c007b8c72deadb14), or 32-bit (73c6b9d853a0a6ab7c6d15174450a3f1).

* If you are running the newest Linux kernel (version 4 or above) and seeing errors, make sure your installed gcc version is 4.9 or above:
uname -r # prints linux version
gcc -v # prints gcc version


3. Once everything goes without error, you can ensure the device is installed with lsmod. Look for ‘v4l2loopback_dc’.

Open up a V4L2 compatible program (VLC player, Skype, Cheese, etc) and you should see DroidCam listed as a video device.

4. Start droidcam via the Terminal, or create a launcher if you’re using gnome. You can also try droidcam-cli -h.

5. Check the connection post on how to connect. If all goes well, you should see the output in the chat application, and you’re done!

A note about USB connections: The latest version of the client will try to invoke ‘adb’ automatically, provided the executable is found via the $PATH environment variable (ie. export PATH=$PATH:/path/to/adb).
The following commands are automatically executed:
adb start-server
adb devices # Look in output for a connected device
adb forward tcp:$port tcp:$port # $port = specified port on the client

The Linux client is open source.

Update webcam resolution

You may change the webcam output resolution as follows:

1. Close any programs using the droidcam webcam. Unload the device driver:
sudo rmmod v4l2loopback_dc

2. Re-load it as follows (WIDTH and HEIGHT are numbers). :
sudo insmod /lib/modules/`uname -r`/kernel/drivers/media/video/v4l2loopback-dc.ko width=WIDTH height=HEIGHT
Recommended resolutions: 320×240, 480×360, 640×480, 960×720 or 1280×720.

3. Restart the droidcam client to reload the settings, and test it out. You can keep changing the resolution.

4. Edit the text file /etc/modprobe.d/droidcam.conf with the new options to make the change stick.

Removal

To remove the DroidCam client (or existing old version):
Close any running programs. Run one of the following (depends which version of the linux client you got)
sudo /opt/droidcam-uninstall
# OR
sudo ~/.droidcam/uninstall
  1. Petros says:

    I just downloaded the client and installed it (Ubuntu 16.04 64b) . There are errors in the last stage, see the pastebin: https://share.riseup.net/#zB-evXIiJH_MceKGHN1pYQ Please advise.

    • dev47 says:

      Hi, Seems you need the gcc program, you can try installing it on its own but usually its part of ‘build-essential’.

  2. scott says:

    absolutely awesomely flawless install and use. thanks!. I’m new at much of this, so please forgive some noob questions:

    1. OK, there was a tiny little glitch upon install — at the very end I got this:

    make: Leaving directory ‘/tmp/droidcam-64bit/v4l2loopback’
    Moving driver and executable to system folders
    Registering webcam device
    insmod: ERROR: could not insert module /lib/modules/3.16.0-4-amd64/kernel/drivers/media/video/v4l2loopback-dc.ko: File exists

    This is on a debian 8 box that I installed from scratch yesterday, so I’m pretty sure that I’ve never run droid-cam on this box before. So my question is just “at first glance, it seems that I didn’t need to compile or install anything; there already was a v4l2loopback kernel module installed. Do I need to worry that it’s not YOUR build that I”m using for DroidCam? Do I get extra features if i install the kernel module I just made from my download from dev47apps? (Or perhaps on the contrary, the stock one out of the distro contains HD esolutions that your driver cripples until I pay lol? (sorry, i don’t really believe that, was just needling you)

    2. Is there some way to change the resolution parameters on the fly? or do i really have to unload and then reload the kernel module each time I want to change them

    3. Is there a way to read the resolution parameters that are curently being used?

    4. is there a known, predictable default resolution that gets used if there is no .conf file and no parameters are passed when the module is loaded?

    Really nice video is coming from my OnePlus Three. My phone instantly became my best webcam, among the five that i have:) I’m sure i’ll be paying you in a day or two 🙂

    • dev47 says:

      Hi scott,
      (1) Hmm.. Thats actually strange, I highly doubt that file was there with the distro. That must have been a second attempt or something.
      You can compare the file you compiled VS the one under /lib/modules by running md5 [file]. The output should be same when you replace [file] with /tmp/droidcam-64bit/v4l2loopback/v4l2loopback-dc.ko and /lib/modules/3.16.0-4-amd64/kernel/drivers/media/video/v4l2loopback-dc.ko.

      (2,3,4) You cant change the resolution on the fly, not right now at least. The default is 640×480 which is the most widely supported option around. You can read the current resolution by running cat /etc/modprobe.d/droidcam.conf as one method.

  3. FrViPofm says:

    Nice !
    My fairphone is now my new webcam on Ubuntu 16.04.
    It runs even when using the Fairphone as a USB/wifi bridge between the computer and the LAN. I only have to set the IP:port of the phone.
    FYI, in VLC, the cam appears as “/dev/video0” and I’ve not found the way to set the audio source between the 2 options in VLC [ hw:0,2].

  4. SayoGmx says:

    man i got this error
    sayogmx@sayogmx-HP-ProBook-6460b:/tmp/droidcam-64bit$ sudo ./install
    Webcam parameters: ‘640’ and ‘480’
    Building v4l2loopback-dc.ko
    ./install: línea 36: make: orden no encontrada

Leave a Reply

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

captcha

Follow @dev47apps