Manual USB camera settings in Linux

28 Comments

There are many cheap UVC compatible cameras but only few of them support extensive manual control. Kurokesu C1 and Logitech C920 are couple of these good ones.

Let’s see what we have connected on USB port.

v4l2-ctl --list-devices
HD Pro Webcam C920 (usb-3f980000.usb-1.2):
        /dev/video2

292A-IPC-AR0330 (usb-3f980000.usb-1.4):
        /dev/video0
        /dev/video1

Note two interfaces for Kurokesu C1 camera – this is dual stream output. One video device is for regular output YUYV/MJPEG another is for H264.

Kurokesu C1

v4l2-ctl -d /dev/video0 --list-ctrls
                     brightness (int)    : min=-64 max=64 step=1 default=-8193 value=0
                       contrast (int)    : min=0 max=64 step=1 default=57343 value=32
                     saturation (int)    : min=0 max=128 step=1 default=57343 value=64
                            hue (int)    : min=-40 max=40 step=1 default=-8193 value=0
 white_balance_temperature_auto (bool)   : default=1 value=1
                          gamma (int)    : min=72 max=500 step=1 default=57343 value=100
                           gain (int)    : min=0 max=100 step=1 default=57343 value=0
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2800 max=6500 step=1 default=57343 value=4600 flags=inactive
                      sharpness (int)    : min=0 max=6 step=1 default=57343 value=3
         backlight_compensation (int)    : min=0 max=2 step=1 default=57343 value=1
                  exposure_auto (menu)   : min=0 max=3 default=0 value=3
              exposure_absolute (int)    : min=1 max=5000 step=1 default=156 value=5000 flags=inactive
         exposure_auto_priority (bool)   : default=0 value=0

Logitech C920

 v4l2-ctl -d /dev/video2 --list-ctrls
                     brightness (int)    : min=0 max=255 step=1 default=-8193 value=128
                       contrast (int)    : min=0 max=255 step=1 default=57343 value=128
                     saturation (int)    : min=0 max=255 step=1 default=57343 value=128
 white_balance_temperature_auto (bool)   : default=1 value=1
                           gain (int)    : min=0 max=255 step=1 default=57343 value=0
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2000 max=6500 step=1 default=57343 value=4000 flags=inactive
                      sharpness (int)    : min=0 max=255 step=1 default=57343 value=128
         backlight_compensation (int)    : min=0 max=1 step=1 default=57343 value=0
                  exposure_auto (menu)   : min=0 max=3 default=0 value=3
              exposure_absolute (int)    : min=3 max=2047 step=1 default=250 value=250 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=8189 value=0 flags=inactive
                     focus_auto (bool)   : default=1 value=1
                  zoom_absolute (int)    : min=100 max=500 step=1 default=57343 value=100

Logitech Brio 4K

Logitech BRIO (usb-0000:00:1a.0-1.1):
	/dev/video0

                     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=0
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2000 max=7500 step=10 default=4000 value=2770 flags=inactive
                      sharpness (int)    : min=0 max=255 step=1 default=128 value=128
         backlight_compensation (int)    : min=0 max=1 step=1 default=1 value=1
                  exposure_auto (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute (int)    : min=3 max=2047 step=1 default=250 value=625 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=255 step=5 default=0 value=20 flags=inactive
                     focus_auto (bool)   : default=1 value=1
                  zoom_absolute (int)    : min=100 max=500 step=1 default=100 value=100
                      led1_mode (menu)   : min=0 max=3 default=0 value=3
                 led1_frequency (int)    : min=0 max=255 step=1 default=0 value=0

Usage

In order to set value use command syntax like

v4l2-ctl --set-ctrl=gain=00
v4l2-ctl --set-ctrl=exposure_auto=1
v4l2-ctl --set-ctrl=exposure_absolute=10

Comments ( 28 )

  1. ReplyJoão Natividade
    Hi there! As I verified, this camera doesn't appear to have auto-focus. However, it has a particular spec named "focus_auto" which is bool and set to 1 by default. Can you tell me the meaning of this? Another question is related to camera resolution. I want the best resolution I can have with it. Can you tell me what is it? Thank you and have a nice afternoon.
    • Replysaulius
      Hi Joao, this feature is derived from similar camera which has auto-focus enabled hardware. It does not alter normal camera functionality. Camera has maximal resolution of 1920x1080 pixels and 30 fps max.
  2. Replystephan
    hi i purchased the AR0330 but try to work with it on OS X. for UVC cameras i have use this code so far: http://phoboslab.org/log/2009/07/uvc-camera-control-for-mac-os-x but i am only getting exposure control over the AR0330. is the a OS X equivalent to v4l2-ctl? thanks
    • Replysaulius
      Hi, have not tried advanced settings on OSX. Maybe there is newer version of UVCCameraControl library?
  3. Replypauledd
    Hi. do you have an explanation of this:? Logitech C920 brightness (int) : min=0 max=255 step=1 default=-8193 value=128 The range is from 0 to 255 but the default is completely out of the range with -8193? How can this be?
    • Replysaulius
      Hi, I guess this indicates auto mode (which is set by default).
      • Replysr
        Hi , Does Logitech C920 supports simultaneous multiple video streams ? if it supports we can use YUYV for preview and MJPEG/H264 compressed stream for streaming ? Please help me out
        • Replysaulius
          I think C920 does not support simultaneous streams, at least I don't know how to use this feature. -- BR, Saulius
  4. ReplyWolfie
    This may be stupid, but will the camera let me shoot single shots & record them into my PC; and at what maximal resolution? This must have been asked many times, even a standard reply gratefully accepted. I am an old geezer constantly mislaying documents, and want something really trivial to operate. And robust too.
    • Replysaulius
      Dear Wolfie, maximal Kurokesu C1 camera resolution is 1920x1080.
  5. ReplyEthan
    Hi, I used C922 webcam and try to use this command, v4l2-ctl --set-ctrl=exposure_auto=1 v4l2-ctl --set-ctrl=exposure_absolute=10 It is sometime work fine for me, but sometimes, there was an error when I try to set the exposure_absolute For example: :~$v4l2-ctl --set-ctrl=exposure_auto=1 ======>ok :~$v4l2-ctl --set-ctrl=exposure_absolute=10 ====>ok :~$v4l2-ctl --set-ctrl=exposure_absolute=7 =====>failure VIDIOC_S_EXT_CTRLS: failed: Input/output error exposure_absolute: Input/output error :~$v4l2-ctl --set-ctrl=exposure_absolute=7 =====>failure VIDIOC_S_EXT_CTRLS: failed: Input/output error exposure_absolute: Input/output error :~$v4l2-ctl --set-ctrl=exposure_absolute=7 =====>ok I don't know why.
    • Replysaulius
      Hi, I don't have working Linux distribution at the moment. Could you please try v4l2 commands --list-ctrls and --list-ctrls-menus and post output here?
  6. Replyignik
    Logitech BRIO (usb-0000:00:1a.0-1.1): /dev/video0 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=0 power_line_frequency (menu) : min=0 max=2 default=2 value=2 white_balance_temperature (int) : min=2000 max=7500 step=10 default=4000 value=2770 flags=inactive sharpness (int) : min=0 max=255 step=1 default=128 value=128 backlight_compensation (int) : min=0 max=1 step=1 default=1 value=1 exposure_auto (menu) : min=0 max=3 default=3 value=3 exposure_absolute (int) : min=3 max=2047 step=1 default=250 value=625 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=255 step=5 default=0 value=20 flags=inactive focus_auto (bool) : default=1 value=1 zoom_absolute (int) : min=100 max=500 step=1 default=100 value=100 led1_mode (menu) : min=0 max=3 default=0 value=3 led1_frequency (int) : min=0 max=255 step=1 default=0 value=0
    • Replysaulius
      Thank you! And apologize for wordpress comment formatter. Included your provided output to blog post.
  7. Replymulti.flexi
    Hi, is it possible to use BRIO at full resolution on Linux? What does v4l2-ctl --list-formats-ext or ffmpeg -f v4l2 -list_formats all -i /dev/video0 output please? I am considering BRIO for one of my projects but I read it is not yet supported well. Thanks.
    • Replysaulius
      Hi, will check later today and let you know results.
    • Replysaulius
      Oops. Don't have any Brio's left to test. Should have new ones in a week or two.
  8. ReplySamogitian
    I would also like to know if it's possible to record 4K with Logitech Brio. I'm on Ubuntu with kernel 4.14, currently can only do 1080p with VLC.
    • Replysaulius
      Hi, don't have Brio at the moment. Will test in a week or two.
  9. ReplySamogitian
    So I got the Brio and managed to record 4K@30fps on Ubuntu. Problem is, compared to all the demo videos on youtube my video looks very grainy, sort of like lots of white noise. I tried 1080p, but result is the same. I used mjpeg for 4K and yuyv422 (raw) for 1080p . Any ideas what could be the issue?
    • Replysaulius
      Hi, it would help a lot if you could share short video clip. For now one guess - maybe there is not enough light or camera is too hot?
    • ReplyZackF
      Hi, Sam. I'm having issues launching/capturing video stream from my BRIO camera on Ubunto using gstreamer (see command below). I also tried changing "format=" to YUYV and MJPG with no success. How were you able to capture video? gst-launch-1.0 v4l2src device=/dev/video1 ! "video/x-raw, width=640, height=480, format=(string)NV12" ! videoconvert ! xvimagesink
  10. ReplyjXs
    hellO, any news about the brio on ubuntu? Still grainyness problems? I'm thinking about purchasing this cam... Also I'd be curious about v4l2-ctl --list-formats-ext THNX
    • Replysaulius
      Hi, not sure about what grainyness you are talking of. But please check v4l2 formats-ext: https://gist.github.com/Lukse/27374af2153db369369a6e17450089bc and ctrls https://gist.github.com/Lukse/6ece58d85bcc4d511c824f197238e15d
  11. Replyericb
    Hello, Thanks a lot for sharing all the valuable information you posted there. If this can help, I'll test all the command lines you proposed, and provide you feedback if something interesting pops up. FYI, I'm using several models for testing purpose (C920, C922, + LifeCam C3000)***, and I was wondering whether an universal way (for portability purpose) exists to check all webcam parameters. Do you stiil sell modified C920 or C922 ? I'm seriously thinking to buy one, but maybe I'm late ... ***(for further information, see https://framagit.org/ericb/miniDart)
    • Replysaulius
      Hi Eric, glad to see your comments! Sure, for cameras feel free to check kurokesu e-store: https://www.kurokesu.com/shop/cameras
      • Replyericb
        Thanks a lot, I'll have a look asap (next week probably), and I'll create a project dedicated to Logitech webcams under Linux on github. It should be more easy to exchange information this way. Just in case you are interested, yet around Logitech Brio case, I proposed some changes in OpenCV (source code is 3.4.0), to use the hardware zoom (name "Zoom, Absolute") with the brio. It works perfectly and I got a 1.0 to 5.0 zoom with the Brio 4K, and a 1.0 to 2.0 with both C920 and C922. (kernel : 4.15.0-24 and above) For further information, please have a look at opencv issue #12498. Please notice it works on Windows, but maybe I didn't include everything. I'm unsure, because I'm cross-compiling the Windows version from Linux ;-) (direct link is : https://github.com/opencv/opencv/issues/12498 ) Thanks again for your great great work !
        • Replysaulius
          That is awesome! Thank you for submitting these changes. I have dome some interesting changes to dshow (Windows camera capture code) source is really outdated and causes lot of issues with some cameras.

Leave a reply

Your email address will not be published.