Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

High-performance, cross-platform screen capture library in Rust.

License

NotificationsYou must be signed in to change notification settings

CapSoftware/scap

Repository files navigation

Github banner

DiscordTwitterGitHub Repo starsdocs.rsCrates.io MSRV

A Rust library for high-quality screen capture that leverages native OS APIs for optimal performance!

  1. macOS:ScreenCaptureKit
  2. Windows:Windows.Graphics.Capture
  3. Linux:Pipewire

Features

  1. Cross-platform across Windows, Mac and Linux!
  2. Checks for support and recording permissions.
  3. Query list of captureable targets (displays and windows).
  4. 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:

  1. Clone the repo and run it withcargo run.
  2. Explore the API and library code inlib.rs.
  3. Platform-specific code lives in thewin,mac andlinux modules.
  4. Themain.rs is a small program that "consumes" the library, for easy testing.

Usage

use scap::{    capturer::{Point,Area,Size,Capturer,Options},    frame::Frame,};fnmain(){// Check if the platform is supportedif !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 targetslet 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 Optionslet options =Options{fps:60,target:None,// None captures the primary displayshow_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 Capturerletmut capturer =Capturer::build(options).unwrap();// Start Capture    capturer.start_capture();letmut 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

Pranav Joglekar
Pranav Joglekar

💻
Siddharth
Siddharth

💻
Rohan Punjani
Rohan Punjani

💻
NiiightmareXD
NiiightmareXD

💻
MAlba124
MAlba124

💻
Anubhav Singhal
Anubhav Singhal

💻
Vasu Sharma
Vasu Sharma

💻

Credits

This project builds on top of the fabulous work done by:

About

High-performance, cross-platform screen capture library in Rust.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors18

Languages


[8]ページ先頭

©2009-2026 Movatter.jp