Skip to content

Instantly share code, notes, and snippets.

@paulmey
Created October 11, 2020 07:11
Show Gist options
  • Save paulmey/81591c4ef4016f4ce5d804e062c515f0 to your computer and use it in GitHub Desktop.
Save paulmey/81591c4ef4016f4ce5d804e062c515f0 to your computer and use it in GitHub Desktop.
Files to start mjpg_streamer automatically when /dev/video0 is available
# /etc/udev/rules.d/99-mjpg-streamer-v4l.rules
# Tells udev to tell systemd to start mjpg-streamer when /dev/video0 pops up
SUBSYSTEM=="video4linux", KERNEL=="video0", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="mjpg-streamer@$name.service"
# /etc/systemd/system/mjpg-streamer@.service
[Unit]
Description=MJPG Streamer service for /dev/%i
# stop service if device disappears
BindsTo=dev-%i.device
After=dev-%i.device network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/mjpg_streamer -i "input_uvc.so -d /dev/%i" -o output_http.so
Copy link

ghost commented Mar 30, 2021

This didn't work for me on my Raspberry Pi. Any help you might be able to offer me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment