Skip to content

Repository files navigation

wincamcfg

A command-line utility for managing webcam configuration on Windows

The problem

Ever moved to a country with 50Hz powerline frequency and noticed your webcam footage looking like a disco strobe light? Windows defaults to 60Hz anti-flicker settings, which causes annoying flickering when your local power grid runs at 50Hz. While you can fix this manually in camera settings... doing it for multiple cameras or at scale is a pain.

That's where wincamcfg comes in.

What it does

wincamcfg lets you read and write webcam properties from the command line. The original use case was fixing powerline-frequency flicker on cameras moved between 50Hz and 60Hz countries, but the same approach works for brightness, contrast, white balance, and the rest of the DirectShow property set.

It can set the same things as the native DirectShow camera-properties dialog:

NativeCameraControls

Installation

From source

git clone https://github.com/andrewj-t/wincamcfg.git
cd wincamcfg
cargo build --release

The compiled binary will be in target/release/wincamcfg.exe.

Usage

List all cameras

See what cameras are connected to your system:

wincamcfg list

Example output:

[0] Integrated Webcam
[1] Logitech HD Pro C920

Get current settings

Check current property values for a specific camera:

# Get all properties for camera 0
wincamcfg get --camera 0

# Get all properties for all cameras
wincamcfg get --camera all

# Output as JSON for scripting
wincamcfg get --camera 0 --output json

Fix powerline-frequency flickering

The main reason this tool exists! Set your cameras to match your local power grid:

# Set camera 0 to 50Hz (for most of Europe, Asia, Africa, Australia)
wincamcfg set --camera 0 --property PowerlineFrequency --value 50Hz

# Set camera 0 to 60Hz (for Americas, parts of Asia)
wincamcfg set --camera 0 --property PowerlineFrequency --value 60Hz

# Set ALL cameras to 50Hz
wincamcfg set --camera all --property PowerlineFrequency --value 50Hz

Adjust other properties

Other settings you can change:

# Adjust brightness
wincamcfg set --camera 0 --property Brightness --value 128

# Adjust contrast
wincamcfg set --camera 0 --property Contrast --value 150

# Enable auto white balance
wincamcfg set --camera 0 --property WhiteBalance --value Auto

# Disable backlight compensation
wincamcfg set --camera 0 --property BacklightCompensation --value Off

Auto vs manual mode

Properties like Exposure, Focus, and WhiteBalance can run in either Auto or Manual mode. Pass --value Auto to switch the property into auto mode, or pass any numeric value to switch it into manual mode at that value.

# Turn auto exposure ON
wincamcfg set --camera 0 --property Exposure --value Auto

# Turn auto exposure OFF by setting an explicit manual value
# (use `get` to see the supported range and current value, e.g. -11..-1 on a C920)
wincamcfg set --camera 0 --property Exposure --value -5

# Same idea for autofocus
wincamcfg set --camera 0 --property Focus --value Auto    # autofocus on
wincamcfg set --camera 0 --property Focus --value 0       # autofocus off, fixed focus

The current mode is shown in square brackets by get, e.g. Exposure: -5 [Manual] or Exposure: -6 [Auto]. Only properties that advertise Auto support will show a mode tag.

Reset to defaults

Restore factory settings:

# Reset a specific property to default
wincamcfg set --camera 0 --property Brightness --default

# Reset ALL properties on a camera to defaults
wincamcfg set --camera 0 --property all --default

# Reset ALL cameras to factory defaults
wincamcfg set --camera all --property all --default

Available properties

  • PowerlineFrequency - Fix flickering (Disabled, 50Hz, 60Hz, Auto)
  • Brightness - Adjust brightness levels
  • Contrast - Adjust contrast levels
  • Hue - Adjust colour hue
  • Saturation - Adjust colour saturation
  • Sharpness - Adjust image sharpness
  • Gamma - Adjust gamma correction
  • WhiteBalance - White balance (Auto or manual value)
  • BacklightCompensation - Backlight compensation (On/Off)
  • Gain - Gain/ISO control
  • colourEnable - Enable/disable colour (On/Off)

Use wincamcfg get --camera 0 to see which properties your specific camera supports.

Automation and scripting

Use --output json for machine-readable output:

# PowerShell example: Configure all cameras on startup
wincamcfg set --camera all --property PowerlineFrequency --value 50Hz --output json

Drop this into a startup script or GPO if you need every machine on a fleet to land on the same camera config.

Requirements

  • Windows (uses DirectShow APIs)
  • Rust 2024 edition or later (for building from source)

Release verification

Every release ships with build-provenance attestations for wincamcfg.exe and the SPDX/CycloneDX SBOMs, generated by GitHub Actions. They prove the artifact was built from the tagged commit and not swapped out afterwards.

Verify with the GitHub CLI:

gh attestation verify wincamcfg.exe --repo andrewj-t/wincamcfg
gh attestation verify sbom.spdx.json --repo andrewj-t/wincamcfg
gh attestation verify sbom.cyclonedx.json --repo andrewj-t/wincamcfg

A successful verification ties the binary to the GitHub Actions run that produced it, the git tag that triggered the run, and the workflow file as it existed at that commit.

See the GitHub attestations documentation for details.

Code signing

The release binary is not code-signed. Code-signing certificates aren't free and this is a side project. If your organization requires signed binaries, you can sign with signtool using your internal CA's certificate.

Troubleshooting

Having issues? Check out the Troubleshooting Guide for debug logging instructions and common solutions.

License

MIT. See LICENSE.

Contributing

Bug reports and PRs welcome. For bugs, please include a reproduction case: camera model, the exact command you ran, and a trace log if you can get one. TROUBLESHOOTING.md covers how to capture the log.

About

A command-line utility for managing webcam configuration on Windows

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages