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

Built distributions (wheels)

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

Total release size: 12.1 MB

Release files / blazar_video-0.1.1.tar.gz

Download URL blazar_video-0.1.1.tar.gz
Size 219.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3d05fe05d223a6dc1457eb58f43ac78d1867b31db83569dd38ea695e16258c85
BLAKE2b-256 checksum
How to use checksums
da287a699bf29e77662f7d86237b7e78eb806d4895a9dbd49b0dd8d2b9a9b1ad
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.1-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL blazar_video-0.1.1-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
2ea32585d9f30db0f4db05c4c420cd0b69a4e479f88024a8b9a0a231659bd008
BLAKE2b-256 checksum
How to use checksums
5a0ebc493fe9ed73cfbfd136380dc2ad7c044f2cd4aecdbb61ad95737505a751
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.1-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL blazar_video-0.1.1-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
f39c9f0532940c5998edaa3ac6853aa425ba3595eed425963ae02b1dcc118136
BLAKE2b-256 checksum
How to use checksums
88405d27498403449c5d94af8cb5d80f89233c804bd8af394ece63168afc112c
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.1-cp311-cp311-win_amd64.whl

Download URL blazar_video-0.1.1-cp311-cp311-win_amd64.whl
Size 1.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
f4b1ba0c1b3ab4a06a586fdd75b64f5b3c188db607daecff48f3163fe8c8c77f
BLAKE2b-256 checksum
How to use checksums
597c4f60254e21e74e3b5e38602895f884f948688d8af9f457bcf4fc367fd622
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.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL blazar_video-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Size 996.8 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
34e589a961a62805bec230d4c060162549ecc235d7334afd1377f95181ad1f10
BLAKE2b-256 checksum
How to use checksums
7ba5631d20cf95d5f3ba835cdb4d0bb27a31b0b1e03534a77002fd9caa30d2be
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.1

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