USB camera options - new camera stack

For anybody struggling with USB camera options and syntax for the usb.conf files the following may be helpful.

first up I have a logitech C922 webcam and the suggested http://octopi.local/webcam/option browser returned just "no key or value passed" I did not see any list of options below this.

I could see many options exposed via octopi.local/webcam/control and using the start webrtc button on that page, adjustments could be seen in real time but as expected the settings changed here were not saved.

I was struggling with getting the camera to default to 50Hz power line frequency and my incorrect syntax was causing an error in my log and ignoring any other OPTIONS within the usb-default,conf file.

Having SSH into octopi via putty and issue the following command
v4l2-ctl -d /dev/video0 --list-ctrls

I was able to get the following output

`User Controls

                 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_automatic 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=6500 step=1 default=4000 value=4000 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=0 value=0

Camera Controls

              auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
     exposure_time_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=250 value=250 flags=inactive
 exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1
               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=250 step=5 default=0 value=40
 focus_automatic_continuous 0x009a090c (bool)   : default=1 value=0
              zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100`

This gave me the correct format for the OPTIONS i was trying to set and my usb conf file ends up like this -

### Options for USB based cameras

# The port on which the webcam server for the camera should listen on. If you have only
# one camera, leave at 8080. If you have more, change to 8081, 8082, etc. The primary
# camera will be considered the one with 8080.
PORT=8080

# The path to the camera device. Leave as is if you are using no or only one USB camera.
DEVICE=/dev/v4l/by-id/usb-*-video-index0

# The image format of the camera.
FORMAT=YUYV

# The resolution to set on the camera. Defaults to 1280x720.
WIDTH=1920
HEIGHT=1080

# The framerate to set on the camera. Defaults to 15fps.
FRAMERATE=30

# Additional options.
OPTIONS='--camera-options="power_line_frequency=1" --camera-options="focus_automatic_continuous=0" --camera-options="focus_absolute=40" --camera-options="zoom_absolute=220"'

2 Likes

Noice.

Can you please set the last section to Preformatet text for better reading?

1 Like

I just learned this yesterday on the discord, but something changed upstream with camera streamer. The URL is now http://octopi.local/webcam/control as you already figured out.

We've also seen people mention better performance with USB cameras setting this option to MJPEG.

I haven't checked, but its likely that looking at my particular camera control options I can replace

--camera-options="Afmode=0" --camera-options="LensPosition=40" 

with the single command

 --camera-options="focus_absolute=40"

focus_absolute should both disable the autofocus and set the Lens Position.

So "focus_absolute" did not work.

The lesson here is keep looking for and trying different syntax if your struggling to get your options for usb cameras

So on checking I still had the syntax wrong for my Logitech USB camera. which after a reboot defaulted back to autofocus!

The proper 100% working options for me are as follows -

# Additional options.
OPTIONS='--camera-options="power_line_frequency=1" --camera-options="focus_automatic_continuous=0" --camera-options="focus_absolute=40" --camera-options="zoom_absolute=160"'

In order to see options available for different cameras try the following commands via ssh

List supported video formats and resolutions of default video device
v4l2-ctl --list-formats-ext
and
List all video device's controls and their values:
v4l2-ctl --list-ctrls

Duncan, Thanks so much for this post. I could not get any help when I asked how to get a list of options for my Logitech C920, but your command 4l2-ctl -d /dev/video0 --list-ctrls worked perfectly. I appreciate you stepping through your learning process to get the options set where you wanted. I can't get zoom to work yet (it worked fine with the old camara stack), but I can live with it.