# OBS NDI (audio) delay issue



## Xciles (Jul 20, 2020)

Hi all.

We are currently facing a strange audio delay (or out of sync) issue that requires some help after trying out various scenarios. I duo stream with my girlfriend on one channel and mainly use NDI to send both of our PCs sources to a network server which encodes and sends to Twitch.

Setup:
PC - v         (NDI)
    Server    (Encoding -> Twitch)
PC - ^         (NDI)

Both PCs have 4 NDI sources: 2 Video (Main Display capture 1080p (rendered down from 1440p native), Webcam capture 720p) and 2 Audio (Desktop Audio and Microphone). All sources are sent to the server which does the rest and combines additional shared scenes. We get no (or almost no) rendering issues or other dropped frames using this setup.

Splitting everything into different sources should have, as other topics described, resulted into everything being synced properly. For some reason, this is not the case using our setup.

All 3 PCs are rather beefy and (should) have no issues regarding CPU or GPU limitations and are connected with a proper router on a gigabit network. Both source PCs are using 10%-ish CPU and 15/20% GPU and are sending roughly 120/160mbits of data. The server receives roughly 250/350mbits of data, uses 20%-ish CPU and 25/30%-ish GPU. We connect to the server using remote desktop with hardware graphics adapter enabled for remote sessions (which should resolve other rendering issues), however connecting without Remote Desktop and using a monitor with mouse and keyboard does result in the same issues.

In the below scenarios we tried all different sync methods, Internal, Network and Source Timing, which still results into the audio being de-synced. Some scenarios de-sync more and faster than others.

What we tried so far (and resulted in audio being de-synced (after a while >1 hour and faster <1 hour): 

4 NDI Sources per PC and using different sync methods. 
The above scenario, 4 sources: 2 vid, 2 audio.
We tried this setup using OBS 25.* and NDI 4.8 or 4.9.
In this scenario all sources have a different delay. OBS NDI 4.9 makes the problem worse and increases the delay at a faster rate.

2 NDI Sources per PC and using different sync methods. 
The above scenario, using 2 sources instead of 4. We combined the audio-only sources into the corresponding video sources:
Desktop capture with desktop audio source.
Webcam with microphone source. 

This results in a -somewhat- workable solution. The audio and video within the combination source are synced correctly, but there is still a delay between the two combination sources (i.e. (webcam+mic) is a full second ahead of (desktop+audio)).
Using OBS NDI 4.9 results into the audio streams, within 1 NDI Source, being delayed again as well. (we do not have this issue with the 4.8 version)


We also tried to decrease the desktop video size (from 1440p to 1080p), because we thought the server could not handle this amount of data. This had no noticeable impact. We could reduce the encoded size even more (from 1440p to 720p for example) however I do not think this will make a difference. I could try if suggested.

Testing with one PC (sending data to the server using NDI) will result in the same issue.

We tried a lot of setups and a lot of potential fixes, but currently ran into a dead end with no idea what to do next. 

Any help would be appreciated!

PS: 
Demo of issue: https://clips.twitch.tv/SmokyLovelyPotUWot
Link to logs on gist: https://gist.github.com/Xciles/e7d5c03b68f7cc30c2008d0636eecf21


----------



## Advansys (Sep 9, 2020)

You've probably seen this video, but just in case: https://www.youtube.com/watch?v=o8S14v_jDVo


----------



## Xciles (Sep 9, 2020)

Yeah I unfortunately have seen that video. 

Tried splitting all sources but to no avail :(

So far the best option is sending 2 streams, Webcam + Mic and Desktop + Audio. This results in the audio no longer desyncing within the NDI stream, however both streams are descyned unfortunately. 

Thanks for thinking along though! :)


----------



## Advansys (Sep 10, 2020)

Thanks for the update, although sorry to hear you cannot get a complete resolution. So many variables to contend with!


----------



## redfrog (Oct 18, 2020)

Hi,
I'm having similar issue with a very simple configuration.
PC A : running OBS with NDI plugin both latest version.
PC B : running NDI Studio Monitor latest version
No problem with PC or network performance.
In OBS there a 12 scenes with about 20 different sources (5 NDI, browser, images, texts, and MP4 videos.
For testing purpose I created a scene having a single source : MP4 video.
NDI main output is enabled.
NDI Studio Monitor on the PC B is connected to the NDI main output stream of PC A.
Many often  the audio received by NDI SM on PC B is delayed reaching about 1s delay.
The delay is not static, it may change. Sometimes (lucky) there is no delay but most times it is really visible.
Of course the audio in the MP4 video is insync...
I found a direct relation between the delay and the audio buffering value reported in OBS logs.
In the log file there are lines similar to the following
adding xxx milliseconds of audio buffering, total audio buffering is now xxx milliseconds (source: xxxx)
The total audio buffering can reach (is limited to) 1s.
This is the source of the desync in NDI output.
... but I am still searching a way to fix the NDI desync ...
Any idea will be appreciated


----------



## redfrog (Oct 19, 2020)

Found explanations of this issue here https://github.com/Palakis/obs-ndi/issues/60


----------



## Alankaj (May 12, 2022)

Hi. Decision - https://www.youtube.com/watch?v=o8S14v_jDVo


----------

