15

I can successfully change the value of the setting I want with v4l2-ctl --set-ctrl=exposure_auto_priority=1 but I want to know how to make that the default setting, the default is 0, which leaves my webcam black, I need it to be default=1

2
  • We need a little more detail please. What are you using to make these settings? What OS are you running? What version of skype are you using? These details help us to provide more detailed answers for you... "Always try to give as much and many details as you can" thank you. Sep 24, 2013 at 21:08
  • v4l2ucp (Video4Linux Control Panel) Ubuntu 13.04, latest deb of skype, acer aspire V3-571G. I already got my answer though but thank you for the tip
    – Lemagex
    Sep 27, 2013 at 6:22

4 Answers 4

21

You can also use the udev subsystem to establish the settings when the device is plugged in or the machine boots.

For example, here is how I set the power line frequency on my Logitech HD Pro C920 Webcam, which lsusb says has the USB ID 046d:082d.

As root create a new world-readable file /etc/udev/rules.d/99-local-webcam.rules. It contains:

SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="082d", PROGRAM="/usr/bin/v4l2-ctl --set-ctrl power_line_frequency=1 --device /dev/%k"

You can follow the same recipe, modifying the USB ID and the v4l2-ctl parameters to suit your exact needs. You can test the v4l2-ctl parameters from the command line until you are comfortable that they will work, then put that text into the udev rules file.

The advantage of this approach is that it "just works". Every time the device is plugged in then the settings are applied. If you are a systems administrator for a lot of machines then you can push out rules files for all your institution's equipment, they aren't used until that USB ID is plugged into the machine.

1
  • If you wish to set the line frequency on any and all cameras, you can edit the rule to: SUBSYSTEM=="video4linux", PROGRAM="/usr/bin/v4l2-ctl --set-ctrl power_line_frequency=1 --device /dev/%k"
    – Jon
    Jun 17, 2021 at 10:01
11

Since the settings will be lost after each boot, you should run a script at session startup to apply values you generate using the Video4Linux Panel.

To see the adjusted values type on terminal:

v4l2-ctl --all

After create your script, and add it to your startup session...

Here is my startup script:

#!/bin/bash
v4l2-ctl \
--set-ctrl=brightness=150 \
--set-ctrl=contrast=51 \
--set-ctrl=saturation=32 \
--set-ctrl=white_balance_temperature_auto=0 \
--set-ctrl=gain=90 \
--set-ctrl=power_line_frequency=1 \
--set-ctrl=white_balance_temperature=1140 \
--set-ctrl=sharpness=24 \
--set-ctrl=backlight_compensation=1 \
--set-ctrl=exposure_auto=1 \
--set-ctrl=exposure_absolute=870 \
--set-ctrl=exposure_auto_priority=1

I hope that this helps...

7
+50

If you have Video4Linux Control Pannel, you might try un checking the Exposure_Auto_Priority check box at the bottom and see if that helps...

enter image description here

Hope it helps... Good Luck!

0
0

This not exactly what you ask for, but you can easily adapt ti to set your favored default values. This returns everything to factory default values.

device="/dev/video2"
function all_default() {
    while read this_train
        do
            parameter=$( sed -rn 's/^ *([^ ]*) .*/\1/p;'            <<< $this_train)
            default=$( sed -rn "s/^.* default=([^ ]*) ?.*/\1/p;"    <<< $this_train)
            echo v4l2-ctl -d $device --set-ctrl=$parameter=$default
            v4l2-ctl -d $device --set-ctrl=$parameter=$default
        done <<< $(v4l2-ctl -d $device --list-ctrls | sed -r "/:/!d;")
    echo "Chattanooga choo choo, won't you choo-choo me home..."
    echo "The setting does not seem to be permanent until you play:"
    echo "https://www.bitchute.com/video/fgvFDTeeXzsb/"
    echo "A strange bug... :-)"
}
all_default

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .