Skip to content

Turn one topic into a finished Vox-style paper-collage explainer/ad video — automated end to end on Atlas Cloud + ffmpeg. An agent skill.

captions: on-brand cut-out paper letters (no band, never occludes video)

Alisa08085fdbcc3e59b6
diff --git a/scripts/assemble.py b/scripts/assemble.py
index eddb7ca..eedf068 100644
--- a/scripts/assemble.py
+++ b/scripts/assemble.py
@@ -101,8 +101,12 @@ def run(project_dir):
# ---- 3) captions (per beat) + watermark PNGs ----
cap_pngs = []
for bs in beat_spans:
- p = os.path.join(tmp, f"cap_{bs['beat']['id']}.png")
- text_overlay.render_caption(bs["beat"]["narration"], p, W, H)
+ beat = bs["beat"]
+ p = os.path.join(tmp, f"cap_{beat['id']}.png")
+ kf = next((s["keyframe_path"] for s in (beat.get("shots") or [beat])
+ if s.get("keyframe_path") and os.path.exists(s["keyframe_path"])), None)
+ acc = text_overlay.accent_color(kf) if kf else None
+ text_overlay.render_caption(beat["narration"], p, W, H, accent=acc)
cap_pngs.append(p)
wm_png = text_overlay.render_watermark(wm_text, os.path.join(tmp, "wm.png"), W, H)
diff --git a/scripts/text_overlay.py b/scripts/text_overlay.py
index e34217b..eff2e01 100644
--- a/scripts/text_overlay.py
+++ b/scripts/text_overlay.py
@@ -4,7 +4,7 @@ Text overlays via Pillow -> transparent PNG (this ffmpeg has no libass/drawtext,
so captions/watermark are rendered as images and composited with `overlay`).
"""
import os
-from PIL import Image, ImageDraw, ImageFont
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
FONT_BOLD = [
"/System/Library/Fonts/Supplemental/Arial Bold.ttf",
@@ -39,23 +39,58 @@ def _wrap(draw, text, fnt, max_w):
return lines
-def render_caption(text, out_path, W=1920, H=1080, margin_v=None):
- img = Image.new("RGBA", (W, H), (0, 0, 0, 0))
- d = ImageDraw.Draw(img)
- size = int(min(W, H) * 0.045) # size by short edge (works 16:9 & 9:16)
+def accent_color(image_path, default=(214, 64, 42)):
+ """Sample a vibrant color from a keyframe so the caption keyline travels with
+ each film's palette (Mexican -> pink/teal, Tang -> vermilion...). Fallback default."""
+ try:
+ im = Image.open(image_path).convert("RGB").resize((80, 80)).quantize(colors=24).convert("RGB")
+ except Exception:
+ return default
+ best, best_score = None, -1.0
+ for count, (r, g, b) in (im.getcolors(80 * 80) or []):
+ mx, mn = max(r, g, b), min(r, g, b)
+ if mx == 0:
+ continue
+ sat, val = (mx - mn) / mx, mx / 255.0
+ if sat < 0.45 or val < 0.35 or val > 0.92: # skip washed-out / too dark / too light
+ continue
+ score = sat * val * (count ** 0.3)
+ if score > best_score:
+ best, best_score = (r, g, b), score
+ return best or default
+
+
+def render_caption(text, out_path, W=1920, H=1080, margin_v=None, accent=None):
+ """Cut-out paper caption: cream letters + dark-ink edge + soft shadow, NO band
+ (never covers the video). `accent` (RGB) adds a per-beat colored keyline. Small
+ size (like the old captions) so it doesn't occlude the collage."""
+ size = int(min(W, H) * 0.045)
if margin_v is None:
margin_v = int(H * 0.06)
fnt = _font(FONT_BOLD, size)
- lines = _wrap(d, text, fnt, int(W * 0.8))
- lh = int(size * 1.32)
- total_h = lh * len(lines)
- y = H - margin_v - total_h
- for ln in lines:
- w = d.textlength(ln, font=fnt)
- x = (W - w) / 2
- d.text((x, y), ln, font=fnt, fill=(255, 255, 255, 255),
- stroke_width=max(2, size // 12), stroke_fill=(0, 0, 0, 235))
- y += lh
+ img = Image.new("RGBA", (W, H), (0, 0, 0, 0))
+ d0 = ImageDraw.Draw(img)
+ lines = _wrap(d0, text, fnt, int(W * 0.8))
+ lh = int(size * 1.3)
+ y0 = H - margin_v - lh * len(lines)
+ pos = [((W - d0.textlength(ln, font=fnt)) / 2, y0 + i * lh, ln) for i, ln in enumerate(lines)]
+ ow = max(3, round(size * 0.13)) # ink edge
+ # soft shadow halo — keeps text legible over bright art, minimal darkening
+ sh = Image.new("RGBA", (W, H), (0, 0, 0, 0))
+ sd = ImageDraw.Draw(sh)
+ for x, y, t in pos:
+ sd.text((x + 3, y + 4), t, font=fnt, fill=(8, 6, 3, 190),
+ stroke_width=ow, stroke_fill=(8, 6, 3, 190))
+ img = Image.alpha_composite(img, sh.filter(ImageFilter.GaussianBlur(5)))
+ d = ImageDraw.Draw(img)
+ if accent: # per-beat colored keyline
+ a = tuple(accent[:3]) + (255,)
+ kw = max(4, round(size * 0.14))
+ for x, y, t in pos:
+ d.text((x, y), t, font=fnt, fill=a, stroke_width=ow + kw, stroke_fill=a)
+ for x, y, t in pos: # cream cut-out letters + ink edge
+ d.text((x, y), t, font=fnt, fill=(252, 246, 232, 255),
+ stroke_width=ow, stroke_fill=(32, 22, 18, 255))
img.save(out_path)
return out_path
@@ -83,15 +118,15 @@ def render_title(text, out_path, W=1080, H=1920, sub=None):
def render_watermark(text, out_path, W=1920, H=1080):
+ # same cut-out treatment as captions (no black box): cream text + ink edge
img = Image.new("RGBA", (W, H), (0, 0, 0, 0))
d = ImageDraw.Draw(img)
- size = int(min(W, H) * 0.024) # size by short edge
+ size = int(min(W, H) * 0.022)
fnt = _font(FONT_REG, size)
tw = d.textlength(text, font=fnt)
- pad = 14
- x, y = W - tw - 28 - pad, H - size - 28 - pad
- d.rounded_rectangle([x - pad, y - pad, x + tw + pad, y + size + pad + 4],
- radius=8, fill=(0, 0, 0, 90))
- d.text((x, y), text, font=fnt, fill=(255, 255, 255, 210))
+ x, y = W - tw - 30, H - size - 30
+ ow = max(2, round(size * 0.14))
+ d.text((x, y), text, font=fnt, fill=(250, 244, 232, 225),
+ stroke_width=ow, stroke_fill=(18, 12, 8, 205))
img.save(out_path)
return out_path
diff --git a/vox-director.skill b/vox-director.skill
index 5c93929..9436322 100644
Binary files a/vox-director.skill and b/vox-director.skill differ