scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Audio Forwarding stops after launching OBS

Open dhruvasagar opened this issue 1 year ago • 3 comments

  • [x] I have read the FAQ.
  • [x] I have searched in existing issues.

Environment

  • OS: macOS
  • scrcpy version: 2.3.1
  • installation method: via homebrew
  • device model: OnePlus 11
  • Android version: 14

Describe the bug scrcpy works, with audio forwarding with both wireless & usb cable, however, as soon as I launch OBS the audio is lost. I enabled 'Monitor and Output' in OBS advanced properties but that did not have any effect.

Would appreciate any help in troubleshooting.

I notice these debug logs when OBS is running which may hint at something odd. Without OBS, it's typically Buffer underflow.

DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 480 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 240 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 942 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 461 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 941 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 461 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 941 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 127 samples

dhruvasagar avatar Feb 08 '24 03:02 dhruvasagar

I did another test on Linux and this does not seem to be a problem on linux so is macOS specific.

dhruvasagar avatar Feb 08 '24 05:02 dhruvasagar

DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples

Technically, the audio output SDL callback is not called often enough (so there is more data received than data played).

You might try to increase the audio output buffer, at the cost of latency (and indirectly more buffer underflows):

scrcpy --audio-output-buffer=10  # in milliseconds, default is 5

rom1v avatar Feb 08 '24 08:02 rom1v

@rom1v Thanks for your response. Will give that a shot.

dhruvasagar avatar Feb 08 '24 10:02 dhruvasagar