caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

72 lines
2.8 KiB
Markdown

# @reelforge/render-core
Declarative **RenderSpec** → FFmpeg `filter_complex` string. The client uses it
for preview + to serialize the spec to the API; the Python worker
(`app/services/compose/compose_ffmpeg.py`) is the executor. This library
reproduces the executor's **composition graph** (everything up to the `[comp]`
sink) and its **ducked-audio graph** (`[aout]`) **byte-for-byte**, so preview
matches output.
> `render-core` owns spec→string only. It never spawns processes or touches
> storage — the Celery worker + FFmpeg remain the only executor.
## What is (and isn't) in the shared byte-identical contract
| Fragment | Shared? | Why |
| --- | --- | --- |
| Layout composition → `[comp]` (`captions_only` / `pip` / `split` / `hook_intro`) | ✅ byte-identical | pure, deterministic geometry |
| Ducked background-music graph → `[aout]` | ✅ byte-identical | pure, deterministic |
| libass caption burn, brand watermark (past `[comp]`) | ❌ executor-only | escape an absolute path + embed `utils.font_dir()`, resolved at render time |
| VFX / smart-handling (setpts, blur-pad) / b-roll | ❌ executor-only | probe/param-driven, non-deterministic |
Chroma / PiP diameter / margin / loudnorm targets are always the executor's
shipping defaults (`reelforge.py` never overrides them), so they are baked as
constants that match `_chroma_filter` / `_build_audio_graph` output exactly.
## Spec
```json
{
"output": { "width": 1080, "height": 1920, "fps": 30 },
"layout": "pip",
"avatar": { "input": 1, "diameter": 480, "margin": 48 },
"caption_ass": "captions.ass",
"audio": { "narration": 2, "bgm": 3 }
}
```
`layout` defaults to `captions_only` (no avatar input). The avatar overlays
(`pip` / `split` / `hook_intro`) require an `avatar` input. `audio.bgm` triggers
the ducked-and-loudness-normalised music graph; narration-only emits no audio node
(the executor maps the raw narration input).
## Use
```ts
import { buildFiltergraph, makeSpec } from "@reelforge/render-core";
buildFiltergraph(makeSpec({ layout: "pip", avatarInput: 1, narration: 2, bgm: 3 }));
```
```python
from reelforge_render_core import build_filtergraph, make_spec
build_filtergraph(make_spec(layout="pip", avatar_input=1, narration=2, bgm=3))
```
## Parity
`test/fixtures/golden/filtergraphs.json` pins each spec → filtergraph. The
fixtures **are the executor's real output**; `tests/reelforge/test_render_core_parity.py`
imports `compose_ffmpeg` and asserts the executor's layout / audio builders equal
this library byte-for-byte, so the two can never silently drift.
```bash
# Python library ≡ goldens
PYTHONPATH=python python -m pytest test -q
# TypeScript ≡ goldens (rebuild dist first)
npm run build && npm run test:parity
# Executor ≡ library (run from apps/api, where `app` imports)
python -m pytest ../../tests/reelforge/test_render_core_parity.py -q
```