Skip to content
Abdulrahman Magdy

Projects

omarchy-dslr-webcam

Use a Canon, Nikon, or Sony camera as an always-on Linux webcam, with automatic start on plug-in, crash recovery, and a status bar toggle.

Year
2026
Role
Author
Stack
Bash, systemd, udev, ffmpeg, gphoto2

View source

The problem

A DSLR makes a much better webcam than most webcams, and on Linux the pieces to do it exist: gphoto2 can stream live view, and v4l2loopback can expose a virtual video device. Wiring them together by hand works until the camera times out, the USB session wedges, or the machine reboots.

How it works

  1. Camera

    USB / PTP

  2. gphoto2

    MJPEG live view

  3. ffmpeg

    crop and scale

  4. v4l2loopback

    /dev/videoN

The streaming pipeline, restarted automatically when any stage fails.
  • A bash CLI runs the pipeline and restarts it when it breaks, resetting the camera’s USB session between attempts.
  • A systemd user service keeps it running, and a path unit restarts it when the settings file changes.
  • A udev rule starts the service when a supported camera is plugged in.
  • A bar widget shows the state, toggles the stream, and names the app currently reading the camera.

Decisions and trade-offs

Everything runs as standard system plumbing (systemd, udev, a shell script) rather than a long-running custom daemon, so it is easy to inspect with journalctl and dslr-webcam doctor. The trade-off is that it is Linux-specific, and it is tested with one camera body, a Canon EOS 4000D.