- Rust 85.6%
- Shell 14.4%
The Logitech C920 (046d:08e5) defaults to 60 Hz power line frequency and forgets any change when it loses power. webcam-antiflicker watches for the camera via nusb hotplug events and sets the UVC Processing Unit power line frequency control to 50 Hz about 200 ms after attach, verifying the write, retrying if needed and rechecking at 1, 3 and 10 seconds. install.sh builds the binary and loads it as the per-user LaunchAgent net.sinclairstudios.webcam-antiflicker; uninstall.sh removes it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| install.sh | ||
| LICENSE | ||
| README.md | ||
| uninstall.sh | ||
webcam-antiflicker
Keeps a Logitech C920 on 50 Hz anti-flicker under macOS.
The C920 defaults to 60 Hz and resets to it whenever it loses power, which causes rolling bands
under 50 Hz mains lighting. webcam-antiflicker runs as a LaunchAgent, waits for the camera to
appear on USB, and sets it back to 50 Hz.
Install
Requires macOS and Rust (https://rustup.rs).
./install.sh
This builds the binary, copies it to ~/.local/bin/webcam-antiflicker, and loads the LaunchAgent
net.sinclairstudios.webcam-antiflicker, which starts at login. Run it again after changing the
code. ./uninstall.sh removes both.
Checking it works
The log is at ~/Library/Logs/webcam-antiflicker.log. After replugging the camera you should see:
2026-11-25T23:30:01.059Z Logitech C920 [0x1120000] attached
2026-11-25T23:30:01.326Z Logitech C920 [0x1120000] attempt 1 +260ms: power_line_frequency [2] -> [1]
Values are 0 = off, 1 = 50 Hz, 2 = 60 Hz, 3 = auto.
Other cameras and settings
Add cameras to CAMERAS in src/main.rs by USB vendor and product ID, which
system_profiler SPUSBDataType lists. Settings are in SETTINGS; each is a UVC Processing Unit
control, with selectors listed in table A-13 of the UVC 1.5 spec.
License
Released into the public domain under the Unlicense.