# scap1 **Repository Path**: huywang/scap1 ## Basic Information - **Project Name**: scap1 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-17 - **Last Updated**: 2024-11-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![Github banner](./.github/banner.gif) A Rust library for high-quality screen recordings that leverages native OS APIs for optimal performance: Apple's [ScreenCaptureKit](https://developer.apple.com/documentation/screencapturekit) on macOS, [Graphics.Capture](https://learn.microsoft.com/en-us/uwp/api/windows.graphics.capture?view=winrt-22621) APIs on Windows and [Pipewire](https://pipewire.org) on Linux. **🚧 WIP. Unsuitable for production use, APIs are being iterated on.** [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.com/invite/SC468DK4du) --- ## features 1. Cross-platform support: Windows, Mac and Linux! 2. Check for support and user permissions. 3. Utilize native OS APIs for screen capture. 4. Different capture modes: Display or Windows. ## contributing We found most of Rust's tooling around screen capture either non-performant, outdated or very platform-specific. This project is our attempt to change that. Contributions, PRs and Issues are most welcome! If you'd like to develop, here's a kickstart guide: 1. Clone the repo and run it with `cargo run`. 2. Explore the API and library code in [lib.rs](./scap/src/lib.rs). 3. Platform-specific code is in the `win`, `mac` and `linux` modules. 4. There's a small program in [main.rs](./scap/src/main.rs) that "consumes" the library for dev-testing. ## usage ```rust use scap::{ capturer::{CGPoint, CGRect, CGSize, Capturer, Options}, frame::Frame, }; fn main() { // Check if the platform is supported let supported = scap::is_supported(); if !supported { println!("❌ Platform not supported"); return; } else { println!("✅ Platform supported"); } // 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; } } println!("✅ Permission granted"); // Get recording targets (WIP) let targets = scap::get_targets(); println!("🎯 Targets: {:?}", targets); // Create Options let options = Options { fps: 60, targets, show_cursor: true, show_highlight: true, excluded_targets: None, output_type: scap::frame::FrameType::BGRAFrame, output_resolution: scap::capturer::Resolution::_720p, source_rect: Some(CGRect { origin: CGPoint { x: 0.0, y: 0.0 }, size: CGSize { width: 2000.0, height: 1000.0, }, }), ..Default::default() }; // Create Recorder let mut capturer = Capturer::new(options); // 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. However, it may rely on dependencies that are licensed differently. Please consult their documentations for exact terms. ## Contributors
Pranav Joglekar
Pranav Joglekar

💻
Rohan Punjani
Rohan Punjani

💻
Siddharth
Siddharth

💻
NiiightmareXD
NiiightmareXD

💻
MAlba124
MAlba124

💻
Anubhav Singhal
Anubhav Singhal

💻
## credits This project builds on top of the fabulous work done by [@svtlabs](https://github.com/svtlabs) and [@NiiightmareXD](https://github.com/NiiightmareXD). - [screencapturekit-rs](https://github.com/svtlabs/screencapturekit-rs): Rust bindings for Apple's ScreencaptureKit API. - [windows-capture](https://github.com/NiiightmareXD/windows-capture): Rust library for Windows.Graphics.Capture.