pydecklink
Python bindings for the Blackmagic DeckLink SDK, exposing the capture and scheduled playback APIs via CPU buffers (numpy), and the network surface of the DeckLink IP cards that carry SMPTE ST 2110.
Requirements
- Linux, macOS, or Windows with Blackmagic Desktop Video 16.0 or later installed — the binding is built against the 16.0 SDK headers, whose interfaces an older runtime does not serve
- Blackmagic DeckLink hardware
- Python 3.12+
Install
uv pip install pydecklink
Prebuilt wheels ship for Linux (manylinux x86_64), macOS, and Windows. Building from source requires a C++ toolchain — see CONTRIBUTING.md.
Usage
import pydecklink
# Desktop Video runtime version
print(pydecklink.api_version().string)
# Enumerate DeckLink devices
for info in pydecklink.list_devices():
print(f"{info.index}: {info.model_name}")
# Display modes a device can output
dev = pydecklink.Device(0)
for m in dev.list_output_modes():
fps = pydecklink.get_mode_fps(m.mode)
print(f"{m.name}: {m.width}x{m.height} @ {fps:.2f}")
Examples
The examples/ directory in the repo contains runnable scripts:
| Script | What it does |
|---|---|
passthrough.py |
Zero-copy SDI capture → playout loop. |
cuda_passthrough.py |
Canonical SDI → CUDA kernel → SDI recipe (drop in your own kernel callable). |
cuda_loopback_latency.py |
Fingerprint loopback benchmark for end-to-end latency. |
cuda_register_pinned.py |
Register CUDA pinned memory for the H2D capture path. |
detect_signals.py |
Walk all inputs, report which carry an active signal. |
dump_topology.py |
Print each device's identity and profile attributes. |
CUDA examples need the cuda-examples extra
(uv pip install "pydecklink[cuda-examples]").
API
The package ships type stubs (pydecklink/_bindings.pyi) and a py.typed
marker, so editors and mypy see the full typed surface. Key entry points:
Device discovery
list_devices() -> list[DeviceInfo],device_count() -> intapi_version() -> APIVersion— Desktop Video runtime versionconnector_label(device) -> str | None— physical SDI port label
Display-mode helpers
get_mode_width(mode),get_mode_height(mode),get_mode_fps(mode)get_mode_frame_duration(mode),get_frame_bytes(mode, pixel_format),get_row_bytes(pixel_format, width)
Device — open a card with Device(index), then:
- Capture:
enable_video_input(...),start_streams(), andpop_capture_frame()(copying) orpop_capture_frame_ref()(zero-copy). - Scheduled playback:
enable_video_output(...),create_frame_pool(...),acquire_output_frame(),schedule_output_frame(...),start_scheduled_playback(...). - Zero-copy passthrough:
schedule_capture_frame(...)forwards a captured frame straight to output with no memcpy.
DeckLink IP — the card runs its own IP stack, so the host has no network
device for its media port and the address is set through the SDK or not at
all. Each Ethernet connector has its own address:
ConfigurationID.ConfigParamEthernet* covers a connector's address, subnet,
gateway and the multicast group each stream sends to, and
StatusID.ParamEthernet* reports what that connector resolved and
negotiated. Reach them with the *_with_param accessors, passing the
connector's zero-based index; AttributeID.NumberOfEthernetConnectors
counts them. ConfigurationID.ConfigEthernetPTP* covers the device-wide
PTP domain, priorities and FollowerOnly. Addresses are dotted-quad
strings, since set_config_int on one answers E_INVALIDARG:
cfg, status = pydecklink.ConfigurationID, pydecklink.StatusID
dev.set_config_string_with_param(
cfg.ConfigParamEthernetStaticLocalIPAddress, 1, "192.0.2.40"
)
dev.get_status_int_with_param(status.ParamEthernetLink, 1)
StatisticID reads PTP lock, temperature, per-connector packet counts and
the optical module's readings through get_statistic_*.
Each sub-device's streams are IPFlows, one per essence and direction,
from dev.ip_extensions. An output flow's status reads the SDP the card
offers; an input flow takes the SDP of the peer it receives, and enable()
starts it. The card answers success to an SDP it rejects and keeps the
previous one, so read the setting back:
D, T, S = pydecklink.IPFlowDirection, pydecklink.IPFlowType, pydecklink.IPFlowSettingID
video_in = next(
f for f in dev.ip_extensions.get_ip_flows()
if f.direction == D.Input and f.type == T.Video
)
video_in.set_setting_string(S.PeerSDP, peer_sdp)
assert video_in.get_setting_string(S.PeerSDP) == peer_sdp
video_in.enable()
Frames — CaptureFrame, CaptureFrameRef (zero-copy), and MutableFrame
expose pixel data as a numpy array via .data, alongside .width,
.height, .row_bytes.
Enums — DisplayMode, PixelFormat, VideoConnection, VideoInputFlag,
VideoOutputFlag, FieldDominance, IPFlowDirection, IPFlowType, and
the ConfigurationID, AttributeID, StatusID and IPFlow*ID identifier
sets the config, attribute, status and flow accessors take.
Custom memory — VideoBufferAllocator / VideoBufferAllocatorProvider
back capture and playback with caller-owned buffers (e.g. CUDA pinned memory)
for direct GPU DMA. Connector profiles — ProfileManager, Profile,
and ProfileID switch a card's duplex/sub-device layout.
License
BSD-3-Clause — see LICENSE.
Release files for pydecklink 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydecklink-1.3.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| pydecklink-1.3.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| pydecklink-1.3.0-cp312-abi3-macosx_14_0_arm64.whl | CPython 3.12 | abi3 | macOS 14.0+ ARM64 | Details |
Total release size: 525.1 kB
Release files / pydecklink-1.3.0-cp312-abi3-win_amd64.whl
| Download URL | pydecklink-1.3.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 175.3 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2dd141cd1e2749de734d53be62f7f052a32d6b3afd11768f20e2e8a1c7c2db95
|
|
BLAKE2b-256 checksum How to use checksums |
5343cf516e810f7881b1e8255b0677a352f9ebcc4e1d625c0836797e74644a7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / pydecklink-1.3.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pydecklink-1.3.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 192.1 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ea08ddadb09397a4f46cfd8adae5f07438ba2974a4fbe5880cd71b2f2eb408de
|
|
BLAKE2b-256 checksum How to use checksums |
78ddd07d15340ebf90f472a0a60d4dff60869a2a32c1c3e33ec9b92befbce301
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / pydecklink-1.3.0-cp312-abi3-macosx_14_0_arm64.whl
| Download URL | pydecklink-1.3.0-cp312-abi3-macosx_14_0_arm64.whl |
|---|---|
| Size | 157.6 kB |
| Tags | CPython 3.12 abi3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
69346a276ef336c1f31e07eae5ba2f20a1b496f2301d0038f284ce0498c11304
|
|
BLAKE2b-256 checksum How to use checksums |
00b3d30d4df5094f7d949de0dd2bbbdc416c10b420207ca9e05560df84fdf249
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log