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.2

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.2
File Size Uploaded Provenance Actions
blazar_video-0.1.2.tar.gz 219.3 kB With provenance Details for blazar_video-0.1.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for blazar-video 0.1.2
File Actions
blazar_video-0.1.2-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.2-cp312-cp312-manylinux_2_28_x86_64.whl
blazar_video-0.1.2-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details for blazar_video-0.1.2-cp312-cp312-manylinux_2_28_aarch64.whl
blazar_video-0.1.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for blazar_video-0.1.2-cp311-cp311-win_amd64.whl
blazar_video-0.1.2-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for blazar_video-0.1.2-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 12.1 MB

Release files / blazar_video-0.1.2.tar.gz

Download URL blazar_video-0.1.2.tar.gz
Size 219.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a294dc319307f8fa90d7fa602207b01b31b98234ff58de680969d5fc31431c05
BLAKE2b-256 checksum
How to use checksums
70d500803c67b7a346770f8af6f37e12772f0869583c92ab0d06f4eabd6377e8
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.2-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL blazar_video-0.1.2-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
69d0b1ef8530b17830eb431c60d78ffb951e205af4f7acc462d825fbb723abd7
BLAKE2b-256 checksum
How to use checksums
b9a822fb5bf9ba26c10de95fa0a60bfc3feec749dc8bc0f37c8673cb6d90a2dc
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.2-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL blazar_video-0.1.2-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
27cc0a55cf5377d8fb5f73cf21d7698a378ae79c46ee66796a4fadab3fe95f69
BLAKE2b-256 checksum
How to use checksums
39062b7b165276c2d93a6bd57dd5ef357d1ba494c8971e48e50cf5b06c5b3beb
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.2-cp311-cp311-win_amd64.whl

Download URL blazar_video-0.1.2-cp311-cp311-win_amd64.whl
Size 1.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
d5088bd28e38d5e228d9c4f12292b2cdc388e0a9e767a86f96de563845f44f63
BLAKE2b-256 checksum
How to use checksums
d0564d2067ab24f6143ff04889f3f73ea844fe52b043b676003d36a25ef38fb4
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.2-cp311-cp311-macosx_11_0_arm64.whl

Download URL blazar_video-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Size 996.7 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1abd9b9e8031bbc187dc656e3e15277a78649263be81bf8a391d98175f0388e7
BLAKE2b-256 checksum
How to use checksums
611dc20df7d3962f5b755ce0c093bfc1c711a415d80381af1c9d716aac018104
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.2

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.2.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