Saturday, December 19, 2015

Use your DSLR Camera as a Webcam on Ubuntu

It is not uncommon that you have a DSLR and you wonder that it would be awesome if you can use it as a webcam. Have video calls with your family and friends using your high definition DSLR camera. Recording videos directly from your DSLR camera into your computer or us it for live view.

I was trying to do the same thing and searched over the internet, found some software that can do that but are not free and/or won't work on my Linux machine.

But recently found another way of achieving it. Basically making my DSLR work as a capture device, that is /dev/video*.

To do that you need a utility named gphoto2. First you have to check whether your camera is in the supported list of cameras, For that go through the list of supported cameras here.

I have a Canon EOS 100D, which is in the list, so it works for me.

Now attach your camera with your machine using the USB cable, and execute the following command in the terminal (linux shell).

gphoto2 --abilities

This should show you the camera name and abilities and other information, this shows that your camera is detected.

Now to the next step,

You need "v4l2loopback kernel module" to make a virtual device in /dev/video* for your camera. This can be installed by executing the following command,

sudo apt-get install v4l2loopback-utils

If all goes without any error, you can execute the following command to make a virtual camera device for your DSLR connect to the machine.

modprobe v4l2loopback

gphoto2 --capture-movie --stdout | gst-launch-0.10 videotestsrc ! v4l2sink device=/dev/video1

Now you can use this new device /dev/video1 as your webcam.

For Example you can configure Skype to use this as a Video device for video calls.

No comments:

Post a Comment