The Usage of dGPU (Nvidia) Freezes My Webcam While Recording/Streming (I Beg For Help)

Quajal

New Member
Hello, I have a bit of a long story, and I'll try to keep it as short as possible. I've visited every forum, tried every setting, I'm exhausted, exhausted, and I want to cry. Please help me.

First, let me share my system information: I'm using CachyOS. I'm using an MSI laptop. I have an Intel processor, an Intel iGPU, and a Nvidia dGPU.

I stream and sometimes record videos.

First, during my recordings and streaming, the webcam always worked normally and without any problems at first, but after a short while, it would start to experience glitches. Screen tearing and gray lines would appear on the webcam. After these lines and tearing continued for a few minutes, the webcam would suddenly freeze and stop streaming.

The following error codes appeared in the terminal:

[mjpeg @ 0x55c4c2242e00] EOI missing, emulating
[mjpeg @ 0x55c4c2242e00] mjpeg_decode_dc: bad vlc: 0:0 (0x55c4c4756188)
[mjpeg @ 0x55c4c2242e00] error dc
[mjpeg @ 0x55c4c2242e00] error y=105 x=2
[mjpeg @ 0x55c4c2242e00] mjpeg_decode_dc: bad vlc: 0:0 (0x55c4c4756188)
[mjpeg @ 0x55c4c2242e00] error dc
[mjpeg @ 0x55c4c2242e00] error y=23 x=97
error: v4l2-input: decoder: failed to send frame to codec
error: v4l2-input: failed to unpack jpeg or h264
info: v4l2-input: /dev/video4: Stopped capture after 10057 frames

I haven't been able to resolve this issue. No matter what I do, it doesn't work.

In my research, some users reported that the MJPEG codec is causing the issue. For this reason, I tried using BGR3 (Emulated) as the webcam codec to see if I'd experience the same issue again, but the issue hasn't been resolved. But the error code just changed:

info: [pipewire] Stream 0x55863a32fd70 state: “streaming” (error: none)

warning: Creating a popup with a parent, QWidgetWindow(0x558635d013d0, name=“OBSBasicWindow”) which does not match the current topmost grabbing popup, QWidgetWindow(0x55863a3585c0, name=“QMenuClassWindow”) With some shell surface protocols, this is not allowed. The wayland QPA plugin is currently handling it by setting the parent to the topmost grabbing popup. Note, however, that this may cause positioning errors and popups closing unexpectedly. Please fix the transient parent of the popup.
error: v4l2-input: /dev/video4: select timed out
error: v4l2-input: /dev/video4: failed to log status
error: v4l2-input: /dev/video4: select timed out
error: v4l2-input: /dev/video4: failed to log status
error: v4l2-input: /dev/video4: select timed out
error: v4l2-input: /dev/video4: failed to log status
...

I also used different webcams, tested them in Windows, and tried different USB ports, all with the same error and the same results.

Unable to resolve this error, I went and bought a high-quality USB dock. I thought maybe the bandwidth on the webcam wasn't sufficient for data transfer.

Buying a high-quality USB dock didn't fix the error, but my error codes changed again. The glitches were gone, but the webcam still worked fine at first, but soon started to lag and then suddenly froze.

When I used MJPEG as the codec, I saw this error code:

[mjpeg @ 0x5621dd03e600] Found EOI before any SOF, ignoring
[mjpeg @ 0x5621dd03e600] No JPEG data found in image

I repeated the previous solution and tried recording again using BGR3 (Emulated). I was trying to see if the problem would reoccur this way.

The problem persisted even with BGR3 (Emulated). This time, the error code I saw in the terminal was different:

error: v4l2-input: /dev/video4: select timed out
error: v4l2-input: /dev/video4: failed to log status

Together, I strongly believe that this problem with the webcam is related to the Nvidia GPU. Even if I launch a lightweight indie game, my webcam quickly transitions to glitches, lags, and then freezes. I can even use my laptop's Nvidia GPU for an hour or two without any lag or freezing, depending on the situation.

I find that recording with the processor reduces the frequency of these lags and freezes. When recording with Nvidia encoders, the onset of this lag and the eventual freezing of the webcam occur much faster. But naturally, I want to be able to use my Nvidia encoders as well.

I haven't found a solution to this, and I'm mentally exhausted.

Here's a summary of the solutions I've tried:
-Trying different webcams
-Trying the same webcam on the same laptop in Windows (I'm dual booting)
-Reinstalling CachyOS
-Trying all USB ports individually
-Trying all the recording codecs the webcam offers
-Trying all the FPS options the webcam offers
-Trying the Flatpak version of OBS
-Trying lower resolutions the webcam offers

None of them worked.
Please help me.
 
Top