Webcam Shows a Black Screen in Linux
Ever since doing a clean install of Arch Linux, I have been having some troubles with my webcam randomly deciding to have a pitch black video feed. Sometimes I would show up normally on it, but on other times not even a shade of a shape was to be seen and the image was completly dark. I am using a Logitech Quickcam E 3500, but after looking around a bit for my issue, I have been led to believe that I am by far not the only one with this black screen issue. In fact, a lot of people seemed to experience some sort of issue, but the answers they were given came in two categories.
The first category of answers was mostly useless, they specified it had to do with auto exposure and that you had to turn it off, but did not deem it important to specify how to turn it off. The second category did delve into specifics, but their answers seemed, to me, outdated and involved a tool that was not in my repositories from a website that has since died. To be precise, it had to do with the UVC drivers and tools, but those have since merged into the Linux kernel and the tools must have been renamed or merged into something else as well, I would think.
Mostly by accident, I stumbled upon what I needed in the terminal. As far as I am aware, I did not purposefully install this program at any point, so chances are you can just use it. Otherwise, you are probably best off searching your distribution’s repositories for the correct package.
So open up a terminal and let us going
v4l2-ctl -l
This should spew out a list of options each specifying min, max, steps, default
and current values. The ones that always made sure your video was black, were
the ones involved with exposure. More precisely, the option exposure_auto
is
likely set to 3, which equals to it being turned on. Often this is the way you
want it, but in our case it is overcompensating for whatever reason and ends up
putting the exposure too low. To turn this automatic exposure off, issue
v4l2-ctl --set-ctrl=exposure_auto=1
Now that it is turned off, there is still the need to actually change the amount of exposure to use. As far as I could tell, there is no catch-all value for this so you might just have to experiment a bit till you find something to your liking. For example, to set it exposure on value 166, you use
v4l2-ctl --set-ctrl=exposure_absolute=166
then try out your webcam and see how it goes. It allows pretty high values, but the only ones I have had to use so far were in the 0-200s so go a bit at random there.
I know this solution is not perfect, you will have to redo it every time the issue comes up again. The solution also came mostly through trial and error, so there is the likeliness I have missed some obvious answers. Sadly, the information available online was scarce, so this had to do. Regardless, seeing anything is already a vast improvement.