Use DSLR Manjaro 20.1
September 24, 2020•158 words
Steps:
Install the linux-headers for your Kernel (same as your kernel version)
sudo pacman -S linux-headers
Install gphoto2 and its dependencies (if v4l2 failed to install check step 1.)
sudo pacman -S gphoto2 v4l-utils v4l2loopback-dkms ffmpeg
Add Camera module to the modprobe flags
sudo modprobe v4l2loopback exclusive_caps=1 max_buffers=2
Allow DSLR to boot with the system
sudo nano /etc/modprobe.d/dslr-webcam.conf
# Module options for Video4Linux, needed for our DSLR Webcam
alias dslr-webcam v4l2loopback
options v4l2loopback exclusive_caps=1 max_buffers=2Try capture
gphoto2 --capture-image-and-download
Streaming to /dev/video0
gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0
Create script/allow execution of the script - so streaming is easier than remembering a full Linux command -
nano ~/script/dslr.sh
#!/bin/bash
echo "Streaming to /dev/video0"
gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0 -hwaccel nvdec -c:v mjpeg_cuvidchmod 755 ~/script/dslr.sh
Ref: https://www.crackedthecode.co/how-to-use-your-dslr-as-a-webcam-in-linux/