Skip to main content

spiral-h264

spiral-h264 is the GPL encoder worker for Spiral video transcoding. It uses the patched x264 fork as a git submodule and exposes a narrow CLI that accepts raw Y4M frames plus a JSON encode schedule, then emits an Annex B H.264 stream and JSONL sample metadata.

The user-facing APIs, frame graph selection, ffmpeg orchestration, MP4 muxing/packing, indexing, and Spiral expressions live in pyspiral / SpiralDB. This package should stay limited to the x264 encode boundary.

It deliberately does not demux source containers, run ffmpeg, mux MP4, pack prefix-readable artifacts, or build Spiral indexes. Those steps stay in the permissive SpiralDB/pyspiral codebase.

CLI

spiral-h264 encode-y4m \
  --config encode.json \
  --annex-b out.h264 \
  --metadata samples.jsonl \
  < input.y4m

--input-y4m path may be used instead of stdin.

The config JSON is intentionally small and mirrors x264 encoder controls plus the scheduled frame IR:

{
  "frame_ir": "schedule.json",
  "keyint": 120,
  "keyint_min": 120,
  "bframes": 15,
  "crf": 25,
  "preset": "medium",
  "scenecut": 0,
  "b_adapt": 0,
  "b_pyramid": "normal",
  "open_gop": false,
  "rc_lookahead": 40,
  "threads": 4,
  "x264_extra_params": "weightp=0:mbtree=0",
  "x264_layer_qps": "0=22,1=23,2=24,3=30,4=34"
}

samples.jsonl starts with one stream record, followed by one record per sample:

{"type":"stream","width":1280,"height":720,"fps_num":30,"fps_den":1}
{"type":"sample","sample_index":0,"byte_offset":693,"byte_len":1312,"pts":0,"dts":0,"duration":1,"is_keyframe":true,"picture_type":1,"display_frame":0,"decode_order":0,"temporal_layer":0,"max_ref_layer":0,"frame_id":0}

Development

git submodule update --init --recursive
cargo test
cargo run -- encode-y4m --help
maturin build --features python
python scripts/check_cargo_licenses.py

ffmpeg is not bundled. SpiralDB/pyspiral is responsible for invoking system ffmpeg to produce Y4M input.

Publishing

Cargo.toml is the single source of truth for the package version. The Python package version is dynamic in pyproject.toml, and maturin derives it from the Cargo package metadata.

PyPI publishing uses GitHub Actions Trusted Publishing / OIDC. No PyPI API token is stored in GitHub. Publishing runs from .github/workflows/publish.yml when a GitHub release is published, or manually through workflow_dispatch.

Configure the PyPI project trusted publisher with:

  • PyPI project: spiral-h264
  • Owner: spiraldb
  • Repository: spiral-h264
  • Workflow: publish.yml
  • Environment: pypi

Release process:

  1. Bump version in Cargo.toml.
  2. Merge the release change after CI is green.
  3. Create and publish a GitHub release tagged vX.Y.Z, matching the Cargo.toml version exactly.
  4. The publish workflow validates the tag/version match, builds macOS plus x86_64 and ARM64 manylinux wheels, builds an sdist that includes the x264 submodule source, then publishes with pypa/gh-action-pypi-publish using job-level id-token: write.

Manual workflow_dispatch is intended only for dry-run validation of the build graph; normal PyPI releases should go through a GitHub release tag.

License

This repository is GPL-2.0-or-later because it statically links the patched x264 source under third_party/x264.

Metadata

Release files for spiral-h264 0.1.4

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

Source distribution (sdist)

Source distribution for spiral-h264 0.1.4
File Size Uploaded
spiral_h264-0.1.4.tar.gz 1.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for spiral-h264 0.1.4
File Interpreter ABI Platform
spiral_h264-0.1.4-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
spiral_h264-0.1.4-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
spiral_h264-0.1.4-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details

Total release size: 3.9 MB

Release files / spiral_h264-0.1.4.tar.gz

Download URL spiral_h264-0.1.4.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
a573c42a46377083b606843f2c659e640123d0adef40afedbb190ef980d8f351
BLAKE2b-256 checksum
How to use checksums
f78643dc99b2d9d52715f4fc6ac3c2b391c6f815246087f55cf3ffa77337bf9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 3, 2026.

Transparency log

Release files / spiral_h264-0.1.4-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL spiral_h264-0.1.4-cp311-abi3-manylinux_2_28_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
4b8951ab8e563994994eb6e825345af9069a6b87ff5924844468873b5ce09f96
BLAKE2b-256 checksum
How to use checksums
8a85ac75dd784e623b572f349e8d056cd9717f4adc3a3a23209aab3f2c8dee3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 3, 2026.

Transparency log

Release files / spiral_h264-0.1.4-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL spiral_h264-0.1.4-cp311-abi3-manylinux_2_28_aarch64.whl
Size 660.0 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
c307c15378addd8a3031e796301341bdaa76d6f8a885a52d1c710502bc24d356
BLAKE2b-256 checksum
How to use checksums
e26cb6742d342c6248854fbded91867c5ace96085d796b6ab6365fc107106663
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 3, 2026.

Transparency log

Release files / spiral_h264-0.1.4-cp311-abi3-macosx_11_0_arm64.whl

Download URL spiral_h264-0.1.4-cp311-abi3-macosx_11_0_arm64.whl
Size 951.1 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
70ceb0e0bc5e0fd6aa9dd25d15f3130dc87d7270f6e2b0133ed6ed40b7b28d8a
BLAKE2b-256 checksum
How to use checksums
6b7811ebd278e598d98da732bdc51eed37ea7989e955c324ef3011e99406b878
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.4 This release

4 release files

0.1.3

4 release files

0.1.2

3 release files

0.1.0

3 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