umpirix/hackathons/geekroom-2026/build-demo-video.py
caelum0x c3a9709bcf fix(geekroom-2026): deck overflow audit + 120s narrated demo video
Rendered all 11 PITCH-DECK slides to PNG and found 8 of 11 silently
truncating real content off the bottom of the frame (no visual cue,
content just cut) -- fixed with a tighter style: block and by trimming
one slide's duplicate repo-link paragraph, not by dropping any claim.
Added a PDF export alongside the existing PPTX.

Upgraded demo.mp4 from a 33s silent capture to a 120s narrated cut built
entirely from real material: the same real Playwright-captured UI frames
(re-timed, never fabricated), a real Deepgram Aura-2 narration track with
nova-3 round-trip-verified word timing driving burned-in captions, and a
few plain typographic title/outro cards (build-demo-video.py). Mastered
to -14.6 LUFS / -2.3 dBTP. Original capture kept as
demo-v1-33s-silent.mp4 for provenance.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-11 01:14:33 +03:00

235 lines
8.4 KiB
Python

#!/usr/bin/env python3
"""
Reproducibility script for the 2026-11-11 narrated Geek Room demo video
(hackathons/geekroom-2026/demo.mp4, ~120s). Kept as a reference for how the asset was
built, not wired to run unattended (the heavy intermediate frame dirs are not checked
in — see the regeneration steps below).
Composites real Playwright screen-capture frames (re-extracted at 15fps from the
pre-upgrade capture, `demo-v1-33s-silent.mp4`, via
`ffmpeg -i demo-v1-33s-silent.mp4 -vf fps=15 src_frames/f%05d.png`) with typographic
title cards and a burned-in, per-line caption bar (with a word-level highlight) driven
by `narration-lines.json` — the real Deepgram Aura-2 narration + nova-3
round-trip-verified word timings produced by `plans/gtm/tools/deepgram_voice.py`
(external to this repo; needs `DEEPGRAM_API_KEY`) from `narration-script.json`.
No AI-generated footage anywhere: every "demo" frame is a real captured UI pixel
(occasionally slowed down / held / gently zoomed by index-remapping or cropping real
frames); every "card" frame is plain code-rendered typography (PIL + system fonts).
Regeneration, in order:
1. `python3 plans/gtm/tools/deepgram_voice.py --script narration-script.json --out .`
(writes `narration-lines.json` + `voice.wav`, real TTS + ASR round-trip verified)
2. `ffmpeg -i demo-v1-33s-silent.mp4 -vf fps=15 src_frames/f%05d.png`
3. `python3 build-demo-video.py` (writes `out_frames/o%05d.png`)
4. `ffmpeg -framerate 15 -i out_frames/o%05d.png -c:v libx264 -pix_fmt yuv420p -crf 18 novoice.mp4`
5. master `voice.wav` to -14 LUFS / <=-1.5 dBTP (static gain + `alimiter`, not
`loudnorm` apply mode — see the products-repo video doctrine) and mux onto
`novoice.mp4` with `-c:v copy -c:a aac`.
"""
import json
from pathlib import Path
from PIL import Image, ImageDraw, ImageFont
HERE = Path(__file__).resolve().parent
SRC_FRAMES = HERE / "src_frames"
OUT_FRAMES = HERE / "out_frames"
LINES = json.loads((HERE / "narration-lines.json").read_text())["lines"]
TOTAL_DUR = json.loads((HERE / "narration-lines.json").read_text())["duration"]
FPS = 15
W, H = 1280, 800
BG = (8, 9, 12)
FG = (240, 240, 245)
ACCENT = (255, 200, 90)
DIM = (150, 155, 165)
FONT_DIR = Path("/System/Library/Fonts/Supplemental")
F_BOLD = str(FONT_DIR / "Arial Bold.ttf")
F_REG = str(FONT_DIR / "Arial.ttf")
F_MONO = "/System/Library/Fonts/Supplemental/Andale Mono.ttf"
def font(path, size):
return ImageFont.truetype(path, size)
N_SRC = len(sorted(SRC_FRAMES.glob("f*.png")))
def src_frame(idx: int) -> Image.Image:
idx = max(0, min(N_SRC - 1, idx))
return Image.open(SRC_FRAMES / f"f{idx + 1:05d}.png").convert("RGB")
# ---- segments -------------------------------------------------------------
# kind: "card" (typographic) | "demo" (remapped real frames) | "freeze" (one real
# frame, held, gentle zoom across the whole freeze span)
SEGMENTS = [
dict(kind="card", t0=0.0, t1=10.0, id="l1",
head=["Most AI benchmarks ask", "one question:"],
sub="Did the model get the right answer?"),
dict(kind="card", t0=10.0, t1=20.0, id="l2",
head=["An agent that SOUNDS confident", "—and is still wrong—"],
sub="is dangerous in a way accuracy never shows."),
dict(kind="card", t0=20.0, t1=32.0, id="l3",
head=["OpenJev", "Benchmark Submissions"],
sub="Submit your own model. Same 93-case gold suite.\nSame scoring engine OpenJev's own models use."),
dict(kind="demo", t0=32.0, t1=44.0, src=(0.0, 7.0)),
dict(kind="demo", t0=44.0, t1=56.0, src=(7.0, 18.0)),
dict(kind="demo", t0=56.0, t1=68.0, src=(18.0, 23.0)),
dict(kind="freeze", t0=68.0, t1=90.0, src_t=24.0, zoom=(1.0, 1.07)),
dict(kind="demo", t0=90.0, t1=102.0, src=(26.0, 32.0)),
dict(kind="card", t0=102.0, t1=114.0, id="l10",
head=["Benchmarking agents,", "not just models."],
sub="Execution + robustness — not only accuracy."),
dict(kind="card", t0=114.0, t1=TOTAL_DUR, id="l11",
head=["Open source."],
sub="github.com/caelum0x/openjev\nnpm run dev → /submit-model"),
]
CAPTION_SEGMENT_KINDS = {"demo", "freeze"}
def wrap_lines(draw, text, f, max_w):
words = text.split()
lines, cur = [], ""
for w in words:
trial = (cur + " " + w).strip()
if draw.textlength(trial, font=f) <= max_w:
cur = trial
else:
if cur:
lines.append(cur)
cur = w
if cur:
lines.append(cur)
return lines
def render_card(seg):
img = Image.new("RGB", (W, H), BG)
d = ImageDraw.Draw(img)
# thin top/bottom rule + tiny brand tag, kept minimal
d.text((48, 40), "OPENJEV", font=font(F_MONO, 20), fill=DIM)
d.text((W - 48, 40), "GEEK ROOM GLOBAL AI HACKATHON", font=font(F_MONO, 14),
fill=DIM, anchor="ra")
f_head = font(F_BOLD, 54)
f_sub = font(F_REG, 30)
head_lines = seg["head"]
total_h = len(head_lines) * 66
y = H // 2 - total_h // 2 - 40
for hl in head_lines:
w = d.textlength(hl, font=f_head)
d.text(((W - w) / 2, y), hl, font=f_head, fill=FG)
y += 66
y += 20
for sl in seg["sub"].split("\n"):
w = d.textlength(sl, font=f_sub)
d.text(((W - w) / 2, y), sl, font=f_sub, fill=ACCENT if sl.startswith("github") or "run dev" in sl else DIM)
y += 40
d.text((W / 2, H - 50), "hackculture.io · “Benchmarking Platform for AI Agents, Not Just Models”",
font=font(F_MONO, 15), fill=DIM, anchor="mm")
return img
def demo_frame_for(seg, t):
a, b = seg["src"]
local = (t - seg["t0"]) / (seg["t1"] - seg["t0"])
src_t = a + local * (b - a)
idx = int(round(src_t * FPS))
return src_frame(idx)
def freeze_frame_for(seg, t):
base = src_frame(int(round(seg["src_t"] * FPS)))
local = (t - seg["t0"]) / (seg["t1"] - seg["t0"])
z0, z1 = seg["zoom"]
z = z0 + (z1 - z0) * local
cw, ch = int(W / z), int(H / z)
# anchor the zoom on the content pane (right of the nav sidebar), not dead-center
cx, cy = int(W * 0.62), int(H * 0.52)
left = max(0, min(W - cw, cx - cw // 2))
top = max(0, min(H - ch, cy - ch // 2))
crop = base.crop((left, top, left + cw, top + ch))
return crop.resize((W, H), Image.LANCZOS)
def active_line(t):
for L in LINES:
if L["start"] - 0.05 <= t <= L["start"] + L["dur"] + 0.35:
return L
return None
def draw_captions(img, t):
L = active_line(t)
if not L:
return img
d = ImageDraw.Draw(img, "RGBA")
f = font(F_BOLD, 30)
text = L["text"]
max_w = W - 160
lines = wrap_lines(d, text, f, max_w)[:2]
line_h = 40
bar_h = line_h * len(lines) + 36
bar_top = H - bar_h - 28
d.rounded_rectangle([40, bar_top, W - 40, H - 28], radius=14, fill=(5, 6, 9, 185))
# word -> active (currently spoken) lookup for the highlight color
words = L["words"]
y = bar_top + 18
for wrapped in lines:
toks = wrapped.split()
total_w = sum(d.textlength(tk + " ", font=f) for tk in toks)
x = (W - total_w) / 2
for tk in toks:
# find a spoken word whose cleaned text roughly matches tk, for timing
color = FG
for w in words:
if w["w"].strip(".,:;!?—").lower() == tk.strip(".,:;!?—").lower():
if w["start"] - 0.05 <= t <= w["end"] + 0.15:
color = ACCENT
break
d.text((x, y), tk, font=f, fill=color)
x += d.textlength(tk + " ", font=f)
y += line_h
return img
def main():
OUT_FRAMES.mkdir(exist_ok=True)
n_out = int(round(TOTAL_DUR * FPS))
card_cache = {}
for i in range(n_out):
t = i / FPS
seg = next(s for s in SEGMENTS if s["t0"] - 1e-6 <= t < s["t1"] or (i == n_out - 1 and t <= s["t1"]))
if seg["kind"] == "card":
key = seg["id"]
if key not in card_cache:
card_cache[key] = render_card(seg)
img = card_cache[key].copy()
elif seg["kind"] == "demo":
img = demo_frame_for(seg, t)
else:
img = freeze_frame_for(seg, t)
if seg["kind"] in CAPTION_SEGMENT_KINDS:
img = draw_captions(img, t)
img.save(OUT_FRAMES / f"o{i:05d}.png")
if i % 150 == 0:
print(f"frame {i}/{n_out} t={t:.1f}s seg={seg['kind']}")
print(f"wrote {n_out} frames to {OUT_FRAMES}")
if __name__ == "__main__":
main()