use Screencapturekit to capture a specific window

Asked on 03/03/2025

1 search

To capture a specific window using ScreenCaptureKit, you can utilize the SCStream object, which allows you to receive screen and audio samples in your app. You can specify what to capture by providing an SCContentFilter to the stream. This filter can be configured to capture an entire screen or just specific windows and apps.

For more detailed guidance on using ScreenCaptureKit, you can refer to the session titled "Capture HDR content with ScreenCaptureKit" from WWDC 2024. This session covers the basics of capturing screen and audio, as well as advanced features like capturing HDR content and adding microphone output.

If you are interested in capturing HDR content specifically, you can start by configuring your stream with the appropriate properties on the SCStreamConfiguration, such as setting the dynamic range and pixel format. For capturing a specific window, you would adjust the SCContentFilter accordingly.

For more information, you can watch the session Capture HDR content with ScreenCaptureKit (01:20) which covers capturing HDR content.