feat(pipeline): per-clip-pair morph manifest + member-pair baking (154 clips)

Tasks 1-2 of the altitude clip-pair morph plan. Manifest emits a morph
entry for every video pair in adjacent altitudes, both directions
(<src>__<dst>.mp4 zoom-in + .rev zoom-out); generate_media() bakes them
all via the existing xfade=zoomin recipe keyed by clip member.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BenStullsBets
2026-06-27 07:04:29 -07:00
parent 3b3d30e8e0
commit cc469b5298
2 changed files with 87 additions and 21 deletions
+31 -21
View File
@@ -372,10 +372,15 @@ def build_manifest() -> dict:
for s in RING_ORDER
]
transitions = []
n = len(RING_ORDER)
for i in range(n):
a, b = RING_ORDER[i], RING_ORDER[(i + 1) % n]
transitions.append({"file": f"transitions/{a}-{b}.mp4", "model": "placeholder-zoom"})
for H, L in _adjacent_edges(): # H higher altitude, L lower
for h in POOLS[H]:
for l in POOLS[L]:
transitions.append({"from": h, "to": l,
"file": f"transitions/{h}__{l}.mp4", # zoom IN (descend)
"model": "placeholder-zoom"})
transitions.append({"from": l, "to": h,
"file": f"transitions/{h}__{l}.rev.mp4", # zoom OUT (ascend)
"model": "placeholder-zoom"})
return {"clips": clips, "ring": {"scales": scales, "transitions": transitions}}
@@ -388,14 +393,19 @@ def _ffmpeg() -> str:
return imageio_ffmpeg.get_ffmpeg_exe()
def _make_transition(ff: str, scale_a: str, scale_b: str) -> Path:
"""A zoom/warp morph between two scales, from their PRIMARY pool members'
bases (mirrors setup_scales_media.py but keyed by scale->primary). This is the
recipe behind the well-liked orbit-coast edge; generate_media() now applies it
uniformly to every edge so none carry stale footage from an earlier ring."""
a = MEDIA / POOLS[scale_a][0] / "base.mp4"
b = MEDIA / POOLS[scale_b][0] / "base.mp4"
out = MEDIA / "transitions" / f"{scale_a}-{scale_b}.mp4"
def _adjacent_edges() -> list[tuple[str, str]]:
"""Ordered (higher, lower) altitude edges around the ring, including the wrap."""
n = len(RING_ORDER)
return [(RING_ORDER[i], RING_ORDER[(i + 1) % n]) for i in range(n)]
def _make_transition(ff: str, src_clip: str, dst_clip: str) -> Path:
"""A zoom/warp morph between two CLIP MEMBERS' base footage (the well-liked
orbit-coast recipe), keyed by clip id so every adjacent member pair gets its
own morph. Forward = zoom IN (descend src->dst)."""
a = MEDIA / src_clip / "base.mp4"
b = MEDIA / dst_clip / "base.mp4"
out = MEDIA / "transitions" / f"{src_clip}__{dst_clip}.mp4"
out.parent.mkdir(parents=True, exist_ok=True)
norm = "trim=0:3,setpts=PTS-STARTPTS,scale=1280:720,fps=25,setsar=1,format=yuv420p"
subprocess.run([
@@ -420,16 +430,16 @@ def _make_reverse(ff: str, forward: Path) -> Path:
def generate_media() -> None:
"""(Re)build EVERY ring-edge transition from the current real primary bases —
the orbit-coast recipe applied uniformly, overwriting any stale clips left from
an earlier ring — plus a reversed companion per edge for zoom-out moves."""
"""Bake EVERY adjacent member-pair morph from real bases — forward (zoom in,
descend) plus its reversed companion (zoom out, ascend), for every pair of
clips in adjacent altitudes."""
ff = _ffmpeg()
n = len(RING_ORDER)
for i in range(n):
a, b = RING_ORDER[i], RING_ORDER[(i + 1) % n]
fwd = _make_transition(ff, a, b)
_make_reverse(ff, fwd)
print(f"generated transitions/{a}-{b}.mp4 (+ .rev) from real bases")
for H, L in _adjacent_edges():
for h in POOLS[H]:
for l in POOLS[L]:
fwd = _make_transition(ff, h, l)
_make_reverse(ff, fwd)
print(f"generated {len(POOLS[H]) * len(POOLS[L])} {H}__{L} morphs (+ .rev) from real bases")
def main(argv: list[str]) -> None: