Opencv read USB camera select timeout problem


Raspberry pie 4B or 3B + with two USB drive free cameras

When the camera is facing the light, it will report time out

The camera doesn’t turn to the light


Not enough power

Facing the light may trigger the exposure compensation of the USB camera, resulting in higher power


Using hub with additional power supply

There is a select timeout error when calling the camera under Linux. It may be that the power supply capability of the port is insufficient when the camera (especially USB2.0 camera) is plugged into the 2.0 interface. If other problems have not been solved, you can see if there is a problem with this port

The last parameter of the select function in v4l2 is timeout, which is used to set the timeout. After the timeout is set, if no file descriptor is available for monitoring, select will wait for the timeout. If the timeout is exceeded, select will return an error

When you encounter a select timeout error, you can’t just consider increasing the timeout time. In fact, this is a temporary solution rather than a permanent solution. It’s impossible to increase the timeout too much. It’s useless to increase the timeout a little. There must be other problems such as transmission blocking. This problem has been bothering us for a long time. Later, I wonder if the port of the USB 2.0 camera is not working. I replaced a 3.0 interface computer, and this problem never happened again. I asked the camera manufacturer about this problem. Their answer is that the transmission and power supply of the USB2.0 camera are integrated, so they are not very stable. When the data transmission and power supply may affect each other, I don’t know about the impact of this, but this issue might as well be used as an additional inspection idea

For reference, Logitech c270 (resolution 720p) needs about 0.2A under the working state. A single USB 2.0 interface is generally conservatively designed with a current of 0.5A and USB 3.0 1a, so it’s no problem to drag two single ports for minimum protection. If your camera is equipped with night vision, the night power will soar. This should be analyzed according to the actual situation, However, this situation can also be solved by USB hub with power supply port

Connecting four cameras is not a big problem, auxiliary power supply head + charger can be done

Similar Posts: