Write talking-head scripts and produce Instagram reels and YouTube shorts
96%
Does it follow best practices?
Impact
98%
1.07xAverage score across 8 eval scenarios
Low
Low-risk findings worth noting
#!/usr/bin/env python3
"""Will the app's own UI cover the captions? Preview and check platform safe zones.
Short-form apps draw their interface over the video: a top bar, the caption /
account block at the bottom, the like-comment-share rail on the right. Text
placed there is unreadable on a phone even when the export is perfect.
ZONES are APPROXIMATE fractions of a 9:16 frame, drawn from typical layouts —
the platforms do not publish fixed margins. TikTok says its safe zone depends
on caption length and ad format and ships downloadable templates instead
(https://ads.tiktok.com/help/article/tiktok-auction-in-feed-ads). When you
have the platform's template, pass it with --overlay; it wins over ZONES.
preview frames at the given times with the zones shaded (or the template
laid over), next to the same frames at phone size (270 px wide) —
read the captions there, not at full size
check which zones a caption band overlaps, per platform (JSON)
gen_captions.py burn runs the same check on the band it burned.
Exit codes: 0 written / no overlap; 1 overlap found (check) or bad input.
Usage:
safe_zones.py preview work/master_captioned.mp4 --platform tiktok --at 2,6,10 \\
--out work/safe_tiktok.png [--overlay tiktok_safe_zone.png]
safe_zones.py check --band 0.69,0.75 --width 0.65
"""
import argparse
import json
import subprocess
import sys
from pathlib import Path
ZONES_REVIEWED = "2026-11-08"
# (x0, y0, x1, y1) as fractions of width/height; approximate, see the header.
ZONES = {
"tiktok": {
"top": (0.0, 0.0, 1.0, 0.07),
"bottom": (0.0, 0.80, 1.0, 1.0),
"right rail": (0.86, 0.40, 1.0, 0.82),
},
"ig_reels": {
"top": (0.0, 0.0, 1.0, 0.06),
"bottom": (0.0, 0.78, 1.0, 1.0),
"right rail": (0.87, 0.45, 1.0, 0.85),
},
"yt_shorts": {
"top": (0.0, 0.0, 1.0, 0.06),
"bottom": (0.0, 0.80, 1.0, 1.0),
"right rail": (0.86, 0.40, 1.0, 0.82),
},
# LinkedIn's full-screen vertical player: back/menu bar, actions on the
# right, author and caption at the bottom. Approximate, like the others.
"linkedin": {
"top": (0.0, 0.0, 1.0, 0.08),
"bottom": (0.0, 0.78, 1.0, 1.0),
"right rail": (0.86, 0.45, 1.0, 0.85),
},
}
PREVIEW_W, PHONE_W = 540, 270
def overlaps(band, width, platform):
"""Zones of one platform that a horizontally centred caption box touches.
band: (y0, y1) fractions of height; width: fraction of frame width.
"""
y0, y1 = band
x0, x1 = 0.5 - width / 2, 0.5 + width / 2
hit = []
for name, (zx0, zy0, zx1, zy1) in ZONES[platform].items():
if x0 < zx1 and zx0 < x1 and y0 < zy1 and zy0 < y1:
hit.append(name)
return hit
def check_all(band, width, platforms=None):
return {p: overlaps(band, width, p) for p in (platforms or ZONES)}
def zone_filter(platform):
boxes = [
f"drawbox=x=iw*{x0}:y=ih*{y0}:w=iw*{x1 - x0:.3f}:h=ih*{y1 - y0:.3f}:color=red@0.35:t=fill"
for x0, y0, x1, y1 in ZONES[platform].values()
]
return ",".join(boxes)
def run(cmd):
try:
r = subprocess.run(cmd, capture_output=True, text=True)
except FileNotFoundError:
sys.exit("ffmpeg not found — install it (brew install ffmpeg)")
if r.returncode != 0:
sys.exit(f"ffmpeg failed:\n{r.stderr[-600:]}")
def preview(video, platform, times, out, overlay=None):
h = PREVIEW_W * 16 // 9
inputs, parts = [], []
for i, t in enumerate(times):
inputs += ["-ss", f"{t}", "-i", str(video)]
parts.append(f"[{i}:v]scale={PREVIEW_W}:{h},setsar=1,split[f{i}][p{i}]")
n = len(times)
if overlay:
inputs += ["-i", str(overlay)]
parts.append(
f"[{n}:v]scale={PREVIEW_W}:{h},format=rgba,split={n}"
+ "".join(f"[o{i}]" for i in range(n))
)
for i in range(n):
parts.append(f"[f{i}][o{i}]overlay=0:0[z{i}]")
else:
for i in range(n):
parts.append(f"[f{i}]{zone_filter(platform)}[z{i}]")
for i in range(n):
parts.append(f"[p{i}]scale={PHONE_W}:-2,pad={PREVIEW_W}:{h}:0:0:color=white[ph{i}]")
parts.append(f"[z{i}][ph{i}]hstack[c{i}]")
parts.append(
"".join(f"[c{i}]" for i in range(n)) + (f"vstack={n}[out]" if n > 1 else "null[out]")
)
Path(out).parent.mkdir(parents=True, exist_ok=True)
run(
[
"ffmpeg",
"-y",
"-v",
"error",
*inputs,
"-filter_complex",
";".join(parts),
"-map",
"[out]",
"-frames:v",
"1",
str(out),
]
)
def parse_pair(text, name):
try:
a, b = (float(x) for x in text.split(","))
except ValueError:
sys.exit(f"{name} must be two numbers, e.g. 0.69,0.75")
if not 0 <= a < b <= 1:
sys.exit(f"{name} must satisfy 0 <= start < end <= 1")
return a, b
def main():
ap = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
)
sub = ap.add_subparsers(dest="cmd", required=True)
pv = sub.add_parser("preview")
pv.add_argument("video")
pv.add_argument("--platform", choices=sorted(ZONES), required=True)
pv.add_argument("--at", default="2", help="comma-separated seconds")
pv.add_argument("--out", required=True)
pv.add_argument("--overlay", help="the platform's official safe-zone template (PNG)")
ck = sub.add_parser("check")
ck.add_argument("--band", required=True, help="caption top,bottom as height fractions")
ck.add_argument("--width", type=float, default=0.7, help="caption width fraction")
a = ap.parse_args()
if a.cmd == "preview":
try:
times = [float(t) for t in a.at.split(",") if t.strip()]
except ValueError:
sys.exit("--at takes comma-separated seconds")
if a.overlay and not Path(a.overlay).is_file():
sys.exit(f"--overlay {a.overlay} not found")
preview(a.video, a.platform, times, a.out, a.overlay)
print(
json.dumps(
{
"out": a.out,
"platform": a.platform,
"zones": "template" if a.overlay else f"approximate ({ZONES_REVIEWED})",
}
)
)
return
band = parse_pair(a.band, "--band")
result = check_all(band, a.width)
print(
json.dumps(
{
"band": band,
"width": a.width,
"overlaps": result,
"zones": f"approximate ({ZONES_REVIEWED})",
}
)
)
sys.exit(1 if any(result.values()) else 0)
if __name__ == "__main__":
main().tessl-plugin
skills
reel-builder
assets
references
scripts
yap-writer