Fine tuning a c920 (or any UVC capable camera) for Octoprint streaming. Turning off Autofocus. Using manual focus. Adjust contrast, etc.
Note: When you get around to adjusting your controls, watch your stream to see the results and dial it in how you desire. Write down your values and then you can then use them in an autostart script so the settings are restored upon reboot of the system. See here: Octoprint Autostart Script
Install uvcdynctrl
pi@octopi:~ $ sudo apt-get install uvcdynctrl
>enter password<
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
libwebcam0 uvcdynctrl-data
(......etc....)
Look at Help
pi@octopi:~ $ uvcdynctrl -h
uvcdynctrl 0.2.4
pi@octopi:~ $ uvcdynctrl -h
uvcdynctrl 0.2.4
Manage dynamic controls in uvcvideo
Usage: uvcdynctrl [OPTIONS]… [VALUES]…
-h, --help Print help and exit
-V, --version Print version and exit
-l, --list List available cameras
-i, --import=filename Import dynamic controls from an XML file
-a, --addctrl=vid Import dynamic controls for vid from default location
-v, --verbose Enable verbose output (default=off)
-d, --device=devicename Specify the device to use (default=`video0')
-c, --clist List available controls
-g, --get=control Retrieve the current control value
-G, --get_raw=unit_id:selector Retrieve the current raw control value
-s, --set=control Set a new control value
(For negative values: -s 'My Control' -- -42)
-S, --set_raw=unit_id:selector Set the current raw control value
(value is a hex string of control size,
default is little endian- '(BE)' prefix to change:
-S 13:1 0x01100c or -S 13:1 '(BE)0x0c1001' )
-f, --formats List available frame formats
-W, --save=filename Save device controls state to a file
-L, --load=filename Load device controls state from a file
Save Defaults to file b4 changing things
pi@octopi:~ $ uvcdynctrl --save=c920defaults.txt
Look at available controls
pi@octopi:~ $ uvcdynctrl -c
Listing available controls for device video0:
Brightness
Contrast
Saturation
White Balance Temperature, Auto
Gain
Power Line Frequency
White Balance Temperature
Sharpness
Backlight Compensation
Exposure, Auto
Exposure (Absolute)
Exposure, Auto Priority
Pan (Absolute)
Tilt (Absolute)
Focus (absolute)
Focus, Auto
Zoom, Absolute
Check the value of a control
pi@octopi:~ $ uvcdynctrl -g 'Focus, Auto'
1
Smart to check values before changing them.
pi@octopi:~ $ uvcdynctrl -g Sharpness
128
Change the value of a control
E.G. To turn auto focus off:
pi@octopi:~ $ uvcdynctrl -s 'Focus, Auto' 0
E.G. To manually focus (range 0-8999..or something):
pi@octopi:~ $ uvcdynctrl -s 'Focus (absolute)' 24
E.G. To change sharpness:
pi@octopi:~ $ uvcdynctrl -s Sharpness 150
Write your settings to file
pi@octopi:~ $ uvcdynctrl --save=c920custom.txt
Load your settings from file
pi@octopi:~ $ uvcdynctrl --load=c920custom.txt