Sample Header Ad - 728x90

Webcam's power line frequency setting does not take effect if a new application that uses it is open

2 votes
0 answers
471 views
I am living in Europe and I have bought a Logitech C920 webcam whose power line frequency setting should be changed to 50Hz in order to avoid flickering. I did it using the following instruction:
/usr/bin/v4l2-ctl --d /dev/video0 --set-ctrl power_line_frequency=1
That worked properly and I even tried to make it persistent using udevadm rules:
SUBSYSTEM=="video4linux", KERNEL=="video[0-9]*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08e5", RUN+="/usr/bin/v4l2-ctl -d $devnode --set-ctrl=power_line_frequency=1"
That also seemed to work since v4l2-ctl -d /dev/video0 --list-ctrls gives the following output after rebooting system or after plug out - in the webcam usb:
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 (50 Hz)
      white_balance_temperature 0x0098091a (int)    : min=2800 max=7500 step=1 default=5000 value=5000 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
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
              exposure_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=156 value=156 flags=inactive
         exposure_auto_priority 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=1 default=0 value=0 flags=inactive
                     focus_auto 0x009a090c (bool)   : default=1 value=1
                  zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100
As you can see, power_line_frequency setting is set to value 1 (50Hz), which is correct. However, if I start an application that uses the webcam like Skype, Zoom or Discord and I see the webcam output video, it is still flickering (although value of power_line_frequency is still 1). However, it is fixed if I execute again /usr/bin/v4l2-ctl --d /dev/video0 --set-ctrl power_line_frequency=1 or even sudo udevadm trigger to run udevadm rule manually. Does anyone know why could this be happening or how could it be fixed? PD: I am using Ubuntu 22.04 with Kernel 5.15.0-56. Thank you so much in advance.
Asked by Roberto Fernández Iglesias (21 rep)
Dec 30, 2022, 03:26 PM