# fireship-style-edit

Adopt this skill: https://proskills.md/skills/other/kevinbadi-open-edits-skills-fireship-style-edit

Page: https://proskills.md/skills/other/kevinbadi-open-edits-skills-fireship-style-edit
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/fireship-style-edit/SKILL.md
size: 13897
sha: de840ac47ee20575b7475fcf90599f44797d64e0
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/SKILL.md

````text
---
name: fireship-style-edit
description: Edit or build a FACELESS, Fireship "Code Report"-style tech news video (16:9, 1920x1080) — narrator never on screen, 100% B-roll that LITERALLY shows what each line says (footage of the actual person/event via fetch_footage.py, real article/doc screenshots with an orange highlighter sweep, tweet cards with X mark + profile pictures, headline card stacks, background-removed cutouts, meme cut-ins, slapped-on sticker text, built-up systems diagrams, glitch cuts) hard-cut every ~2 s over a continuous music bed at ~210 wpm deadpan narration. Use when Kevin asks for "Fireship style", a Code Report / news-roundup / "everything you missed" video, a faceless tech explainer, or a voiceover-driven B-roll edit. His own talking-head footage goes to longform-animated-talking-head / split-animated-talking-head instead.
---

# Fireship-style edit (faceless "Code Report" format)

Learned 2026-09-29 by reverse-engineering Fireship's *"Meta is pivoting again… everything you missed
from Connect 2026"* (5:40, 1080p, 23.976 fps). Full study (transcript with word times, cut list,
per-shot contact sheets, dense in-shot frame sheets, audio measurements):
`clone-projects/fireship-style-study/` (historical, not bundled) (`frames/sheet_*.jpg`, `frames/zoom_*.jpg`, `audio/`, `cuts/`).
**Learn the grammar; never copy their assets.** No Fireship footage, music, logo or the name
"Code Report" in our videos. Our show title is our own (default "The Kev Report").

Engine: `templates/fireship_engine.py`. Template + device demo: `templates/render_template.py`.
Real event footage: `scripts/fetch_footage.py` (yt-dlp search → download → 1 s contact sheet → accurate cut).
Real docs: `wikipedia_extract()` + `wiki_doc()` in the engine (REST API, no browser).
`scripts/capture_page.mjs` needs Playwright: optional, never the default (Kevin 2026-10-02: no browser automation for assets).
Demo of every device: `~/Downloads/Fireship Style Demo Reel.mp4` (built from `clone-projects/fireship-demo/` (historical, not bundled)).

## 0. LITERAL VISUALS (Kevin 2026-10-02, first test edit review)

> "the edit can be even more descriptive of what's being said ... in the intro it should LITERALLY be
> the prime president of australia speaking."

The picture shows **exactly what the sentence says**, as literally as footage allows:

- **A person did something** → footage of THAT person doing it (the PM at the UN podium speaking,
  Jensen on stage holding the chip). Find it with `fetch_footage.py --search "<person> <event>"`.
  A flag, a city skyline or a logo is NOT a substitute for the person; it is at most an overlay.
- **A company did something** → its product/event footage or its own page, plus the logo as an overlay.
- **People reacted** → tweet cards (with platform mark + profile pictures, see below) or reaction memes.
- **An abstract mechanism** → the built-up diagram.
- A shot that is only a logo/sticker on black is the **last resort**, at most 1 in 8 shots.
- Write the shot list as `time | exact VO words | what is literally on screen | source` and reject any
  row where the screen doesn't depict the words.

**Tweet cards always look real (Kevin 2026-10-02: "the social icon was missing as well as the profile
picture of the tweeter").** `tweet_card()` now draws the X mark top-right, a profile picture and the
reply/repost/like/views row. Profile pictures: a real public figure → their real photo
(`split-animated-talking-head/scripts/fetch_figure.py` → `avatar="assets/figures/<slug>.png"`); a
made-up handle → leave `avatar=None` for the generated gradient-initials avatar. Never put a random
real stranger's face on an invented post, and never invent words for a real person: a card with a real
person's name/photo must show a post they actually made (fetch the text, keep it verbatim). Jokes go on
made-up handles.

## 1. The numbers (measured, hit these)

| Metric | Fireship | Rule for us |
|---|---|---|
| Hard cuts | 107 in 340 s | a new shot every **~2.2 s median** (mean 3.2) |
| Element changes | new sticker / card / arrow every ~1–1.5 s inside shots | **nothing static > 1.5 s** |
| Longest shots | 31 s diagram build, 17 s doc highlight, 14 s phone-mock story | long shots are only allowed if they **build** (diagram grows, highlighter reads along, cards stack) |
| Narration | 1,207 words / 340 s = **213 wpm**, only 19 pauses > 0.35 s | jump-cut every breath out; VO is continuous |
| Narrator on screen | **never** | faceless, always |
| Burned-in captions | **none** | no subtitle track on screen (text appears only as stickers/cards) |
| Audio | continuous music bed ~2–3 dB under VO in gaps; loudness range **3.2 LU** | ducked bed + compressed VO, `mux()` normalises to −14 LUFS for YouTube |
| Aspect / fps | 16:9, 23.976 | 1920×1080, 30 fps (our stack) |

## 2. Script formula (Code Report structure, with timings from the study)

1. **Cold open, 0–65 s (~19%)**: first line is a deadpan absurd personal joke ("while I was finishing my
   certification to become a Metaverse real estate agent…"), then the news in one run-on sentence,
   the "and because [company] already knows what we're all thinking…" turn, then the promise:
   "In today's video we'll break down X, look at how it actually works under the hood, and find out
   if it's the future of Y or just [callback joke]."
2. **Date + title card, ~65 s**: "It is September 25th, 2026, and you're watching **[Show name]**." Title card on that line.
3. **History / context, 65–137 s**: "Now, this isn't [company]'s first attempt…" with an archival year label ("2018"), a stamp ("DISCONTINUED"), a punchline.
4. **How it works (the technical core), 137–198 s**: one long **diagram build** in sync with the narration, then the catch ("But ironically…", "and that's where he's still kind of lying").
5. **Rapid-fire product news, 198–277 s**: specs + price stickers ("$1,300", "$449"), famous-people B-roll with dry asides, one "one more thing".
6. **Sponsor, 277–332 s (~16%)**: segue from the last topic ("But if you'd rather not wait until December for… you can build… today with **[Sponsor]**"), a mini story told through the product's screen recordings.
7. **Outro, 8 s**: "This has been [Show name], thanks for watching, and I will see you in the next one." Title card + "link below" sticker.

**Voice rules**: deadpan, never hype words; a joke every ~10–15 s, usually as a hard-left turn at the
end of a factual sentence ("…send flowers to your wife's boyfriend"); callbacks to the cold-open
joke at the end of the intro; specific numbers and names always; pop-culture comparisons; mild
irreverence, but punch at companies and the powerful, not at groups of people. Keep sentences
long and rolling. The VO carries all the information; visuals carry the jokes.

## 3. Visual devices (engine function → when)

| Device | Engine | Use it when the VO… |
|---|---|---|
| Kinetic cold-open words on black | `kinetic_words()` | first 1–2 s, before the first image |
| Article/doc bursts in with a fisheye | `Layer(anim="bulge")` | introduces a source |
| **Orange highlighter read-along** | real text: `wiki_doc(title, wikipedia_extract(title), highlight, p)` or `doc_card(wrap_text(text), phrase_spans(...))` | quotes or paraphrases a doc: sweep p 0→1 across the spoken words |
| Full-bleed footage + slow push | `fetch_footage.py` → `video_bg(cut, 0)`; Commons photos → `image_bg()` | describes an event, product, person (**the literal person/event**, section 0) |
| Logo slide-in + red block name | `Layer(img=logo, anim="slide_left")` + `sticker(name, "red_block")` | names a product the first time |
| Tweet stack (tilted, overlapping) | `tweet_card(name, handle, text, avatar=…, stats=…)` ×2–3, tilts ±2–4°: X mark + profile pic + icon row always | "people online are saying…" |
| Headline card stack | `headline_card()` light + dark, stacked, offset | "reports say…", controversies |
| Cutout walking over a card | `cutout()` (make with `npx hyperframes remove-background` or rembg) | a person reacts to / owns the thing on screen |
| Reaction-face collage strip | `collage_strip()` | "everyone's reaction" |
| Meme cut-in (full frame, 0.5–1.5 s) | Giphy via `split-animated-talking-head/scripts/fetch_giphy.py`, `bg=` frames | every punchline; most GIFs have BURNED-IN captions ("HACKERMAN", "I confess!"): put stickers on the opposite edge, never over them |
| Sticker text slapped on | `sticker(txt, style)`: `red_block` `starburst` `comic` `pink_plate` `price_box` `price_pop` `stamp` `name_plate` `quote` `year` `red_caps` | prices, names, years, one-word reactions ("BUT", "*GULP*", "FREE!") |
| Hand-drawn curved pointer | `curved_arrow()` | points at the exact UI element or line being named |
| Systems diagram that builds | `draw_diagram([DiagramItem...])`: purple frame + pixel caption, orange dashed box + labels, green/cyan/cream blocks, white arrows, **red arrows for the attack/fail path**, dropped-in icons | "the way it works is…" (one per video, 20–40 s) |
| Glitch cut | `Shot(glitch_in=True)` | ~1 in 5 cuts, on topic changes and punchline reveals, never every cut |
| Show title card | `title_card("The Kev Report", date)` | the date line + the outro |

Composition rules seen in every frame:
- Cards sit on the **near-black ground** `(14,14,16)`, centered or offset, never framed in a UI chrome.
- Overlaps are deliberate: second card overlaps the first by ~15–25%, opposite tilt.
- Stickers are **big** (100–220 px text) and tilted −12…+10°; they pop in with overshoot and then hold still.
- Brand marks are real (fetch with `split-animated-talking-head/scripts/fetch_brand_asset.py`).
- Every beat lands **on the spoken word**: `at(WORDS, "word", after)`, max lead 0.1 s.

## 4. Pipeline

```bash
WD=clone-projects/<slug>-fireship && mkdir -p $WD/{audio,assets/{shots,logos,cutouts,gifs},frames} && cd $WD
cp "<skill>/templates/render_template.py" render.py
```

1. **Script** (section 2 formula, ~210 wpm → a 5 min video ≈ 1,050 words). Kevin records the VO, or
   ElevenLabs (voice id from `.env.local`), saved as `audio/voice.wav`. Jump-cut silences > 0.3 s
   (`ffmpeg silenceremove` or the HyperFrames CLI) before transcribing.
2. **Words**: Whisper `small.en` with `initial_prompt` = the product/people names → `audio/words.json`
   (`[[word, start, end]]`). Fix mishears first; every beat keys off it.
3. **Shot list**: walk the transcript, one Shot per ~2 s, one device per clause. Write it as a
   table (time | VO words | device | asset) before coding. Budget: ~1 meme per 15 s, 1 diagram, 3–6 doc
   highlights, 4–8 tweet/headline stacks, stickers everywhere.
4. **Assets** (before choreography, literal-first, section 0):
   - **Footage of the people/events named**:
     `python3 <skill>/scripts/fetch_footage.py --search "<person> <event>"` → `--id <id> --slug x` →
     `--slug x --sheet --from A --to B` (**1 frame per second**; a 5 s sheet picked the wrong moments in
     the first test) → `--slug x --cut START DUR` → `video_bg("assets/footage/x_START.mp4", 0)`.
     A YouTube 403 means a stale yt-dlp: the script runs `yt-dlp -U` and retries. Prefer uploads < 10 min.
   - Free stills: Wikimedia Commons API (`generator=search&gsrnamespace=6`) → `image_bg()`.
   - Docs: `wikipedia_extract("Prompt injection")` → `wiki_doc()`; other sites: fetch text with curl/APIs
     and `doc_card(wrap_text(...))`. No Playwright unless Kevin asks.
   - Logos (`fetch_brand_asset.py`), portraits for real tweeters (`fetch_figure.py`), Giphy memes, cutouts.
   - Build a contact sheet of everything and LOOK before choreographing.
5. **Author `render.py`**: `SHOTS = [Shot(t0, t1, bg=…, layers=[Layer(t0, t1, img=…, xy, tilt, anim)])]`
   with times from `at(WORDS, …)`.
6. **Preview**: `PREVIEW="1.0,5.2,…" python3 render.py` → tile the frames and LOOK (dead frames,
   stacked text collisions, a sticker covering the thing it points at).
7. **Render + mux**:
   ```bash
   N=$((DUR*30)); for i in 0 1 2 3; do RANGE="$((i*N/4)):$(((i+1)*N/4))" python3 render.py & done; wait
   python3 -c "from fireship_engine import mux; mux('frames/out','audio/voice.wav','assets/music_bed.mp3','renders/final.mp4')"
   cp renders/final.mp4 ~/Downloads/"<Readable Name>.mp4"
   ```
   Music bed: royalty-free/owned only (it runs the whole video, so it can't follow the 10 s rule below).

**Clip + audio policy (Kevin 2026-10-02):** any clip and any audio may be used in our edits (news and
event footage, memes, a creator's audio overlay). Rule: **no single third-party clip on screen for more
than 10 s in a row**; cut away and come back if needed. Don't add copyright caveats to deliveries.
Vertical version of this format: `fireship-style-short`.

## 5. Learnings
- **2026-10-02 first full test (prompt-injection cold open, 60 s, 27 cuts):** Kevin: "pretty good". Fixes now in
  the engine: tweet cards carry the X mark, profile pictures and the icon row; diagram labels are pixel 30
  (18 was unreadable on a phone); headline cards 1200 wide; `mux()` outputs 48 kHz (loudnorm had made it 96 kHz).
  Process fixes: literal visuals (section 0), 1 s contact sheets, stickers off burned-in GIF captions,
  footage via yt-dlp. Reference: `examples/prompt-injection-fireship/render.py`.

## 6. Don'ts
- No face cam, no captions track, no bottom progress bar.
- No static frame > 1.5 s, no shot > 3 s unless something is building.
- No generic stock "AI brain" imagery: every visual is the actual thing being discussed.
- No stand-ins for a named person (flag, skyline, logo) when footage of the person exists.
- No tweet card without the platform mark and a profile picture.
- No Fireship assets, music, logo, fonts-as-branding or the "Code Report" name.
- Em/en dashes stay out of on-screen sticker text (house rule).
````

## File: skills/fireship-style-edit/scripts/capture_page.mjs
size: 4836
sha: c6ca59141eb34e4ed651d7de9ee0d174b6458698
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/scripts/capture_page.mjs

```text
#!/usr/bin/env node
/**
 * capture_page.mjs: screenshot a real article / doc / tweet for Fireship-style B-roll, with the
 * orange highlighter applied IN THE PAGE (so it wraps real text perfectly) and an optional
 * "clean" pass that hides cookie banners, navbars and ads.
 *
 *   node capture_page.mjs --url <url> --out assets/shots/meta-post.png \
 *     [--selector "article"] [--highlight "phrase one" --highlight "phrase two"] \
 *     [--width 1400] [--scale 2] [--dark] [--boxes assets/shots/meta-post.boxes.json]
 *
 * --boxes writes the highlighted text rects (image px) so the engine's highlight_image()
 * can SWEEP the highlight in on the spoken words instead of showing it pre-filled: capture
 * once WITHOUT --highlight for the base image, once WITH --boxes for the rects.
 * Needs: npm i playwright (Chromium already cached under ~/Library/Caches/ms-playwright).
 */
import { chromium } from "playwright";
import fs from "node:fs";
import path from "node:path";

const args = process.argv.slice(2);
const get = (k, d) => { const i = args.indexOf(`--${k}`); return i >= 0 ? args[i + 1] : d; };
const all = (k) => args.flatMap((a, i) => (a === `--${k}` ? [args[i + 1]] : []));
const url = get("url");
const out = get("out");
if (!url || !out) { console.error("usage: --url <url> --out <png> [--selector css] [--highlight text]... [--boxes json]"); process.exit(1); }
const width = Number(get("width", 1400));
const scale = Number(get("scale", 2));
const selector = get("selector", "");
const highlights = all("highlight");
const boxesOut = get("boxes", "");

const browser = await chromium.launch();
const ctx = await browser.newContext({
  viewport: { width, height: 1000 }, deviceScaleFactor: scale,
  colorScheme: args.includes("--dark") ? "dark" : "light",
  userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126 Safari/537.36",
});
const page = await ctx.newPage();
await page.goto(url, { waitUntil: "domcontentloaded", timeout: 60000 });
await page.waitForTimeout(2500);
// clean pass: banners, sticky headers, ads, modals
await page.addStyleTag({ content: `
  [id*="cookie" i],[class*="cookie" i],[class*="consent" i],[id*="consent" i],[class*="newsletter" i],
  [class*="modal" i],[class*="popup" i],[class*="banner" i][class*="ad" i],iframe[src*="ads"],
  header[class*="sticky" i],[class*="paywall" i]{display:none!important}
  mark.fs-hl{background:#f7a458!important;color:inherit!important;padding:0 1px;border-radius:2px}` });
if (highlights.length) {
  await page.evaluate(([phrases, sel]) => {
    // Match across text nodes (links / <b> split a sentence into several nodes): build one
    // whitespace-normalised string with per-char node offsets, find the phrase, wrap each piece.
    const root = (sel && document.querySelector(sel)) || document.body;
    for (const phrase of phrases) {
      const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
      let flat = "", map = [], prevSpace = true;
      while (walker.nextNode()) {
        const n = walker.currentNode;
        for (let i = 0; i < n.nodeValue.length; i++) {
          const ch = n.nodeValue[i];
          const sp = /\s/.test(ch);
          if (sp && prevSpace) continue;
          flat += sp ? " " : ch.toLowerCase(); map.push([n, i]); prevSpace = sp;
        }
      }
      const q = phrase.toLowerCase().replace(/\s+/g, " ").trim();
      const at = flat.indexOf(q);
      if (at < 0) { console.log("highlight not found:", phrase); continue; }
      const pieces = new Map();
      for (let k = at; k < at + q.length; k++) {
        const [n, i] = map[k];
        const cur = pieces.get(n) || [i, i];
        pieces.set(n, [Math.min(cur[0], i), Math.max(cur[1], i)]);
      }
      for (const [n, [a, b]] of pieces) {
        const r = document.createRange();
        r.setStart(n, a); r.setEnd(n, b + 1);
        const m = document.createElement("mark"); m.className = "fs-hl";
        try { r.surroundContents(m); } catch {}
      }
    }
  }, [highlights, selector]);
}
const target = selector ? page.locator(selector).first() : null;
fs.mkdirSync(path.dirname(out), { recursive: true });
if (target) await target.screenshot({ path: out });
else await page.screenshot({ path: out });
if (boxesOut) {
  const origin = target ? await target.boundingBox() : { x: 0, y: 0 };
  const rects = await page.evaluate(() => [...document.querySelectorAll("mark.fs-hl")].flatMap((m) =>
    [...m.getClientRects()].map((r) => [r.left, r.top, r.right, r.bottom])));
  const boxes = rects.map(([l, t, r, b]) => [l - origin.x, t - origin.y, r - origin.x, b - origin.y].map((v) => Math.round(v * scale)));
  fs.writeFileSync(boxesOut, JSON.stringify(boxes));
  console.log(`✓ ${boxes.length} highlight boxes -> ${boxesOut}`);
}
console.log(`✓ ${out}`);
await browser.close();
```

## File: skills/fireship-style-edit/scripts/fetch_footage.py
size: 7552
sha: 393c9a53b62f6f41ae7ede1765ac7552b001db0d
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/scripts/fetch_footage.py

```text
#!/usr/bin/env python3
"""fetch_footage.py: real event footage for Fireship-style B-roll, via yt-dlp (no browser).

The literal-visuals rule: when the VO says "the Prime Minister of Australia stood up at the UN",
the shot is footage of that person at that podium. This finds it, downloads it, shows you a
timestamped contact sheet so you pick the exact moment, and cuts an accurate H.264 clip.

  # 1. find candidates (duration | id | title); prefer short uploads (< 10 min)
  python3 fetch_footage.py --search "Anthony Albanese UN General Assembly speech" --n 8

  # 2. download one whole video (<= 1080p). On a YouTube 403 / "page needs to be reloaded"
  #    it runs `yt-dlp -U` once and retries (a stale yt-dlp is the usual cause).
  python3 fetch_footage.py --id dQw4w9WgXcQ --slug albanese-un

  # 3. contact sheet, 1 frame per second (never pick moments off a 5 s sheet)
  python3 fetch_footage.py --slug albanese-un --sheet --from 30 --to 66
  #    -> frames/footage_albanese-un_30-66.jpg (timestamps burned in)

  # 4. cut the moment (video only, frame-accurate, 1920x1080 H.264)
  python3 fetch_footage.py --slug albanese-un --cut 41.5 3.0
  #    -> assets/footage/albanese-un_41.5.mp4   use with video_bg(path, 0.0)
  #    News uploads often show the event as a picture-in-picture panel (sidebar, QR code, logo bug):
  #    grab one full-res frame, measure the panel, and crop it out so the event is full-bleed:
  python3 fetch_footage.py --slug albanese-un --cut 50 4 --crop 85,41,1357,824

Run from the edit's workdir. Clip policy (Kevin 2026-10-02): any clip / audio may be used in our
edits; no single third-party clip stays on screen for more than 10 s in a row.
"""
from __future__ import annotations

import argparse
import os
import subprocess
import sys

DL_DIR = "assets/footage/src"
CUT_DIR = "assets/footage"
SHEET_DIR = "frames"
FMT = "bv*[height<=1080]+ba/b[height<=1080]"
STALE = ("403", "Forbidden", "page needs to be reloaded", "Requested format is not available", "Sign in to confirm")

def sh(cmd, check=True):
    r = subprocess.run(cmd, capture_output=True, text=True)
    if check and r.returncode != 0:
        raise RuntimeError((r.stderr or r.stdout).strip()[-800:])
    return r

def search(q: str, n: int) -> None:
    r = sh(["yt-dlp", "--no-warnings", "--flat-playlist", "--print", "%(duration)s|%(id)s|%(title)s", f"ytsearch{n}:{q}"])
    rows = []
    for ln in r.stdout.strip().splitlines():
        d, vid, title = (ln.split("|", 2) + ["", ""])[:3]
        try:
            d = float(d)
        except ValueError:
            d = -1
        rows.append((d, vid, title))
    for d, vid, title in sorted(rows, key=lambda x: (x[0] < 0, x[0])):
        mm = f"{int(d // 60)}:{int(d % 60):02d}" if d >= 0 else "?"
        print(f"{mm:>7}  {vid}  {title}")

def src_path(slug: str) -> str:
    return os.path.join(DL_DIR, f"{slug}.mp4")

def download(vid: str, slug: str, allow_long: bool) -> None:
    os.makedirs(DL_DIR, exist_ok=True)
    url = vid if vid.startswith("http") else f"https://www.youtube.com/watch?v={vid}"
    if not allow_long:
        d = sh(["yt-dlp", "--no-warnings", "--print", "%(duration)s", url], check=False).stdout.strip()
        try:
            if float(d) > 1200:
                sys.exit(f"{vid} is {float(d) / 60:.0f} min; pick a shorter upload or pass --allow-long")
        except ValueError:
            pass
    cmd = ["yt-dlp", "-q", "--no-warnings", "-f", FMT, "--merge-output-format", "mp4", "-o", src_path(slug), url]
    r = sh(cmd, check=False)
    if r.returncode != 0 and any(k in (r.stderr + r.stdout) for k in STALE):
        print("yt-dlp refused (stale client); updating with yt-dlp -U and retrying...", flush=True)
        print(sh(["yt-dlp", "-U"], check=False).stdout.strip().splitlines()[-1:] or "")
        for f in os.listdir(DL_DIR):
            if f.startswith(slug) and f.endswith(".part"):
                os.remove(os.path.join(DL_DIR, f))
        r = sh(cmd, check=False)
    if r.returncode != 0 or not os.path.exists(src_path(slug)):
        sys.exit("download failed: " + (r.stderr or r.stdout).strip()[-600:])
    dur = sh(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", src_path(slug)]).stdout.strip()
    print(f"ok {src_path(slug)}  ({float(dur):.1f}s)")

def sheet(slug: str, t0: float, t1: float, every: float) -> None:
    os.makedirs(SHEET_DIR, exist_ok=True)
    n = max(1, int((t1 - t0) / every))
    cols = 8 if n > 16 else 6
    rows = (n + cols - 1) // cols
    out = os.path.join(SHEET_DIR, f"footage_{slug}_{int(t0)}-{int(t1)}.jpg")
    font = "/System/Library/Fonts/Menlo.ttc"
    draw = (f"drawtext=fontfile={font}:text='%{{eif\\:t+{t0}\\:d}}':x=6:y=6:fontsize=20:fontcolor=yellow:box=1:boxcolor=black"
            if os.path.exists(font) else "null")
    sh(["ffmpeg", "-v", "error", "-y", "-ss", str(t0), "-t", str(t1 - t0), "-i", src_path(slug),
        "-vf", f"fps={1 / every},scale=320:-2,{draw},tile={cols}x{rows}", "-frames:v", "1", out])
    print(f"ok {out}  ({n} frames, every {every}s)")

def frame(slug: str, t: float) -> None:
    """One full-res still (for measuring a picture-in-picture panel before --crop)."""
    os.makedirs(SHEET_DIR, exist_ok=True)
    out = os.path.join(SHEET_DIR, f"footage_{slug}_{t:g}.png")
    sh(["ffmpeg", "-v", "error", "-y", "-ss", str(t), "-i", src_path(slug), "-frames:v", "1", out])
    print(f"ok {out}")

def cut(slug: str, start: float, dur: float, crop: str | None = None) -> None:
    os.makedirs(CUT_DIR, exist_ok=True)
    out = os.path.join(CUT_DIR, f"{slug}_{start:g}.mp4")
    pre = ""
    if crop:
        x, y, w, h = [int(v) for v in crop.split(",")]
        pre = f"crop={w}:{h}:{x}:{y},"
    sh(["ffmpeg", "-v", "error", "-y", "-ss", str(start), "-i", src_path(slug), "-t", str(dur), "-an",
        "-vf", pre + "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080,fps=30",
        "-c:v", "libx264", "-preset", "veryfast", "-crf", "17", "-pix_fmt", "yuv420p", out])
    print(f"ok {out}")

def main() -> None:
    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
    ap.add_argument("--search")
    ap.add_argument("--n", type=int, default=8)
    ap.add_argument("--id", help="YouTube id or full URL to download")
    ap.add_argument("--slug")
    ap.add_argument("--allow-long", action="store_true")
    ap.add_argument("--sheet", action="store_true")
    ap.add_argument("--from", dest="t0", type=float, default=0.0)
    ap.add_argument("--to", dest="t1", type=float, default=None)
    ap.add_argument("--every", type=float, default=1.0)
    ap.add_argument("--cut", nargs=2, type=float, metavar=("START", "DUR"))
    ap.add_argument("--crop", help="x,y,w,h in source px: keep only this panel (news picture-in-picture)")
    ap.add_argument("--frame", type=float, help="write one full-res still at this time (to measure --crop)")
    a = ap.parse_args()
    if a.search:
        search(a.search, a.n)
        return
    if not a.slug:
        sys.exit("--slug is required for --id / --sheet / --cut")
    if a.id:
        download(a.id, a.slug, a.allow_long)
    if a.sheet:
        t1 = a.t1
        if t1 is None:
            t1 = float(sh(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", src_path(a.slug)]).stdout)
        sheet(a.slug, a.t0, t1, a.every)
    if a.frame is not None:
        frame(a.slug, a.frame)
    if a.cut:
        cut(a.slug, a.cut[0], a.cut[1], a.crop)

if __name__ == "__main__":
    main()
```

## File: skills/fireship-style-edit/templates/assets/x-mark.png
size: 16276
sha: 3ed8a5dfe1f36d5e098222e8cf292dfba2995d12
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/assets/x-mark.png

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/assets/x-mark.png

## File: skills/fireship-style-edit/templates/fireship_engine.py
size: 42554
sha: 174ae50dcedf2e920a492f9f01e6879d65c65c03
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fireship_engine.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fireship_engine.py

## File: skills/fireship-style-edit/templates/fonts/Anton-Regular.ttf
size: 170812
sha: 4d65707db9d8663ccfa99cd28cd3a4e0025be178
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/Anton-Regular.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/Anton-Regular.ttf

## File: skills/fireship-style-edit/templates/fonts/Bangers-Regular.ttf
size: 93148
sha: 9b0f8c1f1b45e7bb4971b7d6a8604f9aacacdd32
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/Bangers-Regular.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/Bangers-Regular.ttf

## File: skills/fireship-style-edit/templates/fonts/Inter.ttf
size: 876576
sha: 047c92f6e2212473dc436020afed689527076d44
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/Inter.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/Inter.ttf

## File: skills/fireship-style-edit/templates/fonts/LuckiestGuy-Regular.ttf
size: 73320
sha: 5ca663c2f05761356ca4427c084e4443a157f834
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/LuckiestGuy-Regular.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/LuckiestGuy-Regular.ttf

## File: skills/fireship-style-edit/templates/fonts/Oswald-Bold.ttf
size: 86416
sha: 86812a0ee3554cdebb6dc2c7817af889f8e25909
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/Oswald-Bold.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/Oswald-Bold.ttf

## File: skills/fireship-style-edit/templates/fonts/PressStart2P-Regular.ttf
size: 118204
sha: 39adf42efa597906e53be689474ac82214112124
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/PressStart2P-Regular.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/PressStart2P-Regular.ttf

## File: skills/fireship-style-edit/templates/fonts/SpaceMono-Bold.ttf
size: 98232
sha: 2c4f2682f915d988e7314544ff7c9e38c8c733f5
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/SpaceMono-Bold.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/fonts/SpaceMono-Bold.ttf

## File: skills/fireship-style-edit/templates/render_template.py
size: 5837
sha: cd1f4bd6d91c0466877666a353ff6281fdc6853e
upstream: https://github.com/kevinbadi/open-edits/blob/main/skills/fireship-style-edit/templates/render_template.py

```text
#!/usr/bin/env python3
"""Fireship-style template + device demo reel. Copy into a workdir as render.py and replace SHOTS.

Real edits: narration drives everything. Put the VO at audio/voice.wav, transcribe to
audio/words.json ([[word, start, end], ...], small.en + initial_prompt of product names),
then time every Layer to the spoken word with at(WORDS, "word", after).
Demo mode (no audio/words.json): renders a ~24 s silent reel of every device.
"""
import glob
import os
import sys

HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, HERE)
from fireship_engine import *  # noqa: F401,F403
from PIL import Image

FOOTAGE = os.environ.get("DEMO_FOOTAGE", "")          # any 16:9 clip (keynote / screen recording)
LOGO = os.environ.get("DEMO_LOGO", "")                # a product logo PNG
GIF_DIR = os.environ.get("DEMO_GIF_DIR", "")          # a fetched Giphy frame dir (fetch_giphy.py)

def gif_frame(lt: float):
    fs = sorted(glob.glob(os.path.join(GIF_DIR, "f*.png"))) if GIF_DIR else []
    if not fs:
        return None
    return Image.open(fs[int(lt * 30) % len(fs)]).convert("RGBA")

logo = Image.open(LOGO).convert("RGBA").resize((260, 260)) if LOGO else None

DOC = [
    "VIKTOR is a personal AI agent. It doesn't just answer",
    "questions, it actually does the work. It helps teams",
    "stay on top of things, takes tasks off their plate,",
    "and turns long-term goals into action plans.",
]

SHOTS = [
    # 0: kinetic cold open, words land on (demo) onsets
    Shot(0.0, 2.0, bg=lambda lt, t: kinetic_words([("Earlier", 0.0), ("this", 0.35), ("week,", 0.7), ("while", 1.2), ("I", 1.45), ("was", 1.6)], lt),
         note="kinetic opener"),
    # 1: doc card bulges in, then the orange highlighter reads along
    Shot(2.0, 5.2, layers=[
        Layer(0.0, 9, img=lambda lt: doc_card(DOC, phrase_spans(DOC, "It helps teams stay on top of things, takes tasks off their plate,"), p=clamp01((lt - 0.8) / 2.0),
                                               bullet=True), xy=(W / 2, H / 2), anim="bulge"),
    ], note="doc + highlighter"),
    # 2: footage, logo slides in, red block sticker on the product name
    Shot(5.2, 8.0, bg=video_bg(FOOTAGE, 3.0) if FOOTAGE else black_bg, glitch_in=True, layers=[
        Layer(0.3, 9, img=logo, xy=(330, 300), anim="slide_left"),
        Layer(1.2, 9, img=sticker("VIKTOR", "red_block", 220), xy=(W / 2, 840), anim="pop"),
    ], note="footage + logo + red block"),
    # 3: tweet stack (tilted, offset) on black
    Shot(8.0, 10.4, layers=[
        Layer(0.0, 9, img=tweet_card("Kev Builds Apps", "@kevbuildsapps", "VIKTOR just onboarded our whole client team into Slack. One agent, one memory, zero chaos.", meta="12:37 AM · Sep 26, 2026 · 94.6K Views"), xy=(820, 430), tilt=2, anim="pop"),
        Layer(0.9, 9, img=tweet_card("Agency Owner", "@agencyowner", "ok this is actually insane for client onboarding"), xy=(1180, 780), tilt=-4, anim="slide_right"),
    ], note="tweet stack"),
    # 4: headline cards stacking + stamp
    Shot(10.4, 12.8, glitch_in=True, layers=[
        Layer(0.0, 9, img=headline_card("The Verge", "AI agents are coming for your group chats", "Teams are handing Slack to autonomous assistants"), xy=(820, 420), tilt=-2),
        Layer(0.7, 9, img=headline_card("Reuters", "Startups race to build the first real AI employee", dark=True), xy=(1120, 700), tilt=3, anim="slide_up"),
        Layer(1.4, 9, img=sticker("DISCONTINUED", "stamp", 96), xy=(1350, 250), tilt=-12),
    ], note="headlines + stamp"),
    # 5: meme cut-in + comic sticker + starburst
    Shot(12.8, 15.0, bg=lambda lt, t: fit_cover(g.convert("RGB")) if (g := gif_frame(lt)) is not None else black_bg(lt, t), layers=[
        Layer(0.3, 9, img=sticker("*GULP*", "comic", 150), xy=(560, 360), tilt=-10),
        Layer(1.0, 9, img=sticker("FREE!", "starburst", 150), xy=(1500, 560), tilt=8),
    ], note="meme + stickers"),
    # 6: price + year + name plate over footage
    Shot(15.0, 17.6, bg=video_bg(FOOTAGE, 20.0) if FOOTAGE else black_bg, layers=[
        Layer(0.2, 9, img=sticker("2018", "year", 90), xy=(W / 2, 170)),
        Layer(0.8, 9, img=sticker("ALEXANDR WANG", "name_plate", 40), xy=(520, 880), anim="slide_left"),
        Layer(1.4, 9, img=sticker("$1,300", "price_box", 110), xy=(1480, 460), tilt=-4),
        Layer(1.9, 9, img=sticker("$449", "price_pop", 160), xy=(1480, 760), tilt=6),
    ], note="year + name plate + prices"),
    # 7: the built-up systems diagram
    Shot(17.6, 23.4, bg=lambda lt, t: draw_diagram([
        DiagramItem(0.0, "frame", (180, 110, 1420, 990)),
        DiagramItem(0.6, "dashed", (260, 200, 900, 690), "Agent sandbox"),
        DiagramItem(1.0, "label", (320, 310), "Browser"),
        DiagramItem(1.2, "label", (320, 390), "Storage"),
        DiagramItem(1.4, "label", (320, 490), "Hatch (Rust harness)"),
        DiagramItem(2.0, "block", (1030, 230, 1350, 360), "Passwords", GREEN),
        DiagramItem(2.8, "block", (1030, 800, 1350, 930), "Sentinel", CYAN),
        DiagramItem(3.1, "arrow", ((1190, 370), (1190, 790)), "real token"),
        DiagramItem(3.4, "arrow", ((600, 700), (1020, 860)), "fake token"),
        DiagramItem(4.0, "block", (1560, 820, 1780, 910), "Web", CREAM),
        DiagramItem(4.3, "arrow", ((1355, 865), (1550, 865))),
        DiagramItem(5.0, "red_arrow", ((520, 330), (520, 470))),
    ], lt, title="Linux virtual machine"), note="diagram build"),
    # 8: title card
    Shot(23.4, 25.4, bg=lambda lt, t: title_card("The Kev Report", "Sep 29th, 2026", lt), glitch_in=True, note="title card"),
]

# curved pointer arrow drawn on the tweet shot
SHOTS[3].layers.append(Layer(1.4, 9, draw=lambda c, lt: curved_arrow(c, (1500, 250), (1180, 360), lt / 0.35)))

if __name__ == "__main__":
    render(SHOTS, duration=25.4, out_dir=os.environ.get("OUT", "frames/out"))
```

## File: README.md
upstream: https://github.com/kevinbadi/open-edits/blob/main/README.md

````text
# OPEN VIDEO EDIT

**The world's best AI video editing harness.**

Hand Claude Code a raw talking-head clip and get back a finished, fully animated short: motion graphics,
kinetic captions, real logos, real faces, reaction GIFs, live b-roll cards, rolling counters and a
hyper-edit cut, all timed to the word you said. No timeline, no templates you drag around, no paid
generation. Every frame is drawn in Python and rendered locally.

Built and battle-tested on the [@KevBuildsApps](https://youtube.com/@KevBuildsApps) / Creator OS
channels, where it edits real videos every day.

---

## What's inside

| Skill | What it makes |
| --- | --- |
| [`split-animated-talking-head`](skills/split-animated-talking-head/SKILL.md) | **The flagship.** A 1080×1920 vertical short: your talking head in a rounded band at the bottom, a dense animated slot on top, Luckiest Guy captions resting on the accent line. |
| [`longform-animated-talking-head`](skills/longform-animated-talking-head/SKILL.md) | The same hyper-edit for 16:9 YouTube long-form: split view (animation slot + head card), zoom dissolves, chapter beats. |
| [`split-animated-short`](skills/split-animated-short/SKILL.md) | The 55/45 split format from a script or a source reel, for an AI avatar (HeyGen) instead of your own footage. |
| [`fireship-style-edit`](skills/fireship-style-edit/SKILL.md) | Faceless "Code Report" style tech news over a voiceover: 2.2s cuts, footage that literally shows what each line says, tweet/headline stacks, highlighted docs, built-up diagrams, memes. |
| [`fireship-style-short`](skills/fireship-style-short/SKILL.md) | The same Fireship grammar for Shorts / Reels / TikTok: 1080×1920, ~1.5s cuts, news footage as bands over a blurred fill, stickers in the safe slots, word-chunk captions. Shares the long-form engine. |
| [`reverse-engineer`](skills/reverse-engineer/SKILL.md) | **Learn any editing style.** Point it at a reference video: it measures cuts, shot lengths, things landing per minute, motion, faces/layout, palette, loudness and words per minute, builds contact sheets of every shot for the agent to study, then scaffolds iteration 1 of a new `<style>-edit` skill (numbers, rules, base engine) and proves it with a demo render. |

Each skill is a `SKILL.md` playbook (the rules, sizes, timings and every lesson learned the hard way)
plus the Python that does the work:

- **`scripts/`**
  - `prep_talking_head.py`: face-aware band crop that never ships a black bar, clean audio, and Whisper word timestamps (`small.en`, primed with your product names).
  - `fetch_brand_asset.py`: real logos from Wikimedia, simple-icons, GitHub or a site favicon.
  - `fetch_figure.py`: face-cropped portraits of the people behind a niche (Anthropic founders, OpenAI, Meta, GaryVee, Hormozi...).
  - `fetch_giphy.py`: Giphy search, downloaded as frame banks.
  - `number_beats.py`: finds every spoken number so it gets a counter.
  - `fetch_footage.py` (fireship): yt-dlp search → download (auto-updates on a YouTube 403) → 1 fps contact sheet → frame-accurate cut, with `--crop` for news picture-in-picture panels.
- **`templates/`**
  - `hyper_edits.py`: punch-ins, shake, whip cuts, 1–2 frame flash inserts, spring entrances, typewriter text, and a one-moving-stream-per-band lane guard.
  - `light_fx.py`: scanlines, HUD scan, neon floor grid, bloom, light hits, light rays and caption glow.
  - `apple_counter.py`: an iOS-style rolling odometer (SF Pro digits, carry, motion blur, live commas, year mode).
  - `media_marks.py`: GIF cards, logo badges, figure rows and spotlights, topic logo conveyors, a spinning globe.
  - `claude_marks.py`: the dancing Claude invader (look-at, grab, hold) and the starburst mark.
  - `split_55_45_compositor.py` / `longform_engine.py` / `fireship_engine.py`: the compositors.
- **`fonts/`**: Oswald Bold (overlays), Luckiest Guy (captions), Anton, Bangers, Space Mono, Inter, Press Start 2P.

### `examples/`

Real `render.py` files from shipped edits. These are the best way to learn the style:

| Example | Why it's here |
| --- | --- |
| `social-agents` | Rated "the best edit yet": b-roll banner reveal, zoomed live terminal, a ticking skill checklist with a visual per item. |
| `gitnexus` | The "new status quo": captions on the line, a meme on the spoken line, a custom motion piece on the next word. |
| `claude-hunger-games` | A fully custom world: ember-lit arena, 100 tributes spawning in waves, strategy trading cards, a 5-way clash with a scorecard, cannon, elimination countdown, crowned victor. |
| `claude-ads-api` | Invader shooting logos, hub-and-spoke API diagram, CEO columns, a step-by-step ad-builder pipeline with a panel per step. |
| `jev-app-store` | A screen recording mapped onto the script so the live card shows exactly what's being said, with real app icons cropped out of the footage. |
| `name-is-jef` | A product explainer with founder portraits, pricing and chart shots, decision cards. |
| `viktor-short` | Parallel chunked rendering, with the band kept in sync. |
| `viktor-intro-longform` | A 16:9 long-form cut. |
| `prompt-injection-fireship` | 60s Fireship-style cold open: 27 cuts, real event footage, a Wikipedia highlighter, an 8s diagram build, memes placed around their burned-in captions. |
| `weird-hack-fireship` | 60s long-form cut built from real BBC / CNBC / Bloomberg coverage: literal visuals on every line, two attack-chain diagrams. |
| `weird-hack-short` | The same story as a 60s vertical short through `fireship-style-short`. |

They reference their own `assets/` and `source/` folders, which are not included. Read them, copy the
patterns, don't run them as-is.

---

## How an edit runs

```
clip.mov
  └─ prep_talking_head.py ──► band (1056×960 @30fps) + audio + words.json (word timestamps)
       └─ fetch logos / faces / GIFs for everything the transcript names
            └─ render.py: sections cut at spoken anchors, every beat t0 = the word's start time
                 └─ PIL draws each frame: slot (graphics + light fx + hyper-edit) + band + caption
                      └─ ffmpeg: 1080×1920 H.264, the ORIGINAL clip's audio, crf 16
```

The talking-head audio is the master timeline. Graphics land **on** the word (max 0.1s early), never
while you're still winding up to say it. Final renders split into parallel chunks
(`RANGE=0:200 python3 render.py`), and a 30s short renders in a few minutes.

---

## Install

You need [Claude Code](https://claude.com/claude-code), Python 3.9+, and ffmpeg.

```bash
git clone https://github.com/kevinbadi/open-video-edit.git
cd open-video-edit
pip install -r requirements.txt          # pillow, opencv-python, numpy, openai-whisper, yt-dlp
brew install ffmpeg                      # or apt install ffmpeg

./install.sh                             # copies the skills into ~/.claude/skills
./install.sh /path/to/your/project       # or into that project's .claude/skills
```

Optional keys go in `.env.local` at your project root (see `.env.example`):

- `GIPHY_API_KEY`: reaction GIFs (free at developers.giphy.com).
- `HEYGEN_API_KEY`: only for `split-animated-short` avatar renders.

## Use it

In Claude Code, from the folder where you want your projects:

```
edit this talking head: ~/Downloads/my-clip.mov
here's b-roll of what I'm talking about: ~/Downloads/screen-recording.mp4
```

Claude loads `split-animated-talking-head`, preps the band, plans the beats against your transcript,
sources the logos, faces and GIFs, writes `projects/<slug>-animated/render.py`, checks preview frames
for collisions, renders, and hands you a 1080×1920 MP4.

Long-form: *"edit this landscape talking head"*. Faceless: *"make a Fireship-style video about X"*.

---

## Platform notes

- Built on macOS. It uses SF Pro (counter digits) and Menlo (terminals) when present, and falls back to
  the bundled fonts elsewhere.
- No HTML overlay layer: every pixel is drawn in Python.
- Logos, portraits and GIFs are fetched at edit time and are not redistributed here. Pro
````
