Huge amount of error logs when camera doesn't return framerate

dsales

New Member
Hello,

I have 4 webcams connected to obs under linux (Fedora). When the application starts, a huge amount of errors start to appear related to two of the cameras (Xbox camera connected using the kinect driver and a VGA usb webcam). They are used for secondary footage, but the logs start appearing when OBS is initialized, even if the cameras are not being used, but set in at least one scene. This started happening when I moved from Fedora 32 with OBS 26.1.0 to F34 with OBS 27.0.0.

The cameras work correctly, but the error messages are logged at a rate of several thousands per second, and can create a log of several GB in a few minutes. These are the errors:

Code:
v4l2-input: /dev/video1: select timed out
v4l2-input: /dev/video1: failed to log status
v4l2-input: /dev/video8: select timed out
v4l2-input: /dev/video8: failed to log status
...

The initial configuration shows that those 2 cameras display a negative timeout:

Code:
07:55:56 PM.835: v4l2-input: Start capture from /dev/video1
07:55:56 PM.835: v4l2-input: Input: 0
07:55:56 PM.835: v4l2-input: Resolution: 640x480
07:55:56 PM.835: v4l2-input: Pixelformat: BGR3
07:55:56 PM.835: v4l2-input: Linesize: 1920 Bytes
07:55:56 PM.835: v4l2-input: Framerate: -nan fps
07:55:56 PM.836: v4l2-input: /dev/video1: select timeout set to -9223372036854775808us (5x frame periods)
07:55:56 PM.836: v4l2-input: Start capture from /dev/video2
07:55:56 PM.932: v4l2-input: Input: 0
07:55:56 PM.933: v4l2-input: Resolution: 640x360
07:55:56 PM.933: v4l2-input: Pixelformat: YUYV
07:55:56 PM.933: v4l2-input: Linesize: 1280 Bytes
07:55:56 PM.933: v4l2-input: Framerate: 30.00 fps
07:55:56 PM.933: v4l2-input: /dev/video2: select timeout set to 166666us (5x frame periods)
07:55:56 PM.933: v4l2-input: Start capture from /dev/video6
07:55:56 PM.989: v4l2-input: Input: 0
07:55:56 PM.990: v4l2-input: Resolution: 1920x1080
07:55:56 PM.990: v4l2-input: Pixelformat: BGR3
07:55:56 PM.990: v4l2-input: Linesize: 5760 Bytes
07:55:56 PM.990: v4l2-input: Framerate: 30.00 fps
07:55:56 PM.991: v4l2-input: /dev/video6: select timeout set to 166666us (5x frame periods)
07:55:56 PM.999: v4l2-input: Start capture from /dev/video8
07:55:57 PM.000: v4l2-input: Input: 0
07:55:57 PM.000: v4l2-input: Resolution: 1280x1024
07:55:57 PM.000: v4l2-input: Pixelformat: YU12
07:55:57 PM.000: v4l2-input: Linesize: 1280 Bytes
07:55:57 PM.000: v4l2-input: Framerate: -nan fps
07:55:57 PM.001: v4l2-input: /dev/video8: select timeout set to -9223372036854775808us (5x frame periods)

I guess the problem is because v4l doesn't return the framerate for those cameras

Code:
> v4l2-ctl -d /dev/video1 --get-parm
Streaming Parameters Video Capture:
    Frames per second: invalid (0/0)
    Read buffers     : 2

> v4l2-ctl -d /dev/video8 --get-parm
Streaming Parameters Video Capture:
    Frames per second: invalid (0/0)
    Read buffers     : 2

Basically, it seems that cameras not being able to return the framerate makes a NAN appear as the number used for the timeout limit in this piece of code in v4l2-input.c :

Code:
/* Get framerate and calculate appropriate select timeout value. */
        v4l2_unpack_tuple(&fps_num, &fps_denom, data->framerate);

        ffps = (float)fps_denom / fps_num;

Setting the fps manually before starting OBS seems to be allowed, but it doesn't help with the errors

Code:
> v4l2-ctl -d /dev/video1 -p 30
Frame rate set to 30.000 fps
> v4l2-ctl -d /dev/video8 -p 30
Frame rate set to 30.000 fps

I temporarily fixed the problem by forcing the value with 30fps if the call to v4l2_ioctl(dev, VIDIOC_G_PARM, &par) doesn't respond with the appropriate framerate.

Does anyone know about a simpler method to do this, which doesn't involve modifying the OBS sources preferably?

Thanks in advance.
 
Top