Webcam Zoom/Autofocus/Rotate


fiddling around with a Logitech C920 webcam i wanted to have some possibility to change the camera's zoom and focus remotely by bash/ssh shell. And this is really cool and easy when having the correct hardware. Now i am able to do this by some scripts.

I came up with this small feature request for some button implementation on the Repetier Server frontend because in web frontend it would be much smarter.
#get modes of camera
v4l2-ctl -d /dev/video0 --list-ctrls
brightness (int) : min=0 max=255 step=1 default=128 value=128
contrast (int) : min=0 max=255 step=1 default=128 value=128
saturation (int) : min=0 max=255 step=1 default=128 value=128
white_balance_temperature_auto (bool) : default=1 value=1
gain (int) : min=0 max=255 step=1 default=0 value=255
power_line_frequency (menu) : min=0 max=2 default=2 value=2
white_balance_temperature (int) : min=2000 max=6500 step=1 default=4000 value=2645 flags=inactive
sharpness (int) : min=0 max=255 step=1 default=128 value=128
backlight_compensation (int) : min=0 max=1 step=1 default=0 value=0
exposure_auto (menu) : min=0 max=3 default=3 value=3
exposure_absolute (int) : min=3 max=2047 step=1 default=250 value=666 flags=inactive
exposure_auto_priority (bool) : default=0 value=1
pan_absolute (int) : min=-36000 max=36000 step=3600 default=0 value=0
tilt_absolute (int) : min=-36000 max=36000 step=3600 default=0 value=0
focus_absolute (int) : min=0 max=250 step=5 default=0 value=0 flags=inactive
focus_auto (bool) : default=1 value=1
zoom_absolute (int) : min=100 max=500 step=1 default=100 value=100

#get specific value only
v4l2-ctl -d /dev/video0 --get-ctrl=zoom_absolute
zoom_absolute: 100

#set new values
v4l2-ctl -d /dev/video0 --set-ctrl=focus_auto=0
v4l2-ctl -d /dev/video0 --set-ctrl=focus_absolute=150
v4l2-ctl -d /dev/video0 --set-ctrl=zoom_absolute=100
I think by reading out the values from video4linux tools it should be possible to add extra functionality buttons in Repetier regarding to the feature set of the selected webcam.

regards, Mario


  • I see what you mean - main problem I see is that we just have static/dynamic url as parameter for the webcam.

    There is a special solution for linux with the image that can execute some scripts and return in a known format. But there is no stored link to the assigned url plus it is a special solution only working in this case and not for ip webcams, windows, mac.

    But I still like the idea to have them changeable. I already thought about a third url to proxy to an iframe. mjpg_streamer already has a webpage to change values. But the better point would be to make the changes permanent. So maybe the proper solution would be to allow in the configuration to change not only resolution, frequency  but also these settings and then the mjpg start script would assign them on startup. Or add that stuff to global configuration and make an extra panel for the case that we have this mjpg streamer solution. Might be even better since it is not dependent on an assigned printer anyway.
    Will put it on my todo, just can't say which release. Should not be too difficult.
  • Hi, thanks for the feedback. Yeah i catch the point that there are too many products and tools available to rule them all. Just came up with the idea because the existings scripts already make use of video4linux. So by getting the modifyable capabilities of the camera they also could be persisted in configuration for mpjeg_streamer solution in Repetier

    regards, Mario
  • Already have some ideas to solve it. E.g. extra folder with names like port names and that would be scripts run on connect to restore last settings. Plus said Setting module if we have mjpg_support detected.
Sign In or Register to comment.