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.
 

RAMChYLD

New Member
Still no solution to this issue?

I just bought a Avermedia PW513 Live Streamer Cam. Camera works fine on Cheese, guvcview, etc. But on OBS I'm getting this issue along with the camera lights flashing.

This isn't good. I paid a lot of money for the camera after a lot of deliberation because the motherboard is a X570 chipset which has issues with high-load USB2 devices like webcams and even hard drives randomly dropping and resetting while under heavy load. I got tired of my webcam spontaneously resetting itself anywhere from none to 5 times a stream and paid for a USB3 camera just to work around this problem, and now I find that it specifically can't work with OBS why?
 

RAMChYLD

New Member
Still no solution to this issue?

I just bought a Avermedia PW513 Live Streamer Cam. Camera works fine on Cheese, guvcview, etc. But on OBS I'm getting this issue along with the camera lights flashing.

This isn't good. I paid a lot of money for the camera after a lot of deliberation because the motherboard is a X570 chipset which has issues with high-load USB2 devices like webcams and even hard drives randomly dropping and resetting while under heavy load. I got tired of my webcam spontaneously resetting itself anywhere from none to 5 times a stream and paid for a USB3 camera just to work around this problem, and now I find that it specifically can't work with OBS why?
Nevermind. For some reason hitting "Defaults" a few times got it to behave. We'll see how it goes from here.
 

jack.herbert

New Member
I had exactly this problem using a kinect camera as a webcam. The error log would quickly fill up my hard drive and even tho everything still worked fine, I couldn't take screenshots or save files whilst giving remote lessons.
The simplest solution would be an option in OBS to not log errors, but since that doesn't exist I tried a whole bunch of stuff. At first I removed writing permissions for the ~/.config/obs-studio/log folder, that worked but then I realised that the ~/.xsession-errors file was also filling up with the same error. I sym-linked that file to /dev/null but my hard drive was still filling up, and I never managed to find out how/where, even with the help of iotop and lsof.
By the end, opening the source properties of my kinect camera in OBS and manually setting the framerate from 'Leave unchanged' to '30fps' made the error go away. Hope that helps someone (who like me doesn't fancy compiling OBS from source).
 
Top