Skip to main content

High-performance ScreenCaptureKit wrapper for Apple Silicon

Project description

MacSS

Mac Alternative of MSS for Apple Silicon (M-Series) based on new ScreenCaptureKit

MacSS is a high-performance, zero-copy screen capture utility By leveraging Apple's modern ScreenCaptureKit and a direct C-interop pointer to Unified Memory.

Zero Copy Architecture

1. The macOS GPU writes screen data to a specific memory address.
2. MacSS maps a Python pointer directly to that exact address.
3. You read the data with zero latency. No data is moved; you are simply "looking" at the GPU's shoulder.


Performance Benchmarks

Tested on M1 (8GB Ram Model)

Test Script

import time
from mss import mss
from macss import macss

region = {"top": 0, "left": 0, "width": 400, "height": 400}
N = 10_000


with macss() as sct:
    t = time.time()
    sct.grab(region)
    for _ in range(N):
        sct.grab(region)
    dt = time.time() - t
    print(f"macss: {dt:.4f}s | iterations : {N} | {1000*dt/N:.4f} ms | {N/dt:.2f} FPS")

with mss() as sct:
    t = time.time()
    for _ in range(N):
        sct.grab(region)
    dt = time.time() - t
    print(f"mss: {dt:.4f}s | iterations : {N} | {1000*dt/N:.4f} ms | {N/dt:.2f} FPS")

Results

macss: 0.2126s | iterations : 1000 | 0.2126 ms  | 4704.66 FPS
mss: 20.0145s  | iterations : 1000 | 20.0145 ms | 49.96 FPS

Installation

pip install macss

Basic Usage

import cv2
from macss import macss

region = {"top": 0, "left": 0, "width": 400, "height": 400}

with macss() as sct:
    while True:
        frame = sct.grab(region) # Returns numpy.ndarray with RGBA Channel
        
        img = cv2.cvtColor(frame, cv2.COLOR_BGRA2BGR)
        
        cv2.imshow("MacSS High-Speed Feed", img)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macss-0.1.5.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

macss-0.1.5-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file macss-0.1.5.tar.gz.

File metadata

  • Download URL: macss-0.1.5.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for macss-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5181fd8d0968269d529cf6656aa23f28b9cb8bbc89fecccc20de2f9e66d6db6d
MD5 121a841fdf96f08921726a96517db633
BLAKE2b-256 d9fd8185f6476d4537f6f922636fc326086a843bb564a0d4485fdf31500a652a

See more details on using hashes here.

File details

Details for the file macss-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: macss-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for macss-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3a9b6701d304f43eccd77d1256c577cddffe7e8b1c5a783f2c0cd85cdb30231c
MD5 d9bd8e369111d31a23b0d996a7825fc0
BLAKE2b-256 4a697ce02f6a23618e54d86b1cb0107c5afde64ed27b3645f347eb0db38c0a23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page