Skip to main content

Python bindings

PyO3 bindings over blazar-runtime, built with maturin.

Build

python3 -m venv .venv && . .venv/bin/activate
pip install maturin numpy pytest

# mock encoder (no CUDA): enough to exercise the binding and the muxer
maturin develop

# hardware AV1 on a CUDA host
maturin develop --features nvenc

bindings/python is its own cargo workspace on purpose: extension-module does not link libpython, which breaks cargo test linking, so the portable cargo test --workspace must not see it.

Test

pytest bindings/python/tests -v

The suite uses the mock encoder and asserts container structure, not decodability: the mock has no real codec, so it is given a plausible video_extradata and writes synthetic payload bytes. Decode validation stays on hardware (see the repo README, "Hardware validation").

Use

import numpy as np
import blazar

Calibrations = blazar.Calibrations.load("calibrations/default")

with blazar.Encoder(
    calibrations=calibrations,
    identity={"family": "wan", "version": "2.1", "quant": "bf16", "size": "1.3b"},
    target="balanced",
    backend="svtav1",              # or "nvenc", or "auto" with backend_pool=
    output="out.mp4",
    queue_depth=4,                 # frames the encoder may be behind
) as stream:
    for i, frame in enumerate(frames):        # frame: (H, W, 3) float32 in [0, 1]
        stream.submit(
            frame, width=W, height=H, fps=24.0,
            layout="thwc", range="unit01",
            scene_cut=(i == 0),
        )
        for event in stream.poll():           # optional: non-blocking
            if event["kind"] == "encoded" and event["keyframe"]:
                pass                          # a fragment boundary was just closed

submit copies the frame and enqueues it; a Rust worker thread does the preprocess, encode and muxing. It blocks only when queue_depth frames are already queued, and it releases the GIL while blocking, so other Python threads keep running. Use flush() as a barrier (everything submitted before it is durable) and stats for counters.

poll() returns dicts:

{"kind": "encoded", "seq", "pts", "keyframe", "units", "bytes",
 "encode_us", "queue_depth"}
{"kind": "failed", "seq", "message"}
{"kind": "closed"}

keyframe: True means the fMP4 sink closed a fragment at that frame, which is the segment boundary a transport sink will publish.

Worker failures surface as a failed event, are re-raised by submit, and are re-raised by close(). Nothing is swallowed.

Defaults synthesise PTS as frame_index * 90000 / fps; pass pts_ticks= to place frames explicitly (vLLM-Omni chunks carry a cumulative frame index).

Boundaries

  • Video only. submit_audio does not exist on the Python object.
  • The sink is a file. There is no WebSocket/streaming destination yet, so this measures the encode path rather than delivering a live stream.
  • Device tensors are Phase 2: the frame is copied to host and then into Rust.

Metadata

Release files for blazar-video 0.1.0

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

Source distribution (sdist)

Source distribution for blazar-video 0.1.0
File Size Uploaded Provenance Actions
blazar_video-0.1.0.tar.gz 219.1 kB With provenance Details for blazar_video-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for blazar-video 0.1.0
File Actions
blazar_video-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for blazar_video-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
blazar_video-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details for blazar_video-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl
blazar_video-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for blazar_video-0.1.0-cp311-cp311-win_amd64.whl
blazar_video-0.1.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for blazar_video-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 12.1 MB

Release files / blazar_video-0.1.0.tar.gz

Download URL blazar_video-0.1.0.tar.gz
Size 219.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9f7921fe4cc62484eef0846367a6f8f0b9da833fe1a5afa9fd778337eccd0aac
BLAKE2b-256 checksum
How to use checksums
e0c786a71e8edcdab3bbd9dee5745e0f5d84edbd61fe387b0d633af1623875b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / blazar_video-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL blazar_video-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 5.4 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9c4c730d1dd4d0142949dc613219418e0c50f9ceff317a5ad76ba25ae31e3856
BLAKE2b-256 checksum
How to use checksums
ab790a8b2c8bbffa0de38f18b06deb3fc97e100a64458e0d8d697f3654c97279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / blazar_video-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL blazar_video-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl
Size 4.4 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
56d16884eebca223408b90d5d26ebe1e50021b18f5b5cb804c61675f204211d7
BLAKE2b-256 checksum
How to use checksums
fbeddb4235d568b9d394118390d7442e114f9a02c6ee3fb3c5932de74fa985e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / blazar_video-0.1.0-cp311-cp311-win_amd64.whl

Download URL blazar_video-0.1.0-cp311-cp311-win_amd64.whl
Size 1.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
bf426b2369e3dcb0d441b17012a6382bbb237c28245c2df752b33f5f51c1e408
BLAKE2b-256 checksum
How to use checksums
aa25e6486a404696d59f62830c4facacf5172f3553524d9aab73386fd77a6f40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / blazar_video-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL blazar_video-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Size 996.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f5499a18dd1682a66ba7d3a08119e98db41b221b6ea317a7b90cfe91f1af1319
BLAKE2b-256 checksum
How to use checksums
1280326012673d249e8ba9b1769aa8f8a97e7fa7ba1b047eeaf936fd8013a095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Security for blazar-video 0.1.0

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for blazar_video-0.1.0.tar.gz

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 Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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