Skip to content

Add script-to-beats compiler for continuous video episodes - #6229

Merged
atomantic merged 2 commits into
mainfrom
claim/issue-6225
Sep 4, 2026
Merged

Add script-to-beats compiler for continuous video episodes#6229
atomantic merged 2 commits into
mainfrom
claim/issue-6225

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • Adds server/lib/scriptVideoCompiler.js: a pure module that partitions a scene script into beat-level clip specs for chained/continuous video generation.
  • Partitions dialogue/action lines into beats bounded by word count and distinct-speaker count, never splitting a single line.
  • Estimates clip duration from spoken word count and snaps it to a target frame grid (uniform per-frame, or the MiniMax H3 family's 17n+5 grid).
  • Injects byte-stable "Bible" descriptors (style/location/cast) into each beat's prompt so the same cast/location entry reads identically across clips.
  • Formats dialogue into explicit S1 (Speaker, voice): "..." clauses.
  • Enforces a max chain length (default 6 clips) before forcing a fresh re-establish cut; every scene boundary also starts fresh.
  • Registers the module in the server/lib barrel + README per the module-organization convention.

First slice of the continuous-video-episode epic (#6217) — the prompt linter (#6226) and orchestrator (#6227) build on this.

Test plan

  • cd server && npx vitest run lib/scriptVideoCompiler.test.js — 16 new unit tests covering beat partitioning, frame-grid snapping (both grids), dialogue formatting, byte-identical descriptor reuse, and the chain-length/scene-boundary fresh-cut rules.
  • cd server && npx vitest run lib/index.test.js — barrel/README registration guard.
  • cd server && npx vitest run lib/ — full server/lib suite (467 files, 10522 tests) green.
  • Reviewed locally with opencode against the branch diff; findings applied (cloned the shared speaker array before returning it on a clip spec, replaced an O(n²) per-line word rescan with a running counter).

Closes #6225

Pure module that partitions a scene script into beat-level video clip
specs: word-count-driven duration snapped to a target frame grid
(uniform or the MiniMax H3 family's 17n+5 grid), byte-stable bible
descriptor injection for cast/locations/style, explicit speaker-clause
dialogue formatting, and a max-chain-length rule that forces a fresh
re-establish cut every N clips. First slice of the continuous-video
episode feature (#6217); the prompt linter (#6226) and orchestrator
(#6227) build on this.
Copy the beat speaker array before handing it out on a clip spec
(the source array is shared with partitionLinesIntoBeats' internal
beat object), and replace the O(n^2) per-line beatWordCount rescan
with a running word counter.
@atomantic
atomantic merged commit 6597b64 into main Sep 4, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6225 branch September 4, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Script-to-Beats Compiler for continuous video episodes

1 participant