21

Can you control things like viewing angle, zoom, fps, and video resolution for a webcam connected to Ubuntu, through a standard set of commands or API?

As a case in point, the Logitech Brio 4K Ultra HD. This camera seems to be advertised to allow adjustments of those properties that I just mentioned above, and I am wondering whether controlling them is accessible via any standard linux command-line (or standard programming API).

Typically I had good experience with all Logitech devices in Ubuntu but these features I've never experienced adjusting from/in Ubuntu.

Motivation note: I could use these features for acquiring indoors imagery for a machine learning project and the ability to adjust those properties could be important. That aside, these abilities might bear on how much all the sophistication built into this device actually leverages for quality in more mundane use cases like video chat.

matanster
  • 2,294
  • 9
  • 36
  • 54

5 Answers5

22

You can customize a lot of settings using guvcview.

enter image description here

Install with:

sudo apt install guvcview

To select which webcam to use, click in the Video tab, then select your device (Brio). In the confirm dialog, select to Restart.

Unfortunately it miss angle setting.

Rael Gugelmin Cunha
  • 6,745
  • 2
  • 34
  • 35
  • 1
    I guess that controlling the viewing angle, which I think you mention too, is more complicated to enable in software, as both this tool and the one from my answer do not seem to handle it. I wonder what might be the reason. Maybe that aspect (angle) is somehow less standardized at the hardware interface level? – matanster Aug 08 '20 at 15:24
  • 3
    The only way I found to customize angle was install Logitech software in Windows virtualbox, then share the Brio with the virtual machine. – Rael Gugelmin Cunha Dec 03 '20 at 13:05
  • 1
    Does one require a license for intermittently running Windows in VirtualBox for stuff like this? – matanster Jan 11 '21 at 18:54
  • 3
    @matanster: if your purpose is just to tweak this or evaluate any other software, you can use the Microsoft official testing virtual machine images: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/ – Rael Gugelmin Cunha Jan 11 '21 at 21:18
  • I would say it's borderline for this use case at best. The license there says: "You may use the software in the virtual hard disk image only to demonstrate and internally evaluate it." As the software being referred to is likely Windows itself. – matanster Jan 12 '21 at 08:50
  • 2
    Worth noting that the "Image controls" section here persists into other controls after you close guvcview. The "video controls" and "audio controls" do not. I just tested this with Cheese and Zoom. If I lowered the brightness all the way down in guvcview and exited then launched Cheese/Zoom, then the change was easily noticed. – Elijah Lynn Jan 14 '21 at 17:40
  • Can't undo my upvote, but this software is hella buggy. Figured out there's `v4l-utils ` which works like charm – Ufos Oct 23 '21 at 16:15
  • @Ufos maybe some hardware conflict or something like that? I use `guvcview` in a daily basis and it works like a charm. Any way, it's good to know there is another option. – Rael Gugelmin Cunha Oct 23 '21 at 17:49
6

According to https://help.ubuntu.com/community/Webcam, one should consult the supported devices list in http://www.ideasonboard.org/uvc/, the main vehicle for webcam customization in Ubuntu. The model I have mentioned in this question isn't (currently) there, but many other Logitech models are.

Here's one account of the compatibility of the Logitech Brio too (see the Q&A in the comments trail there). Looks like most of the above is adjustable from Ubuntu to judge by that, although I have not tried myself.

I believe however that fps and resolution are selected by the application using the camera (maybe on the video acquisition API / protocol used by each application) and likely not set as a global configuration for the device. If that's not the case please do post a correction comment!

In general, fiddling camera settings is enabled via the v4l2 CLI, which you can use to inquire and change the camera's settings even while it is in use. See for example here. Here's my output from v4l2-ctl -l for this camera:

brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                               contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
                             saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128
         white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                                   gain 0x00980913 (int)    : min=0 max=255 step=1 default=0 value=0
                   power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=1
              white_balance_temperature 0x0098091a (int)    : min=2000 max=7500 step=10 default=4000 value=5210 flags=inactive
                              sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=128 value=128
                 backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=1 value=1
                          exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
                      exposure_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=250 value=312 flags=inactive
                 exposure_auto_priority 0x009a0903 (bool)   : default=0 value=0
                           pan_absolute 0x009a0908 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                          tilt_absolute 0x009a0909 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                         focus_absolute 0x009a090a (int)    : min=0 max=255 step=5 default=0 value=20 flags=inactive
                             focus_auto 0x009a090c (bool)   : default=1 value=1

                      zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100

I can confirm that zoom, auto-focus (on/off) and focus can be set via this utility, but other properties may require using a lower-level utility from the v4l2 suite, or are not supported by this model.

matanster
  • 2,294
  • 9
  • 36
  • 54
  • 1
    Looks like field of view (viewing angle) cannot be managed using the v4l2-ctl utility. It's not mentioned in [the v4l2 spec](https://linuxtv.org/downloads/legacy/video4linux/API/V4L2_API/spec-single/v4l2.html) either. – matanster Jul 30 '20 at 06:52
  • Interesting. It's not supported yet `v4l2-ctl` manages everything but FoV. Surely it's just not included in the API, but could be managed as well – Ufos Oct 23 '21 at 16:43
  • 2
    For the FoV there's a weird solution: configure it on windows (dual boot, different device) and then use as is. https://github.com/opencv/opencv/issues/12498#issuecomment-723043094 – Ufos Oct 23 '21 at 16:50
5

I have the exact same model and run ubuntu 20.04

  • guvcview kinda works, but lags and crashes
  • v4l-utils does everything you need, but you need to use it from the terminal. gtk-v4l on github provides a GUI if you need it.

Install

sudo apt install v4l-utils

Find you webcam

you might have multiple. Also, for some reason, it may list two devices per camera, pick first.

v4l2-ctl --list-devices

The output should be something like

HD User Facing: HD User Facing (usb-0000:05:00.3-1):
    /dev/video1
    /dev/video2

BRIO 4K Stream Edition (usb-0000:05:00.3-4):
    /dev/video3
    /dev/video4

Tweak

Get Controls

Let's see what we can control

v4l2-ctl -d /dev/videoX --list-ctrls  # X -- for your device number

The output should be something like

                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
...
                     focus_auto 0x009a090c (bool)   : default=1 value=1
                  zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100

Example: change angle to look down

v4l2-ctl --device /dev/video3 --set-ctrl=tilt_absolute=36000

This works when tweaking zoom/skype, but in the ubuntu testing utility "cheese" some settings take no effect.

Ufos
  • 399
  • 4
  • 10
  • this works for me, but I can't see the settings take effect in any video app. I also tried using v4l2ucp, but I can't get the preview to work. – gannex Mar 03 '23 at 09:16
4

I've found the Flatpak version of cameractrls more fully featured, and easy to install.

enter image description here

Crucially, it has FoV support for Logitech Brio webcams

2

Update: other control options added, if like me you were looking for these. enter image description here

Amos Folarin
  • 1,124
  • 8
  • 10