Skip to content

Add A/V sync logging behind compile time switch #1462

Merged
BitRate27 merged 8 commits into
DistroAV:masterfrom
BitRate27:syncdebug
Jun 17, 2026
Merged

Add A/V sync logging behind compile time switch #1462
BitRate27 merged 8 commits into
DistroAV:masterfrom
BitRate27:syncdebug

Conversation

@BitRate27

@BitRate27 BitRate27 commented May 20, 2026

Copy link
Copy Markdown
Contributor

To use this code, in the new file "src/obs-support/sync-debug.h", uncomment the following line:

//#define SYNC_DEBUG 1

If SYNC_DEBUG is not defined, nothing new happens in the code.

When SYNC_DEBUG is defined, --distroav-debug set when starting OBS, and a NDI source containing SyncTestSend frames, then the following lines will be sent to the obs log file:

15:24:49.951: [distroav] Sync A/V   AT:   1779287087944 AW:   999 AC:   1 VT:   1779287087944 VW:   999 VC:   1 Delta:     0 OBS <- ndi_source_thread [Normal]
15:24:49.952: [distroav] Sync A/V   AT:   1779287087944 AW:   999 AC:   1 VT:   1779287087935 VW:   999 VC:   1 Delta:    -8 NDI <- ndi_filter [SourceFilterNormal]
15:24:49.952: [distroav] Sync Audio AT:   1779287087944 AW:   999 AC:   1 VT: --------------- VW: ----- VC: --- Delta: ----- NDI <- ndi_filter [AudioOnlySource]
15:24:49.973: [distroav] Sync Video AT: --------------- AW: ----- AC: --- VT:   1779287087939 VW:   999 VC:   1 Delta: ----- NDI <- ndi_filter [SceneFilter]
15:24:49.977: [distroav] Sync Video AT: --------------- AW: ----- AC: --- VT:       251122871 VW:   999 VC:   1 Delta: ----- NDI <- ndi_output [Preview]
15:24:50.016: [distroav] Sync A/V   AT:       251122827 AW:  1000 AC:   1 VT:       251122861 VW:  1000 VC:   1 Delta:    33 NDI <- ndi_output [Main]

Usage

  1. Uncomment the #define SYNC_DEBUG 1 line in sync-debug.h
  2. Build DistroAV and install in OBS
  3. Start OBS with --distroav-debug
  4. Acquire a Sync Test Data Sender (ask @BitRate27 for access to binary)
  5. Start the Sync Test Data Sender (locally or on your network)
  6. Add a NDI source and select Sync Test Data Sender
  7. Open current log file to find log entries (above) of when the sync data frames are received

Fields in log
Sync A/V - Audio and Video found
Sync Audio - Only Audio data found
Sync Video - Only Video data found
AT - Time audio sync data found (ms)
AW - Width of audio sync data (ms)
AC - Count of audio sync data
VT - Time video sync data found (ms)
VW - Width of video sync data (ms)
VC - Count of video sync data
Delta - Difference between AT and VT in ms
OBS <- *** - Instrumentation point in DistroAV where a/v data sent to OBS
NDI <- *** - Instrumentation point in DistroAV where a/v data sent to NDI

Sync Test Data Description
The Sync Test Data is a NDI stream of white and black frames. White frames are sent for 1 second and black frames for 3 seconds. A sine wave audio signal exists in the audio channels of the NDI stream when a video frame is white. No audio data (0.0f) is sent when the video frame is black. The SYNC DEBUG code looks for this specific cases of black to white and 0.0f to not 0.0f to flag the start of a sync test data.

This PR is requested to be included in the master to help with the development of future solutions to A/V sync problems. The logs can help quantify instances of A/V becoming out of sync, and help identify points where audio becomes out-of-sync with the video. Including in the master will make it so developers will not have to keep merging the sync-debug code as DistroAV master branch develops.

@BitRate27 BitRate27 mentioned this pull request May 20, 2026

@paulpv paulpv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation for this flag, what it is and how to use it.

Comment thread src/sync-debug.cpp
Comment thread src/obs-support/sync-debug.h Outdated
Comment thread src/ndi-filter.cpp
@BitRate27

Copy link
Copy Markdown
Contributor Author

Add documentation for this flag, what it is and how to use it.

I added more details on how to use this in the initial PR description. I also added description of the log file columns and info on what a sync test data source is and how to get it (private repo right now).

@Trouffman

Copy link
Copy Markdown
Collaborator

The usage should also be added in the Wiki (dev segment).
I'm fine with it to be on master.

Comment thread src/sync-debug.h Outdated
@BitRate27
BitRate27 merged commit 1280d10 into DistroAV:master Jun 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants