Skip to content

bug: libobs: Video Delay (Async) over 2 s breaks up the source's audio (upstream obsproject/obs-studio#13830) #521

Closed

Description

@rdoupe

Upstream OBS bug, reported by simoncos in obsproject/obs-studio#13830 (OBS 32.2.2, Windows): with a Video Delay (Async) filter of 4 s or more on a Media Source, the recorded audio turns into loud broadband grain (the noise floor rises from about -54 dB to about -10 dB); at 0 and 2 s it is clean. The reporter measured it with a synthetic clip (testsrc2 + 1 kHz sine) at several delays and published the scripts. It is still open upstream, and the code is the same in this fork.

Location

  • libobs/obs-source.c source_output_audio_data(): the diff > MAX_TS_VAR branch on the audio's system time (next_audio_sys_ts_min) resets the source's timing to the system clock (reset_audio_timing()).
  • libobs/obs-source.c obs_source_update_async_video() sets the same timing (timing_adjust = video_time - frame->timestamp) from every frame it shows.
  • plugins/obs-filters/async-delay-filter.c hands frames on late with their original timestamps and leaves the audio to libobs ("the audio subsystem will automatically sync audio to video frames").

The Media Source stamps its frames and audio from when it was created, not with the system clock, so libobs places its audio by the timing of the frame being shown. With the filter, that timing moves by the delay once the first delayed frame is shown, and the audio is delayed with the video. Below 2 s the audio follows. Above MAX_TS_VAR (2 s), the audio path takes the move for a timestamp jump and resets the timing to the system clock; the next frame sets it back. From then on every packet or two lands by the other timing, for as long as the filter is on.

Class

Audio corruption (no crash). Recordings, streams and monitoring all get the broken audio.

How it is reached

  • Add a Media Source with audio (local file or stream), add the Video Delay (Async) filter, and set the delay above 2 s. Over obs-websocket: CreateInput (ffmpeg_source), CreateSourceFilter (async_delay_filter, delay_ms), StartRecord.
  • Raising the delay of a running filter by more than 2 s at once (for example 2000 ms to 4000 ms is fine, 4000 ms to 8000 ms breaks).
  • Any async source with audio whose timestamps are not the system clock.

Reproduced in the current release

AppImage 33.0.0-beta6-799 (Rust libobs), headless over obs-websocket: a Media Source looping a 1 kHz tone clip (testsrc2 + sine, as in the report), the filter set through CreateSourceFilter / SetSourceFilterSettings, then a 20 s recording (x264 + AAC, mkv). Each recording was checked for breaks in the tone (a sample a 1 kHz sine cannot reach from the two before it) and for its level outside the tone:

Delay Breaks in 19 s Level outside the tone, relative to the tone
0 ms 0 -42.7 dB
2000 ms 0 -42.7 dB
4000 ms, raised from 2000 ms 0 -42.7 dB
8000 ms, raised from 4000 ms 523 -13.4 dB
4000 ms, set before playback 525 -14.4 dB

The breaks come every 1024 or 2048 samples, one or two audio packets.

Proposed fix and failing test

Fix: in source_output_audio_data(), reset the timing only when the audio's own timestamps jumped. When the packet continued the previous one seamlessly (it was smoothed onto it), only the video timing moved, and the audio is placed by it, as for moves below 2 s. The audio is then continuous and delayed with the video.

RED test (cmocka, test_async_delay_audio). It registers a source like the Media Source (30 fps frames and audio packets stamped from when it started), puts it on the program behind the real async_delay_filter under a private display, and checks the mixed audio libobs hands to outputs:

  • 1 kHz tone, 3 s and 5 s delay: no breaks in the tone;
  • clicks, 3 s delay: each click is heard 3 s after it was captured, with the video;
  • guards: 1 s delay (tone and clicks), and no filter.

The first three fail today in both libobs lanes (40 to 105 breaks in 4 s; the clicks are not delayed at all).

Activity

  1. rdoupe commented on Oct 13, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_async_delay_audio (3 of 6 failing): a Media Source-like source behind the real Video Delay (Async) filter; the mixed tone breaks up at 3 s and 5 s, and clicks are not delayed with the video.
    2. GREEN: source_output_audio_data() resets the audio timing only when the audio's own timestamps jumped, so the audio follows the delayed video's timing above 2 s as it does below.
      PR today.
  2. rdoupe commented on Oct 13, 2026

    @rdoupe
    CollaboratorAuthor

    @simoncos you reported this in obsproject/obs-studio#13830 (a Video Delay (Async) filter of 4 s or more on a Media Source turns the recorded audio into loud grain, while 0 and 2 s are clean), so a heads-up: it's fixed here in obs-rust by #522, with a regression test.

    Cause: libobs places a Media Source's audio by the timing of the video frame being shown, and the filter moves that timing by the delay. Up to 2 s the audio followed the move. Past 2 s, libobs treated each audio packet as a timing jump and reset the source's audio timing to the system clock, then the next shown frame moved it back, over and over, which broke the audio into the fragments you heard. Now the timing is only reset when the audio itself jumps, so it follows a video delay of any size, as it already did below 2 s (with the same one-time silence for the length of the delay when the filter kicks in). In the current obs-rust release a 4000 ms delay gave 525 breaks in 19 s of recorded tone; the regression test, which measures the same thing, is clean with the fix.

    Workaround on stock OBS: keep the Video Delay (Async) at 2000 ms or less, or delay the whole output instead (Settings > Advanced > Stream Delay) if that fits your setup.

    It will be in the next obs-rust daily release after 0.1.0-beta.20261012: https://github.com/obs-rust/obs-studio/releases (Windows, macOS and Linux builds; on Arch it's obs-studio-rust-git in the AUR). obs-rust is an AI-assisted fork of OBS.

    If you get a chance to try it, a reply here on whether your 4 s delay records cleanly would really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions