Last active
April 23, 2020 11:00
-
-
Save CRTified/129034c27db71e9f6cf0bb572a259864 to your computer and use it in GitHub Desktop.
Webcam Setup with v4l-utils and udev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
services.udev.extraRules = let | |
camSettings = pkgs.writeShellScript "setup-v4l2.sh" '' | |
${pkgs.v4l-utils}/bin/v4l2-ctl \ | |
--device $1 \ | |
--set-fmt-video=width=1920,height=1080,pixelformat=MJPG \ # Set to 1080p | |
-p 30 \ # Set to 30 FPS | |
--set-ctrl=power_line_frequency=1 \ # Set to 50Hz power line compensation | |
--set-ctrl=focus_auto=0 # Disable autofocus | |
''; | |
in | |
'' | |
SUBSYSTEM=="video4linux", KERNEL=="video[0-9]*", \ | |
ATTRS{product}=="C922 Pro Stream Webcam", RUN="${camSettings} $devnode" | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment