Using digicam as a webcam on Linux
A short memo on how to use a digital camera as a web camera on Linux.
I recently dug out a pretty old Canon EOS 550D, and since I only have a poor built-in webcam, that was a chance to improve my video quality significantly!
Once plugged into a USB port, the camera is detected just as storage. We need two things to make it work properly:
- Stream the video feed from it
- Pipe this feed into a virtual video input device
The first step is pretty simple — just use gphoto2
:
<enjoy
)
The second piece of the puzzle is v4l
, in particular, v4l2loopback
. If you’re using Arch like me, you can just install it:
This will also install the required DKMS package to bring in the kernel module named v4l2loopback
.
Now run
To create a virtual video device. You can check the kernel logs for the exact path in my case, it was /dev/video2
Now we can stream the video feed from the camera to that device using ffmpeg
!
|
And we’re done!