Bug Report Audio lag in OBS-redux Linux

JPL

Member
I got OBS-redux successfully building in Linux (Ubuntu 14.04 64-bit) and was able to stream to twitch with it - the two most recent videos are on http://www.twitch.tv/jplebreton if that helps - but audio seems to lag the video by a second or two. Nothing special about my audio setup, I use the sound chip on my motherboard which goes through PulseAudio by way of ALSA. No problems or (noticeable) latency playing games or any similar applications.

I've run into this before streaming with the more primitive "invoke FFmpeg from the command line" approach, and an unreliable fix was to use the -itsoffset switch to specify a time offset to mix the audio and video together(?). However the needed offset varies each time, and it's a big pain to try out multiple values, see if the final stream output lags then restart.

I'm not sure what the source of the latency is, I hear people complain about PulseAudio being a persistent source of latency but who knows. This is the one issue keeping OBS-redux from being a really solid option for twitch streaming, even in its early state. It's progressing rapidly!
 

leonhard

Developer
Currently the capture plugin uses the timestamps provided by pulse as a default. The problem here (and with other capturing software) seems to be that there is some kind of desync when starting the capture. You can try a different option for retrieving timestamps (and thus syncing) by using the following steps:
  • Remove all audio captures in the settings dialog
  • Add a "Pulse Audio Output Capture" to the current scene
  • Click the properties for the source and activate "Use OS Timestamps"
This option is probably going to be the default pretty soon.
 

JPL

Member
Currently the capture plugin uses the timestamps provided by pulse as a default. The problem here (and with other capturing software) seems to be that there is some kind of desync when starting the capture. You can try a different option for retrieving timestamps (and thus syncing) by using the following steps:
  • Remove all audio captures in the settings dialog
  • Add a "Pulse Audio Output Capture" to the current scene
  • Click the properties for the source and activate "Use OS Timestamps"
This option is probably going to be the default pretty soon.

Hmm, I tried this and the lag persists... maybe it's a bit better? Probably less than 1 full second but still noticeable.
 

leonhard

Developer
In that case it might be a different issue. We will take a look at it but i'm afraid i can't give you any ETA on this.
 

JPL

Member
In that case it might be a different issue. We will take a look at it but i'm afraid i can't give you any ETA on this.

Hmm, I tried last night with latest and didn't seem to get any audio lag! I'll file a bug or update here if I see the issue again. Thanks!
 

JPL

Member
Investigating this problem a bit more with the latest build... I tried some test streams and saw the usual (0.5-1s) of audio lag, and then rebooted and saw none. It had been a while since I'd rebooted, so I honestly don't know what I might have done in the previous session that caused the audio to start lagging. Seems kind of horrifying to investigate. Maybe the "OS timestamps" get increasingly off the longer a session has been running? I'm happy to provide additional testing if it would help.

Speaking of which, when I built latest (again in Ubuntu 14.04 64-bit) I didn't see the "OS timestamps" option for audio sources... does this mean it's now the invisible default? Just curious.
 

leonhard

Developer
I'm sorry, i should have posted here to inform you about the change. The OS timestamp option is indeed now the only and therefore default option to get the timestamps. It still corrects that time with the reported latency from pulseaudio though.
If you still have desyncs with the latest master, reports are welcome, preferably with a link to the log-file (see "Help" Menu).
 

Nisengo

New Member
I still have this issue with the master from the 14th of august (latest ubuntu package).
It only occurs when I set the default audio inputs in settings.
If I add my microphone and headphones or speakers as scene-specific inputs the lag becomes almost unnoticable.

Below is my logfile from a recording session (wasn't streaming) where the lag occurs. I doubt that it's very useful, but just to be certain...
https://gist.github.com/anonymous/e59db294b158613c829d
 
i don't ever experience desync issues when using ssr (simplescreenrecorder) but he still hasn't incorporated the ability to create scenes, to add a webcam and other great features that obs has. have you checked out his code for keeping the audio in sync?
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Those notes do not pertain to pulseaudio issues. We will eventually figure out what the problem is, but as it seems to happen randomly right now it's quite difficult to debug.
 

NoXPhasma

Member
I found out that this issue seems to be related to the output source in OBS. I installed JACK and used both sources on one JACK sink. When I send the audio through the input source everything is sync. When I send the same audio source through audio output it's desync.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Could you specify the way to make this issue to be more likely to occur? I want to try to replicate but I have a hard time trying.

We know it's in the output audio capture (pulse) somewhere.
 

NoXPhasma

Member
Just to explain what I've done with JACK:

I use now JACK with a PulseAudio JACK Sink and a Pulseaudio JACK Souce, and there I can send every in/output of my System to any other JACK device I want. So I used all audio I want in my stream and send that to the JACK Pulseaudio output and the same data to the JACK Pulseaudio Sink. Thats for the basic.

I have now 2 JACK devices in Pulseaudio with the exact same data, one will be recognised as input device (Pulseaudio JACK Souce), the other as playback device (PulseAudio JACK Sink) in OBS (and every other program). When I send the audio through "Audio Output Capture" plugin, the sound is async, when I send it through the "Audio Input Capture" plugin, the exact same audio is sync.

I have attached a screenshot of the connections I use in JACK.

I'm not sure if this is still a PulseAudio problem or just a problem in the "Audio Output Capture" plugin of OBS.
 

Attachments

  • Patchage-1.png
    Patchage-1.png
    63.5 KB · Views: 185
Last edited:

leonhard

Developer
I'm not sure if this is still a PulseAudio problem or just a problem in the "Audio Output Capture" plugin of OBS.

The Input/Output Capture is actually the same, the only difference being which devices are listed. So if there is a difference in the two options it should be either in jack or pulse. My guess would be that pulse somehow calculates/reports a different latency depending on whether the source is an "Input" or "Output".
 

Lucki

New Member
I also get this issue. As already mentioned here, it works fine with the SimpleScreeRecorder.
After problems with pulseaudio after long capture times, i switched to jack and never got any problems anymore.
Now i tried this obs-studio and get heavy audio lag with livestreams.

Edit: There was an update today and now i get these warnings:
(or i didn't noticed them before)
Code:
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
 
Last edited:
how is this bug progressing? last night i streamed and the viewers said the desktop audio was off by more than 2 seconds. that's pretty bad. I ended up turning the desktop audio slider to zero and then creating 2 loopbacks and a null sink and then added the null sink as a pulseaudio output capture source and that seemed to make the audio almost sync'd but not perfect.
 
Top