Skip to main content

pymagewell

pymagewell is a Python library for interfacing with Magewell ProCapture frame grabbers.

It is based on (and includes) Magewell's Windows SDK and is therefore Windows only. However, it provides a mock class that for testing and development that does not depend on the SDK's Windows .dll files, so pymagwell can also be installed on macOS and Linux.

Installation

From PyPI:

pip install pymagewell

From conda-forge (Windows and macOS only):

conda install -c conda-forge pymagewell

Example of use

A full working example is provided in example_script.py.

First, create a ProCaptureSettings dataclass:

from pymagewell import (
    ProCaptureSettings, ImageSizeInPixels, TransferMode, ColourFormat
)

device_settings = ProCaptureSettings(
    dimensions=ImageSizeInPixels(1920, 1080),
    color_format=ColourFormat.BGR24,  # Color format of captured video frames
    transfer_mode=TransferMode.LOW_LATENCY,
    num_lines_per_chunk=64  # has effect only in low latency mode
)

Then create a ProCaptureDevice (or MockProCaptureDevice for testing on a system without a grabber) configured with your chosen settings:

from pymagewell import ProCaptureDevice

device = ProCaptureDevice(settings=device_settings)

Then create a ProCaptureDeviceController to transfer frames from the device to your PC:

from pymagewell import ProCaptureController

controller = ProCaptureController(device)

Then you can grab frames in a loop using the transfer_when_ready() method, which will wait until a frame has been acquired by the device, transfer it from the device to the PC, and return it as a VideoFrame object. This is a blocking call.

while True:
    frame = controller.transfer_when_ready()

VideoFrame provides access to the pixels as a Numpy array with its as_array method. It also provides access to timestamps (datetime.datetime) describing the frame acquisition process:

t1 = frame.timestamps.buffering_started  # time at which frame started being written to the hardware buffer
buffer
t2 = frame.timestamps.buffering_complete  # time at which frame was completely written to the hardware buffer
t3 = frame.timestamps.transfer_started  # time at which the software started transferring the frame to PC memory
t4 = frame.timestamps.transfer_complete  # time by which the whole frame had arrived in PC memory

In TIMER and NORMAL transfer modes, transfer starts after the full frame has been written to hardware buffer. In LOW_LATENCY transfer mode, transfer starts while the frame is still being written to hardware memory. This will be reflected in the timestamps.

Release files for pymagewell 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymagewell 0.2.1
File Size Uploaded
pymagewell-0.2.1.tar.gz 28.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymagewell 0.2.1
File Interpreter ABI Platform
pymagewell-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 56.1 MB

Release files / pymagewell-0.2.1.tar.gz

Download URL pymagewell-0.2.1.tar.gz
Size 28.0 MB
Tags Source
SHA-256 checksum
How to use checksums
70cdf755fe6001a871a97b987f1e9b3d67ba97f5f2a23675f6e0fa717a457a37
BLAKE2b-256 checksum
How to use checksums
fadda858e6cdca2662144d57ef76817345ecd8ef769d9b056b6721bb64150f29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / pymagewell-0.2.1-py3-none-any.whl

Download URL pymagewell-0.2.1-py3-none-any.whl
Size 28.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c160040f44318252aa7385253284c0152326e17b0d56471a5c6825b91b1a4bb5
BLAKE2b-256 checksum
How to use checksums
6fe95a9ec09aadf17417fdfd2b864e174ebd9b853f4caa33edd3e65af0d1ffcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page