Windows DirectShow UVC camera control library with C++, Python, and CLI interfaces
duvc-ctl provides direct control over DirectShow API for UVC cameras on Windows programatically. Control PTZ operations, exposure, focus, brightness, and other camera properties without any additional drivers or vendor SDKs from programs with plain code without any hacky ways!
- Multi-Language Support: Native C/C++ API, Python bindings, and CLI tool (others coming soon!)
- Comprehensive Control: PTZ operations, camera properties (exposure, focus, iris), video properties (brightness, contrast, saturation)
- UVC Standard: Works with any UVC-compliant camera
- Vendor Extensions: Support for vendor-specific properties (Logitech, etc.)
- Ease of use: Easy to get started with and run compared to direct COM access for devices or protocols like VISCA, ONVIF, etc...
Python:
pip install duvc-ctl
C/C++:
# vcpkg (coming soon)
vcpkg install duvc-ctl
# Or build from source
git clone https://github.com/allanhanan/duvc-ctl.git
cd duvc-ctl
cmake -B build -S .
cmake --build build --config Release
Python:
import duvc_ctl as duvc
# List available cameras
devices = duvc.list_devices()
camera = devices
# Set camera properties
camera.set_camera_property(duvc.CamProp.EXPOSURE, value=100, mode=duvc.CamMode.MANUAL)
camera.set_camera_property(duvc.CamProp.ZOOM, value=200, mode=duvc.CamMode.MANUAL)
# Get property ranges
range_info = camera.get_camera_property_range(duvc.CamProp.ZOOM)
print(f"Zoom: {range_info.min} to {range_info.max}, step: {range_info.step}")
C++:
\#include "duvc-ctl/duvc.hpp"
int main() {
auto devices = duvc::list_devices();
auto\& camera = devices;
// Set manual exposure
camera.set_camera_property(duvc::CamProp::EXPOSURE, 100, duvc::CamMode::MANUAL);
// Use connection for efficiency
auto conn = camera.create_connection();
conn.set_camera_property(duvc::CamProp::ZOOM, 200);
conn.set_camera_property(duvc::CamProp::FOCUS, 150);
return 0;
}
CLI:
# List devices
duvc-ctl list
# Get camera property
duvc-ctl get --device 0 --property exposure
# Set property
duvc-ctl set --device 0 --property zoom --value 200 --mode manual
# Center PTZ camera
duvc-ctl set --device 0 --property pan --value 0
duvc-ctl set --device 0 --property tilt --value 0
- Automated Testing: Control camera settings programmatically for consistent test environments
- Live Streaming: Adjust camera parameters during broadcasts without manual intervention
- Computer Vision: Set optimal camera properties for CV pipelines (disable auto-exposure, set fixed focus, etc.)
- Multi-Camera Systems: Synchronize settings across multiple cameras
- Remote Control: Control PTZ cameras without VISCA or IP protocols
- OS: Windows 8/10/11
- Cameras: Any UVC-compliant USB camera
- Languages: C, C++ (17+), Python (3.8+)
- Architectures: x86_64
- Rust bindings
- vcpkg package
- winget package
- Node.js bindings
- Go bindings
- Chocolatey package
- Connection pooling with thread safety improvements
- Linux support (v4l2 backend)
- macOS support (AVFoundation backend)
- Extended vendor property database
# Clone repository
git clone https://github.com/allanhanan/duvc-ctl.git
cd duvc-ctl
# Configure with CMake
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
# Build
cmake --build build --config Release
- CMake 3.15+
- Visual Studio 2019+ or compatible C++17 compiler
- Python 3.8+ (for Python bindings)
- pybind11 (bundled as submodule)
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
Do Refer CONTRIBUTING.md before contributing!
All Changes Must Include:
- Unit Tests: For isolated component functionality
- Integration Tests: For real device interaction (if applicable)
- Documentation: Update README and code comments
- Error Handling: Comprehensive error cases
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki (coming soon)
- Examples: examples/ directory
MIT License - see LICENSE for complete details.
Summary: You can use, modify, and distribute this library freely, including in commercial projects, with attribution.
- Built on Windows DirectShow API
- Inspired by the lack of a Windows equivalent to Linux's v4l2-ctl and inablility to change camera parameters easily through python/ other languages
