Using a digital camera ( Canon) as webcam

I can't use my digital camera ( Canon ixus 160) as webcam is there an application for that ? or just in the settings?


Solution 1:

Here's another solution.

List of gphoto2 supported cameras: http://gphoto.org/proj/libgphoto2/support.php

You need install gphoto, v4l2loopback-utils and ffmpeg.

Then

sudo modprobe v4l2loopback

and

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video1

Now you have webcamera from your digital camera.

Solution 2:

This can be done but requires a number of steps. First, you must install gphoto and v4l2loopback-utils.

sudo apt-get install gphoto2 v4l2loopback-utils

Plug in your camera via USB (when the camera mounts automatically, unmount it). Then run gphoto2 --abilities to see if your camera is capable of doing this. Here's the output when connecting a Canon EOS 1200D

enter image description here

Then run sudo modprobe v4l2loopback to activate the kernel module needed to create a video device from your camera.

I've seen older tutorials on this task that use gst-launch-0.10 to achieve the next step of this task (e.g. this one). I am using Ubuntu 17.04 which uses gst-launch-1.0. Below is the updated command to create a video device from your digital camera:

gphoto2 --stdout --capture-movie | gst-launch-1.0 fdsrc ! decodebin3 name=dec ! queue ! videoconvert ! v4l2sink device=/dev/video1

This will create a video device in /dev/video1, which you can now use in programs like VLC.

If you see any errors about the device being in use you need to kill the gvfs-gphoto2-volume-monitor process by running killall gvfs-gphoto2-volume-monitor.