Is it possible to get only audio from ScreenCaptureKit?

I'm creating app that listening other app's sound. in this use case, screen data is not needed.

but if I don't call SCStream#addStreamOutput(_, type: .screen, ...), console shows this error:

[ERROR] _SCStream_RemoteVideoQueueOperationHandlerWithError:701 stream output NOT found. Dropping frame

currently I'm setting SCStreamConfiguration#minimumFrameInterval to large value (e.g. 0.1fps) as workaround, but it would be good if i can completely disable screen capture for best performance.

there is any way to disable screen capture and only captures apps audio?

Post not yet marked as solved Up vote post of rinsuki Down vote post of rinsuki
1.7k views

Replies

Did you find a solution for this? I'm also hoping to capture audio only without the video data.

You can, but you also have to capture screen and just filter the samples out in the callback.

  • That is just a workaround. screen image is still saved and shared from WindowServer which incurs unnecessary costs. also If the screen is disconnected (e.g., when you close the lid), the session will also disconnect.

Add a Comment

choose output type - audio in DidOutputSampleBuffer function and use avassetwriter to write the system audio buffer

The error you're seeing, stream output NOT found. Dropping frame, is related to memory management. Your stream output object has been cleared from the memory. Make sure you put it in an instance variable - self.output = streamOutput