Thoughtful Dragon

$300 Webcam

Something I recently showcased on Facebook was my DSLR webcam setup. Since I purchased a DSLR and noticed I could set the time and control the camera from the gphoto2 command, I wondered if I could do more. Well now I know.

I have now turned my DSLR into a $300 webcam. Good news: it's significantly better than the one I dropped $20 at RadioShack. Bad news: probably a waste of time off.

I started messing around with it when I discovered that Darktable, the program I use to edit and develop my RAW images, had a tethering feature. It was very straight forward to connect my camera to the program and I soon had this setup working:

This, however, was not enough for me. I wanted to see if I could take the live view that worked in Darktable and get Skype and Google Hangouts to use it too. Fortunately, I was not (by far) the first person to think of trying this. On Windows (Sparkocam) and Mac (CamTwist) programs exist (for Free!) to make this possible, however on Linux it’s not as straight forward. But it does work excellently. The first thing to do is to make sure you have the v4l2loopback kernel module installed.

Debian and Ubuntu users should use:

sudo apt-get install v4l2loopback-dkms

Arch Linux users can install it from AUR:

yaourt v4l2loopback-dkms

I couldn’t find any package for Fedora, but any Linux distribution can install from source found at https://github.com/umlaeute/v4l2loopback. Just make sure you have your distribution’s development packages installed with the Linux kernel headers.

You also will need to have GStreamer, which I believe most distributions preinstall. Arch Linux users can get it by installing the gstreamer package.

Now that you have the dependencies just connect your camera to your computer and run the following command in a terminal:

The first command makes sure the kernel module is loaded and then starts the camera stream. It should now show up in Skype and Hangouts. Just be sure to run this script before starting the app that needs to use the video feed.