Video gradually falling behind audio... where can I start investigating?

jbrains

New Member
Hi, folks. I've been using OBS Studio for years and I love it, but I've noticed a problem in the last few weeks (maybe 2 months?) and I would like your help in devising next steps for how to investigate.

No, I haven't found anything in a log file to help yet. Either there is no helpful log information or I don't yet know how to recognize it. Certainly, I see nothing obvious so far.

When I use an external/USB web cam with OBS Studio, the video and audio become unsynchronized and the gap between video and audio increases over time. This means that I can't merely apply a fixed audio offset to fix the problem.

Worse, the video falls behind the audio at what seems like intermittently-growing and unpredictable amounts. At the very least, I haven't noticed a pattern.

If I restart OBS Studio, then video and audio become synchronized again... for a while. Sometimes I notice a sizable gap after 15 minutes, sometimes longer. I haven't been able yet to find a correlation between what I'm doing and how this gap grows. Sometimes I go 30-40 minutes and it seems fine.

How much is significant? Sometimes the video is behind my speaking voice by more than 1 full second. In my test today, it fell behind about 0.5 seconds after about 2 hours. (I haven't reached the point of trying to measure more precisely yet.) It certainly becomes noticeable quite often within 20 minutes.

I strongly believe that OBS Studio is involved in the problem, because I did a two-hour-long test with only the V4L2 Test Bench and video did not fall behind audio. This also happens when I use my external/USB webcam, but not when I use my internal webcam. (Or, at least, if it happens with my internal webcam, then the gap grows much much more gradually.) I have also tested this with both a Flatpak version and a native-installed version of OBS Studio, and I observe the behavior in both. I am not yet aware of when this problem began to occur, but I have at least used this external webcam and OBS Studio without observing this problem on Zoom and Google Meet meetings lasting well over an hour.

I'm mostly interested in two things:

- Wild hypotheses worth testing.
- Suggestions on what to try to rule out next and how.

Even so, I'm happy for any help you can offer. Of course, if you recognize this problem and have a strong idea what's going on and how to fix it, I'd love that.

I'm running Pop!_OS 22.04 on Linux kernel 6.12.10 with OBS Studio 31.0.4 Flatpak or OBS Studio 30.2.3 installed from the PPA Repository. My external webcam is an Anker PowerConf C200, which I've been using for well over a year. I'm running a System76 Lemur Pro 10.

What else can I tell you that might help?

Many thanks.
 

hurikhan77

New Member
Do you record audio directly from the ALSA device, or do you record everything from Pipewire? Different audio devices do not have perfectly identical clocks, OBS might not compensate for that. But pipewire should do that.
 

jbrains

New Member
Do you record audio directly from the ALSA device, or do you record everything from Pipewire? Different audio devices do not have perfectly identical clocks, OBS might not compensate for that. But pipewire should do that.
I'm capturing audio using a PulseAudio device and video using a V4L2 device, at least according to the names of the source types in OBS Studio. I can only trust those names; I don't know how to confirm what they're actually doing. I am doing things however I have been doing them for years, meaning since before Linux distributions began adopting PipeWire.

I see new options in OBS Studio 31.0.4 for capturing video through PipeWire, but I don't see the corresponding option for audio. I don't know enough about PipeWire to know how to do that.

To be clear, when I say that video is falling behind audio, I also mean that my video monitor (live echoing of the video signal) in OBS Studio is lagging behind and gradually lagging farther behind over time. (I raise my hand and the video preview in OBS Studio shows me raising my hand 0.5-1.0 second after.) If audio is also falling behind real time--and I suspect it isn't--then it's falling behind much more slowly. It also turns out that, when OBS Studio records both video and audio together, video is behind audio.

So even if we take audio out of the equation, the video camera is _increasingly_ falling behind real time, rather than maintaining a consistent lag that could be worked around with a fixed audio offset.
 
Top