Skip to content

gooseworks-ai/goose-skills / skills/video/render-proof-points-overlay

render-proof-points-overlay

Verified

Build the deterministic PIL pill overlays for a 'perfect-score + proof-points' UGC video ad (white 10/10 score header with a medal + orange sub with a finger-down + 3-4 green-check proof pills) and composite them onto a base clip in a diagonal L->R->L->R cascade, then mux the music bed into master-final.mp4. Config-driven (config.json), 1080x1920 9:16, FREE and deterministic (no paid calls, text stays pixel-crisp). Use for the overlay-proof-points format; the base clip + music come from separate paid capabilities.

FileKindSize
SKILL.mdskill md5.1 KB
references/music.mdmarkdown1.2 KB
scripts/build_overlays.pyscript9.2 KB
scripts/compose_master.pyscript5.4 KB
scripts/fetch_icons.pyscript1.0 KB
scripts/music_coverage.pyscript4.5 KB
skill.meta.jsonconfig237 B
tests/smoke-test.mdmarkdown697 B
tests/test_layout.pyscript3.2 KB
tests/test_music.pyscript7.4 KB

scripts/music_coverage.py

View on GitHub
"""Check an approved music bed and optionally extend a reviewed instrumental.

This checks audible coverage, not musical quality. Looping remains opt-in and
requires listening to the joins in the finished master.
"""
from array import array
import math
from pathlib import Path
import subprocess
import sys

RATE = 16000
WINDOW = 0.02
MAX_GAP = 0.35
FLOOR = 10 ** (-55 / 20)


def levels(path, seconds):
    result = subprocess.run([
        "ffmpeg", "-v", "error", "-i", str(path), "-t", str(seconds),
        "-vn", "-ac", "1", "-ar", str(RATE), "-f", "s16le", "-",
    ], check=True, capture_output=True)
    samples = array("h", result.stdout)
    if sys.byteorder != "little":
        samples.byteswap()
    width = round(RATE * WINDOW)
    rms = [
        math.sqrt(sum(v * v for v in samples[i:i + width]) / len(samples[i:i + width])) / 32768
        for i in range(0, len(samples), width)
    ]
    return len(samples) / RATE, rms


def has_gap(rms, threshold):
    gap = 0
    for level in rms:
        gap = gap + 1 if level < threshold else 0
        if gap * WINDOW > MAX_GAP:
            return True
    return False


def coverage(path, seconds, fade=0.5):
    length, rms = levels(path, seconds)
    if length < seconds - WINDOW:
        return f"music is {length:.2f}s long; the master needs {seconds:.2f}s"
    if not rms or max(rms) < FLOOR:
        return "music has no audible content"
    threshold = max(FLOOR, max(rms) * 10 ** (-30 / 20))
    count = max(1, math.ceil((seconds - fade) / WINDOW))
    if has_gap(rms[:count], threshold):
        return "music has an inaudible gap before the final fade"
    # An internal rest may be brief, but a terminal rest must not borrow the
    # final fade window and silently extend the ending. Require music at its edge.
    if rms[count - 1] < threshold:
        return "music ends before the final fade"
    return None


def prepare_music(source, output, seconds, loop=False):
    if isinstance(seconds, bool) or not isinstance(seconds, (int, float)) or not math.isfinite(seconds) or not 0 < seconds <= 180:
        raise ValueError("duration_sec must be a positive number at most 180")
    source, output = Path(source), Path(output)
    if not source.is_file():
        raise ValueError("missing music bed; supply approved music or explicitly use --no-music for a silent preview")
    fade = min(0.5, seconds / 2)
    problem = coverage(source, seconds, fade)
    looped = False
    if problem and not loop:
        raise ValueError(problem + "; supply a full-length bed or use --loop-music for a reviewed loopable instrumental")
    command = ["ffmpeg", "-y", "-v", "error", "-i", str(source)]
    if problem:
        _, rms = levels(source, seconds)
        peak = max(rms, default=0)
        active = [i for i, level in enumerate(rms) if level >= max(FLOOR, peak * 0.25)]
        if not active:
            raise ValueError("music has no usable instrumental section; supply a replacement")
        start, end = active[0] * WINDOW, (active[-1] + 1) * WINDOW
        span = end - start
        if span < 2 or has_gap(rms[active[0]:active[-1] + 1], max(FLOOR, peak * 10 ** (-30 / 20))):
            raise ValueError("music has no continuous section of at least 2s; supply a replacement")
        crossfade = min(0.5, span / 4)
        copies = max(2, math.ceil(max(0, seconds - span) / (span - crossfade)) + 1)
        if copies > 64:
            raise ValueError("music would need too many joins; supply a longer replacement")
        graph = [f"[0:a]atrim=start={start}:end={end},asetpts=PTS-STARTPTS,asplit={copies}" +
                 "".join(f"[a{i}]" for i in range(copies))]
        previous = "a0"
        for i in range(1, copies):
            current = f"join{i}"
            graph.append(f"[{previous}][a{i}]acrossfade=d={crossfade}:c1=tri:c2=tri[{current}]")
            previous = current
        graph.append(f"[{previous}]atrim=duration={seconds},afade=t=out:st={seconds - fade}:d={fade}[music]")
        command += ["-filter_complex", ";".join(graph), "-map", "[music]"]
        looped = True
    else:
        command += ["-vn", "-af", f"afade=t=out:st={seconds - fade}:d={fade}"]
    output.parent.mkdir(parents=True, exist_ok=True)
    subprocess.run(command + ["-t", str(seconds), "-c:a", "pcm_s16le", str(output)], check=True)
    failure = coverage(output, seconds, fade)
    if failure:
        raise ValueError(failure + "; prepared music failed coverage; supply a replacement")
    return {"duration_sec": seconds, "looped": looped, "fade_sec": fade,
            "listening_review_required": looped}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall