Giter Club home page Giter Club logo

scap's Introduction

A Rust library to leverage native OS APIs for optimal performance and high-quality screen recordings. We use Apple's ScreenCaptureKit on macOS and Graphics.Capture APIs on Windows. Linux support is planned but not underway yet, PRs welcome!

๐Ÿšง WIP. Unsuitable for production use, APIs are being iterated on.

Discord


features

  1. Cross-platform support: Windows and Mac now, Linux soon.
  2. Check for support and user permissions.
  3. Utilize native OS APIs for screen capture.
  4. Different capture modes: audio, display or window.

contributing

I found most of Rust's tooling around screen capture either non-performant, outdated or very platform-specific. This project is my attempt to change that. It's early days and the code is fairly simple, I'll gladly accept any contributions/PRs.

If you'd like to chip in, 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.
  3. Platform-specific code is in the win and mac modules.
  4. There's a small program in main.rs that "consumes" the library for dev-testing.

usage

use scap::{Options, Recorder};

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 the screen
    let has_permission = scap::has_permission();
    if !has_permission {
        println!("โŒ Permission not granted");
        return;
    } else {
        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,
    };

    // Create Recorder
    let mut recorder = Recorder::init(options);

    // Start Capture
    recorder.start_capture();

    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();

    // Stop Capture
    recorder.stop_capture();
}

roadmap

  • Check for support and user permissions.
  • Capture frames
  • Capture targets: monitors, windows, region and audio.
  • Encoding: encode frames to file.

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 and @NiiightmareXD.

scap's People

Contributors

clearlysid avatar pranav2612000 avatar allcontributors[bot] avatar rohanpunjani avatar malba124 avatar anubhavitis avatar zokhcat avatar

Stargazers

Halu avatar Lulzx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.