English

Canon DSLR Webcam on Arch Linux

Ever wanted to use your Canon camera as a webcam on Arch Linux? This guide covers everything you need to get your Canon cam streaming video to /dev/video* using gphoto2, ffmpeg, and the v4l2loopback kernel module.


📦 Requirements

You’ll need:

  • A Canon camera (tested with EOS 700D)
  • USB cable (mini/micro/USB-C depending on model)
  • Dummy battery (strongly recommended for long sessions)
  • Arch Linux (or a derivative like EndeavourOS, Manjaro, etc.)

Install dependencies

Use pacman or your AUR helper to install:

sudo pacman -S gphoto2 ffmpeg v4l2loopback-dkms linux-headers

Ensure your user is in the video group:

sudo usermod -aG video $USER

Then reboot or relog to apply.


🛠Configuring the loopback virtual device

  1. Create a V4L2 Virtual Device Install v4l2loopback if you haven’t already:
sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="DSLR Cam" exclusive_caps=1

This creates /dev/video10 as a new virtual webcam.

⚠️ Choose a video_nr not currently in use (video10 is usually safe).


⚙️ Camera Setup

To prevent your Canon camera from shutting off mid-stream:

  1. Go to the settings menu (wrench icon).
  2. Find Eco Mode.
  3. Set it to Off.

Then switch your camera to Movie mode.


🧪 Testing the Stream

You can stream the live preview using gphoto2 piped to ffmpeg:

gphoto2 --stdout --capture-movie | \
ffmpeg -f mjpeg -i - \
-vcodec rawvideo -pix_fmt yuv420p -s 1920x1080 -r 60 \
-f v4l2 /dev/video2

✅ Adjust -s for resolution, -r for frame rate, and /dev/video2 depending on your device setup.

You can find your active video devices via:

v4l2-ctl --list-devices

🔁 Create a Helper Script

Save this as canon-webcam.sh:

#!/bin/bash

sudo modprobe -r v4l2loopback
sudo modprobe v4l2loopback exclusive_caps=1 max_buffers=2 card_label="Canon Cam"

sudo pkill -9 gphoto2

gphoto2 --stdout --capture-movie | \
ffmpeg -f mjpeg -i - \
-vcodec rawvideo -pix_fmt yuv420p -s 1920x1080 -r 60 \
-f v4l2 /dev/video2

Make it executable:

chmod +x canon-webcam.sh

Then just:

./canon-webcam.sh

🎥 Using it in Zoom, OBS, etc.

Once your camera is streaming to /dev/video2, you can select it in:

  • OBS Studio (under Video Capture Devices)
  • Zoom / Google Meet / Discord (if they support V4L2 devices)
  • VLC: Media → Open Capture Device → /dev/video2

🛠️ Troubleshooting

  • Permission Denied: Ensure your user is in the video group.
  • No Output: Try switching video ports or reducing resolution.
  • Device Not Found: Use v4l2-ctl to verify the virtual camera is created.

🧾 References

Happy streaming!

0
0
0
0