obsproject / obsproject/obs-studio

Media Source with SRT stream has lagging audio sometimes when incoming stream is a bit slower than realtime

Open
#12,724 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
76.4k
Forks
10.2k
Avg merge
4d 23h
Merged PRs (30d)
12

Description

Operating System Info

Other

Other OS

Flatpak on Arch Linux, but all Linux OSes can reproduce

OBS Studio Version

32.0.0

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/BeOFcqru1h4xsytR

OBS Studio Crash Log URL

No response

Expected Behavior

Audio playing smoothly as in other players

Current Behavior

Audio lags significantly, becomes choppy, stuttering and won't recover unless restart media source

Steps to Reproduce
  1. First setup a srt server (or use existing one)
    minimum working example is to start server by docker: docker run --rm -it -p 127.0.0.1:1935:9771/udp laurfb/srt-live-server:latest . This will accept input at srt://127.0.0.1:1935?streamid=input/live/test and output at srt://127.0.0.1:1935?streamid=output/live/test
  2. Start streaming using FFMpeg and aac codec and make output speed a bit slower (this can be achieved by using software encoder and -re option): ffmpeg -re -i ./big_buck_bunny_1080p_h264.mov -c:v libx264 -c:a aac -f mpegts -ac 2 "srt://127.0.0.1:1935?streamid=input/live/test" .
    (I used https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_h264.mov for reference)
Image You can see the speed is a bit slower. But this is a problem because OBS output also has this problem and directly playing the stream won't have such issues as well.
  1. Setup media source in OBS srt://127.0.0.1:1935?streamid=output/live/test . Changing network buffer doesn't help. Also setup an empty scene to switch between.

  2. Switching between two scenes and audio will become lagging sometimes.

Within example recording of the above procedure, the lag occurs at the beginning and the end

Anything else we should know?

This might be an issue with video and audio out of sync. Because the stream's speed is slower than real time. But other players can play the stream normally, and OBS can also play correctly sometimes. Also with incoming stream from another OBS instance on relatively decent hardware, the issue can also be reproduced. There is no frame dropping shown.

This is reproduced only on Linux, and on a range of different hardware. I didn't test on Windows.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided Docker SRT server, FFmpeg command, OBS Media Source, and Linux setup, then review the linked OBS log and example recording. The fix is complete when slower-than-realtime SRT input plays smooth audio without accumulating lag, stuttering, or requiring a media-source restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, docker, linux
Domain
audio-video-rtc, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.