Skip to content

Failed to Capture System Audio with ScreenCaptureKit on macOS 15 (SCStreamErrorDomain -3805 or No Callbacks) #647

@yuelong3

Description

@yuelong3

Environment:

  • macOS Version: 15 (darwin 24.1.0)
  • Python Version: 3.9.9 (via pyenv)
  • PyObjC Version: 11.0 (installed via pip install pyobjc)

Problem Description:

We are trying to capture system audio output using ScreenCaptureKit with PyObjC, specifically without relying on external tools like BlackHole. We understand that ScreenCaptureKit's primary purpose is screen recording, but native Swift/Objective-C implementations have confirmed that capturing system audio is possible with this framework.

However, using PyObjC (version 11.0) on macOS 15, we consistently fail to achieve this. The main issues encountered are:

  1. The SCStream starts but stops almost immediately, reporting Error Domain=com.apple.ScreenCaptureKit.SCStreamErrorDomain Code=-3805 "流播放期间,应用程序连接中断而导致失败" UserInfo={NSLocalizedDescription=流播放期间,应用程序连接中断而导致失败} (equivalent to SCStreamError.connectionInvalid).
  2. Alternatively, the stream appears to start successfully ("流已成功启动!正在监听音频...") but the audio sample buffer callback (stream_didOutputSampleBuffer_ofType_ for SCStreamOutputTypeAudio) is never invoked, even when system
    Describe the bug
    A clear and concise description of what the bug is.

Platform information

  • Python version
  • How was python installed (python.org, anaconda, homebrew, ...)
  • macOS version

To Reproduce
Steps to reproduce the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions