Skip to content

Audio crackle (xrun) in stream and recording #11083

Open

Description

@sfjuocekr

Operating System Info

Other

Other OS

Ubuntu 24.04

OBS Studio Version

30.2.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/uFQRTBBLSFg1hjPW

OBS Studio Crash Log URL

No response

Expected Behavior

There should be no difference in audio streams.

Current Behavior

Audio crackle in a single stream (GameSink).

Steps to Reproduce

  1. Start a recording
  2. Play a game
  3. Stop a recording
  4. Listen to the audio

Anything else we should know?

My guildies have been complaining about my game audio being a complete mess, I've been trying to find the cause for the problem over the past weeks and it is driving me nuts!

I have multiple audio streams, they are all taken from virtual sinks I have setup in pipewire and one of them (GameSink) has issues inside OBS only.

I can monitor the audio in OBS and there is no problem, you do not see it in the VU meter and it usually doesn't show up in recordings but it can... while on my stream the audio sounds like xruns (buffer underruns) ALL the time.

Finally I have found a probable cause, I noticed OBS not showing any of its input links in Carla which it normally does so I switched from PulseAudio (obs default) to a Jack sink and so far -fingers crossed- it hasn't crackled a single time!

I have setup PipeWire virtual sinks:

context.modules = [
   { name = libpipewire-module-loopback
     args = {
        node.description = "MicSolo"
        capture.props = {
           node.name = "MicSolo_capture"
           media.class = "Audio/Sink"
           audio.position = [ MONO ]
        }
        playback.props = {
           node.name = "MicSolo_playback"
           media.class = "Audio/Source"
           audio.position = [ MONO ]
        }
     }
   }
   { name = libpipewire-module-loopback
     args = {
        node.description = "MicVoice"
        capture.props = {
           node.name = "MicVoice_capture"
           media.class = "Audio/Sink"
           audio.position = [ MONO ]
        }
        playback.props = {
           node.name = "MicVoice_playback"
           media.class = "Audio/Source"
           audio.position = [ MONO ]
        }
     }
   }
   { name = libpipewire-module-loopback
     args = {
        node.description = "SideChainMusic"
        capture.props = {
           node.name = "SideChainMusic_capture"
           media.class = "Audio/Sink"
           audio.position = [ FL FR ]
        }
        playback.props = {
           node.name = "SideChainMusic_playback"
           media.class = "Audio/Source"
           audio.position = [ FL FR ]
        }
     }
   }
   { name = libpipewire-module-loopback
     args = {
        node.description = "MusicSink"
        capture.props = {
           node.name = "MusicSink_capture"
           media.class = "Audio/Sink"
           audio.position = [ FL FR ]
        }
        playback.props = {
           node.name = "MusicSink_playback"
           media.class = "Audio/Source"
           audio.position = [ FL FR ]
        }
     }
   }
   { name = libpipewire-module-loopback
     args = {
        node.description = "GameSink"
        capture.props = {
           node.name = "GameSink_capture"
           media.class = "Audio/Sink"
           audio.position = [ FL FR ]
        }
        playback.props = {
           node.name = "GameSink_playback"
           media.class = "Audio/Source"
           audio.position = [ FL FR ]
        }
     }
   }
   { name = libpipewire-module-loopback
     args = {
        node.description = "DiscordSink"
        capture.props = {
           node.name = "DiscordSink_capture"
           media.class = "Audio/Sink"
           audio.position = [ FL FR ]
        }
        playback.props = {
           node.name = "DiscordSink_playback"
           media.class = "Audio/Source"
           audio.position = [ FL FR ]
        }
     }
   }
   { name = libpipewire-module-loopback
     args = {
        node.description = "DefaultSink"
        capture.props = {
           node.name = "DefaultSink_capture"
           media.class = "Audio/Sink"
           audio.position = [ FL FR ]
        }
        playback.props = {
           node.name = "DefaultSink_playback"
           media.class = "Audio/Source"
           audio.position = [ FL FR ]
        }
     }
   }
]

I use Carla for audio processing using Jack, applications play on their respective virtual sinks and their audio goes into two mixers for audio separation between TV and headphone.

So OBS gets its game audio from the GameSink, that GameSink is also playing on my TV and my headphone so in my mind it should not crackle.

The weird thing is, it is ONLY the GameSink and NOTHING else in OBS that crackles.

At first I assumed it to be the buffer size, so I set a fixed quantum of 2048/48000 = 42.66666667ms to be on the absolute safe side...

Here is a recording with multiple audio tracks, the first track is the normal PulseAudio capture and the second is the Jack capture. As you can clearly see the first track is a complete $h17 show and the second track is perfectly fine: VIDEO

Why this happens? I have no clue, it shouldn't happen and it is especially weird that it happens to only the GameSink. Yes, I also tried deleting all the audio captures in OBS and even went to a completely stock setup... the result is always the same.

My profile settings:

[General]
Name=Kwakzalver420

[Video]
BaseCX=1920
BaseCY=1080
OutputCX=1920
OutputCY=1080
ScaleType=bilinear
ColorFormat=NV12
ColorSpace=sRGB
ColorRange=Partial
FPSCommon=60
FPSType=0
FPSInt=30
FPSNum=30
FPSDen=1
SdrWhiteLevel=300
HdrNominalPeakLevel=1000

[SimpleOutput]
VBitrate=6000
StreamEncoder=nvenc
RecEncoder=nvenc
RecQuality=Small
UseAdvanced=true
FilePath=/home/sjoer
RecFormat2=mkv
ABitrate=160
Preset=veryfast
NVENCPreset2=p5
RecRB=false
RecRBTime=20
RecRBSize=512
RecRBPrefix=Replay
StreamAudioEncoder=aac
RecAudioEncoder=aac
RecTracks=1

[Output]
Mode=Advanced
FilenameFormatting=%CCYY-%MM-%DD %hh-%mm-%ss
DelayEnable=true
DelaySec=60
DelayPreserve=true
Reconnect=true
RetryDelay=2
MaxRetries=25
BindIP=10.0.1.2
NewSocketLoopEnable=false
LowLatencyEnable=false
IPFamily=IPv4+IPv6

[AdvOut]
TrackIndex=1
RecType=Standard
RecTracks=60
FLVTrack=1
FFOutputToFile=true
FFFormat=
FFFormatMimeType=
FFVEncoderId=0
FFVEncoder=
FFAEncoderId=0
FFAEncoder=
FFAudioMixes=1
Encoder=jim_nvenc
RecRB=false
RecRBTime=600
Track3Bitrate=128
Track5Bitrate=128
Track1Name=Everything
Track2Name=VoD
Track3Name=Game
Track4Name=Voice
Track5Name=Music
Track6Name=Extra
RecFilePath=/home/sjoer/Videos/OBS Recordings
RecFormat=mkv
Rescale=true
RescaleRes=1920x1080
RecRescaleRes=1920x1080
FFRescaleRes=1920x1080
VodTrackEnabled=true
VodTrackIndex=2
RecEncoder=none
RecSplitFileType=Time
Track1Bitrate=128
Track2Bitrate=128
Track4Bitrate=128
Track6Bitrate=128
RecFormat2=mkv
ApplyServiceSettings=true
UseRescale=false
RecUseRescale=false
FFFilePath=/home/sjoer
FFVBitrate=2500
FFVGOPSize=250
FFUseRescale=false
FFIgnoreCompat=false
FFABitrate=160
RecSplitFileTime=15
RecSplitFileSize=2048
RecRBSize=512
AudioEncoder=ffmpeg_aac
RecAudioEncoder=none
RescaleFilter=3
StreamMultiTrackAudioMixes=1
FFExtension=mp4

[Audio]
MonitoringDeviceName=AT2020USB+ Pro
MonitoringDeviceId=alsa_output.usb-audio-technica_AT2020USB_-00.pro-output-0
SampleRate=48000
ChannelSetup=Stereo
MeterDecayRate=23.530000000000001
PeakMeterType=0

[Stream1]
IgnoreRecommended=false
EnableMultitrackVideo=false
MultitrackVideoMaximumAggregateBitrateAuto=true
MultitrackVideoMaximumVideoTracksAuto=true

Right now it seems to work with the Jack capture, I've got a script to automate connecting its inputs because the UI has no facility for this.

Activity

  1. sfjuocekr commented on Aug 6, 2024

    @sfjuocekr
    Author

    image

    Adding an image of the audio tracks for those who do not trust random links to random servers.

  2. oparada1988 commented on Aug 9, 2024

    @oparada1988

    This happens to me too, but it happens at random times. I open an issue with the pipewire plugin thinking it was that: dimtpap/obs-pipewire-audio-capture#42

  3. MichailiK commented on Aug 31, 2024

    @MichailiK

    I also make use of virtual sinks to separate system, game & voice audio. I am experiencing this crackling that's even vividly visible in the peak meter.

    Oddly enough, when I make use of the audio monitoring feature in OBS, the crackling seems to stop:

    Screencast.from.2024-08-31.11-27-35.webm

    I use PipeWire & in OBS I use PulseAudio output capture. This used to work flawlessly months ago, though I can't pinpoint when/what broke.

  4. sfjuocekr commented on Sep 21, 2024

    @sfjuocekr
    Author

    This happens to me too, but it happens at random times. I open an issue with the pipewire plugin thinking it was that: dimtpap/obs-pipewire-audio-capture#42

    Nah, it has to do with the pulseaudio plugin. The pipewire plugin works fine for actual devices, it doesn't work for virtual devices which I need. I still need to make an issue for that as well.

  5. m1neral-rocks commented on Oct 4, 2025

    @m1neral-rocks

    Same issues here. I had to do JACK capture and then link with a script for this myself as well

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions