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.6.tar.gz (19.9 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.6-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: macss-0.1.6.tar.gz
  • Upload date:
  • Size: 19.9 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.6.tar.gz
Algorithm Hash digest
SHA256 583bf690d26f35acc1bfde663f5bc72ee703da7fea3b5cc5bf50a65222e966c9
MD5 fed2868f1b8220449240d287c137bddd
BLAKE2b-256 974867ac9f8166a3134ff01234fe3edd6e3edc3b8b40b2af628025ac9e541b3a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: macss-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 18.8 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 18c9e095fa931c8e71eb7d8db5dde65e12a7d54b875d93a534ad80d912dd609c
MD5 86892d43191e8109021003e03c4e3f12
BLAKE2b-256 d4f3e0ec61a2fb5dcc823726e95ace25ffcc6fc25c00374fdd260be16d3156c9

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