Linux

September 8th, 2010 Leave a comment Go to comments

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. Text in blue should be executed in 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. Download (for DroidCam v4.0+, DroidCamX v4.0+):
32-bit (850abe9f28b3e91dee520e8d4b40c1dc), or
64-bit (7e4e4d1255f2956e69488d237d34948c).

3. Extract everything to the desktop or another folder. Make sure there are no spaces in the path.

4. Open up Terminal, cd ~/Desktop/droidcam-?? (or ~/whatever). A simple bash script is included that will automate the installation process.

Simply run sudo ./install 320 240 to install the client. sudo needed to register the device driver. 320 and 240 are optional, this is the output resolution for the webcam. Replace them with one of 320 240, 480 360, 640 480, or 960 720. You can change this anytime, so it’s best to make sure 320×240 works first.

The installer creates a settings directory as /home/`logname`/.droidcam. If you’re running as root, make sure you move it to your standard users home directory.

If no errors are displayed, you can ensure the device is installed with lsmod.

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

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

7. 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! Remember to delete the install folder from step 3.

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

Interested in the source code? Great.

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: sudo insmod /lib/modules/`uname -r`/kernel/drivers/media/video/v4l2loopback-dc.ko width=WIDTH height=HEIGHT (Where WIDTH and HEIGHT are numbers).
Recommended resolutions: 320×240, 480×360, 640×480, 960×720 or 1280×720.

3. Edit the first line of the text file ~/.droidcam/settings so the frames are resized properly (specify the same resolution as in 2). Restart the client to reload the settings.

4. Test the webcam with whatever programs you wish. You can keep changing the resolution.

5. Edit the text file /etc/modules so the webcam gets reloaded with the new resolution after reboot.

Removal

To remove the DroidCam client (or existing old version):

Close any running programs. Open the command line.
run `sudo ~/.droidcam/uninstall` which does the following:

– Unload the V4L driver: sudo rmmod v4l2loopback-dc.
– Delete the driver file and the client executable:
sudo rm -f /usr/bin/droidcam /usr/bin/droidcam-cli
sudo rm -f /lib/modules/`uname -r`/kernel/drivers/media/video/v4l2loopback-dc.ko

– Get rid of droidcam and ‘videodev’ in /etc/modules

Finally, Delete ~/.droidcam/ folder

  1. uri
    December 31st, 2014 at 08:35 | #1

    I compiled this with gcc-4.9.2
    gentoo-sources kernel 3.18.0.
    At first I get a error that must be a warning.
    But with Wno-error=implicit-function-declaration flag
    solved the problem. The i get this when I try to insert the module

    insmod v4l2loopback-dc.ko width=320 height=240
    insmod: ERROR: could not insert module v4l2loopback-dc.ko: Unknown symbol in module
    Makefile:13: recipe for target ‘insmod’ failed

  2. rey
    January 22nd, 2015 at 21:27 | #3

    I installed the app but I can’t install the client since i’m using a Mac, not a linux computer. Is there a Mac client?

    • dev47
      January 25th, 2015 at 11:24 | #4

      No, sorry, there is no mac client at the moment.

  3. DaCapitan
    January 25th, 2015 at 17:31 | #5

    Hello,

    I compiled/installed on Fedora 21 64bit. The camera shows fine on my phone in droidcam, but on the PC, it’s green and corrupted, etc.

    How to fix? nexus 5

    • dev47
      January 26th, 2015 at 13:34 | #6

      Hi,
      Double check that the resolutions for the client program and the video driver match up. See the section on how to modify webcam resolution.

  4. DaCapitan
    January 27th, 2015 at 19:31 | #7

    That didn’t work, but when I installed the f20 rpm after installing your .tar.gz kernel module, it worked.

    But, now the kernel module won’t compile with 3.18.3-201.fc21.x86_64. Errors in v4l module. Had to go back to 3.17

  5. DaCapitan
    January 28th, 2015 at 09:04 | #8

    v4l2loopback won’t compile after upgrading to kernel 3.18.3:

    make
    make -C /lib/modules/`uname -r`/build M=`pwd`
    make[1]: Entering directory ‘/usr/src/kernels/3.18.3-201.fc21.x86_64′
    LD /tmp/v4l2loopback/built-in.o
    CC [M] /tmp/v4l2loopback/v4l2loopback-dc.o
    /tmp/v4l2loopback/v4l2loopback-dc.c: In function ‘attr_store_maxopeners’:
    /tmp/v4l2loopback/v4l2loopback-dc.c:456:3: error: implicit declaration of function ‘strict_strtoul’ [-Werror=implicit-function-declaration]
    if (strict_strtoul(buf, 0, &curr))
    ^
    /tmp/v4l2loopback/v4l2loopback-dc.c: At top level:
    /tmp/v4l2loopback/v4l2loopback-dc.c:2311:3: warning: initialization from incompatible pointer type
    .vidioc_s_std = &vidioc_s_std,
    ^
    /tmp/v4l2loopback/v4l2loopback-dc.c:2311:3: warning: (near initialization for ‘v4l2_loopback_ioctl_ops.vidioc_s_std’)
    /tmp/v4l2loopback/v4l2loopback-dc.c:2331:3: warning: initialization from incompatible pointer type
    .vidioc_s_audio = &vidioc_s_audio,
    ^
    /tmp/v4l2loopback/v4l2loopback-dc.c:2331:3: warning: (near initialization for ‘v4l2_loopback_ioctl_ops.vidioc_s_audio’)
    /tmp/v4l2loopback/v4l2loopback-dc.c:2333:3: warning: initialization from incompatible pointer type
    .vidioc_s_audout = &vidioc_s_audout,
    ^
    /tmp/v4l2loopback/v4l2loopback-dc.c:2333:3: warning: (near initialization for ‘v4l2_loopback_ioctl_ops.vidioc_s_audout’)
    cc1: some warnings being treated as errors
    scripts/Makefile.build:263: recipe for target ‘/tmp/v4l2loopback/v4l2loopback-dc.o’ failed
    make[2]: *** [/tmp/v4l2loopback/v4l2loopback-dc.o] Error 1
    Makefile:1385: recipe for target ‘_module_/tmp/v4l2loopback’ failed
    make[1]: *** [_module_/tmp/v4l2loopback] Error 2
    make[1]: Leaving directory ‘/usr/src/kernels/3.18.3-201.fc21.x86_64′
    Makefile:4: recipe for target ‘all’ failed
    make: *** [all] Error 2

Comment pages
1 5 6 7 12
captcha