V4L2 change default setting?

28,824

Solution 1

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!

Solution 2

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.

Solution 3

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...

Share:
28,824

Related videos on Youtube

Lemagex
Author by

Lemagex

Hobbies: Anime, Manga, Drumming, Technical support (Especially networking and software), JRPGs. Contact me: | XDA | Steam | Twitter | Google+ | 24/7 Android / Ubuntu / Windows / Network tech support for *free*

Updated on September 18, 2022

Comments

  • Lemagex
    Lemagex over 1 year

    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

    • SoCalDiegoRob
      SoCalDiegoRob over 10 years
      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.
    • Lemagex
      Lemagex over 10 years
      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
  • Jon
    Jon almost 3 years
    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"