Scap
High-performance, cross-platform screen capture library in Rust.
Install / Use
/learn @CapSoftware/ScapREADME

A Rust library for high-quality screen capture that leverages native OS APIs for optimal performance!
- macOS: ScreenCaptureKit
- Windows: Windows.Graphics.Capture
- Linux: Pipewire
Features
- Cross-platform across Windows, Mac and Linux!
- Checks for support and recording permissions.
- Query list of captureable targets (displays and windows).
- Exclude certain targets from being captured.
Contributing
We found most of Rust's tooling around screen capture either very outdated, non-performant or platform-specific. This project is our attempt to change that. Contributions, PRs and Issues are most welcome!
If you want to contribute code, here's a quick primer:
- Clone the repo and run it with
cargo run. - Explore the API and library code in lib.rs.
- Platform-specific code lives in the
win,macandlinuxmodules. - The main.rs is a small program that "consumes" the library, for easy testing.
Usage
use scap::{
capturer::{Point, Area, Size, Capturer, Options},
frame::Frame,
};
fn main() {
// Check if the platform is supported
if !scap::is_supported() {
println!("❌ Platform not supported");
return;
}
// Check if we have permission to capture screen
// If we don't, request it.
if !scap::has_permission() {
println!("❌ Permission not granted. Requesting permission...");
if !scap::request_permission() {
println!("❌ Permission denied");
return;
}
}
// Get recording targets
let targets = scap::get_all_targets();
println!("Targets: {:?}", targets);
// All your displays and windows are targets
// You can filter this and capture the one you need.
// Create Options
let options = Options {
fps: 60,
target: None, // None captures the primary display
show_cursor: true,
show_highlight: true,
excluded_targets: None,
output_type: scap::frame::FrameType::BGRAFrame,
output_resolution: scap::capturer::Resolution::_720p,
crop_area: Some(Area {
origin: Point { x: 0.0, y: 0.0 },
size: Size {
width: 2000.0,
height: 1000.0,
},
}),
..Default::default()
};
// Create Capturer
let mut capturer = Capturer::build(options).unwrap();
// Start Capture
capturer.start_capture();
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
// Stop Capture
capturer.stop_capture();
}
License
The code in this repository is open-sourced under the MIT license, though it may be relying on dependencies that are licensed differently. Please consult their documentation for exact terms.
Contributors
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/Pranav2612000"><img src="https://avatars.githubusercontent.com/u/20909078?v=4?s=100" width="100px;" alt="Pranav Joglekar"/><br /><sub><b>Pranav Joglekar</b></sub></a><br /><a href="#code-Pranav2612000" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://www.sid.me"><img src="https://avatars.githubusercontent.com/u/30227512?v=4?s=100" width="100px;" alt="Siddharth"/><br /><sub><b>Siddharth</b></sub></a><br /><a href="#code-clearlysid" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="http://dev-rohan.in"><img src="https://avatars.githubusercontent.com/u/48467821?v=4?s=100" width="100px;" alt="Rohan Punjani"/><br /><sub><b>Rohan Punjani</b></sub></a><br /><a href="#code-RohanPunjani" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/NiiightmareXD"><img src="https://avatars.githubusercontent.com/u/90005793?v=4?s=100" width="100px;" alt="NiiightmareXD"/><br /><sub><b>NiiightmareXD</b></sub></a><br /><a href="#code-NiiightmareXD" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="http://bringeber.dev"><img src="https://avatars.githubusercontent.com/u/83474682?v=4?s=100" width="100px;" alt="MAlba124"/><br /><sub><b>MAlba124</b></sub></a><br /><a href="#code-MAlba124" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://peerlist.io/anubhavitis"><img src="https://avatars.githubusercontent.com/u/26124625?v=4?s=100" width="100px;" alt="Anubhav Singhal"/><br /><sub><b>Anubhav Singhal</b></sub></a><br /><a href="#code-anubhavitis" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="http://linkedin.com/in/vasusharma7"><img src="https://avatars.githubusercontent.com/u/40715071?v=4?s=100" width="100px;" alt="Vasu Sharma"/><br /><sub><b>Vasu Sharma</b></sub></a><br /><a href="#code-vasusharma7" title="Code">💻</a></td> </tr> </tbody> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END -->Credits
This project builds on top of the fabulous work done by:
- @MAlba124 for Linux support via Pipewire
- @svtlabs for screencapturekit-rs
- @NiiightmareXD for windows-capture
Related Skills
himalaya
343.3kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
qqbot-channel
343.3kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
99.7k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
coding-agent
343.3kDelegate coding tasks to Codex, Claude Code, or Pi agents via background process
