This guide explains how to use a DSLR camera as a webcam on Ubuntu.
Check if your device is supported by gphoto2
here.
Install the necessary packages by running:
sudo apt install gphoto2 v4l2loopback-dkms v4l2loopback-utils ffmpeg
Disable Secure Boot in your BIOS settings. This step is necessary to load the v4l2loopback
kernel module.
Load the v4l2loopback
module into the kernel with specific parameters. The exclusive_caps=1
parameter is required for the camera to be recognized in Google Chrome. The card_label
parameter provides a name for the virtual device.
sudo modprobe v4l2loopback exclusive_caps=1 card_label="Camera Loopback"
In my case, I set the resolution to HD and the fps to 30. The device I use is /dev/video2
. Use v4l2-ctl --list-devices
to find your device.
gphoto2 --stdout --set-config liveviewsize=0 --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 -s:v 1366x768 -r 30 /dev/video2
Consider creating a script and a desktop shortcut for ease of use, similar to the one in this repository for the T6.
Made with ❤️ by jeanvcastro