GPL H.264 encoder worker for Spiral production video transcoding
Project description
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:
- Bump
versioninCargo.toml. - Merge the release change after CI is green.
- Create and publish a GitHub release tagged
vX.Y.Z, matching theCargo.tomlversion exactly. - 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-publishusing job-levelid-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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spiral_h264-0.1.3.tar.gz.
File metadata
- Download URL: spiral_h264-0.1.3.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4395e230f35ace20b3ebdd783a942e8d068977faa6cbf56048a7c10208656d5c
|
|
| MD5 |
e92850e25a50949081ae1309abd477cc
|
|
| BLAKE2b-256 |
41e5928db768216a139eb3d7a0af613c9b5425e38e74543222fe2da0080ed9eb
|
Provenance
The following attestation bundles were made for spiral_h264-0.1.3.tar.gz:
Publisher:
publish.yml on spiraldb/spiral-h264
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spiral_h264-0.1.3.tar.gz -
Subject digest:
4395e230f35ace20b3ebdd783a942e8d068977faa6cbf56048a7c10208656d5c - Sigstore transparency entry: 1397577884
- Sigstore integration time:
-
Permalink:
spiraldb/spiral-h264@bb1d1eabfb898318bfd6a70aaa7b069598a7125b -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/spiraldb
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb1d1eabfb898318bfd6a70aaa7b069598a7125b -
Trigger Event:
release
-
Statement type:
File details
Details for the file spiral_h264-0.1.3-cp311-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: spiral_h264-0.1.3-cp311-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d95b10053f1d34c298d8f302f2326c82dd85a3aa4753081945ae7ea424f78156
|
|
| MD5 |
b6ce4d7682eba46cf105196650b91cea
|
|
| BLAKE2b-256 |
6ae978ccf548e589bef437e3b418ca87c3b4a2b1dc3bf16ac245a83c7e399860
|
Provenance
The following attestation bundles were made for spiral_h264-0.1.3-cp311-abi3-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on spiraldb/spiral-h264
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spiral_h264-0.1.3-cp311-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
d95b10053f1d34c298d8f302f2326c82dd85a3aa4753081945ae7ea424f78156 - Sigstore transparency entry: 1397577902
- Sigstore integration time:
-
Permalink:
spiraldb/spiral-h264@bb1d1eabfb898318bfd6a70aaa7b069598a7125b -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/spiraldb
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb1d1eabfb898318bfd6a70aaa7b069598a7125b -
Trigger Event:
release
-
Statement type:
File details
Details for the file spiral_h264-0.1.3-cp311-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: spiral_h264-0.1.3-cp311-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 638.8 kB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
023a46a1d4ebbe7f028b38ce54387a51e9e281ec75acac682d9438f5669fca4a
|
|
| MD5 |
edb778e35b0948becef010e6bd6e7c04
|
|
| BLAKE2b-256 |
0a515a16dd01700403b51f9a548394fc72302963acfd9d5917d9e93cc5251dcc
|
Provenance
The following attestation bundles were made for spiral_h264-0.1.3-cp311-abi3-manylinux_2_28_aarch64.whl:
Publisher:
publish.yml on spiraldb/spiral-h264
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spiral_h264-0.1.3-cp311-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
023a46a1d4ebbe7f028b38ce54387a51e9e281ec75acac682d9438f5669fca4a - Sigstore transparency entry: 1397577888
- Sigstore integration time:
-
Permalink:
spiraldb/spiral-h264@bb1d1eabfb898318bfd6a70aaa7b069598a7125b -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/spiraldb
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb1d1eabfb898318bfd6a70aaa7b069598a7125b -
Trigger Event:
release
-
Statement type:
File details
Details for the file spiral_h264-0.1.3-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: spiral_h264-0.1.3-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 929.7 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b901a0b84d6ef39664070e713c641ea8b01199cab9dbf9d2ca8a0b91bbe513d
|
|
| MD5 |
e58ac24d31bb59edea4224fe3433879d
|
|
| BLAKE2b-256 |
94316aa4f5ab9d682ad0f2f4dcfa6cf740262d281143a4378b7d2b739f9d4e9c
|
Provenance
The following attestation bundles were made for spiral_h264-0.1.3-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on spiraldb/spiral-h264
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spiral_h264-0.1.3-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
9b901a0b84d6ef39664070e713c641ea8b01199cab9dbf9d2ca8a0b91bbe513d - Sigstore transparency entry: 1397577893
- Sigstore integration time:
-
Permalink:
spiraldb/spiral-h264@bb1d1eabfb898318bfd6a70aaa7b069598a7125b -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/spiraldb
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb1d1eabfb898318bfd6a70aaa7b069598a7125b -
Trigger Event:
release
-
Statement type: