Video inserts (long-form b-roll)
Produces: <project>/<NAME>_FINAL.mp4, the cut with every insert laid over it (audio copied untouched), plus
<project>/broll/ (every built insert, reusable), <project>/review/ (contact sheets, previews) and
<project>/work/broll/storyboard.md (every insert, the words it sits on, coverage).
One tool, one plan file per video: scripts/build_broll.py --project <dir> reads <dir>/broll_plan.py. Content goes
in the plan; never write a per-video build script. A tool that does not take your input gets its input shaped.
Prerequisites
- A finished cut from
video-cut: the final EDL, the RAW word transcript it indexes, the rendered cut. - Python 3.11+, ffmpeg/ffprobe on PATH, Pillow, numpy (
pip install -r requirements.txtat the repo root). - Node 18+:
npx hyperframes(graphics, diagrams) and Playwright for the site and card recorders:cd scripts/site_broll && npm install && npx playwright install chromium. python shared/fetch_assets.pyonce (GSAP, the font, the denoise model).config.jsonat the repo root:brand.ink / paper / accent / highlight,font_file,youtube_channel(for channel cards), optionalprojects_dirandbroll_library_dir.- Figure b-roll only:
skills/action-figure-broll(its sheet + character text) andFAL_KEYin the key file.
Commands, in order
B=skills/video-inserts/scripts
# 1. REVIEW PACK, all free: storyboard, graphic previews, page stills, channel cards, contact sheets
python $B/build_broll.py --project <dir> --plan --previews --sites --cards --sheets
# read work/broll/storyboard.md and review/sheet_*.jpg yourself, then show the owner the pack.
# Say exactly what is being approved. One animated sample of the key diagram: --one-video <slug> <out.mp4>
# 2. after the OK: figure stills (PAID), check them on the sheet, then motion (PAID)
python $B/build_broll.py --project <dir> --stills --sheets
python $B/build_broll.py --project <dir> --motion
# 3. build everything free and check the placement
python $B/build_broll.py --project <dir> --render --record --standins --manifest --composite-plan
# 4. composite
python $B/build_broll.py --project <dir> --composite
# 5. library: index the new clips for the next video
python $B/broll_library.py --build
Single tools: scripts/hf_graphics/make_hf_graphic.py (one graphic from a JSON spec),
scripts/site_broll/record_site.mjs (one page recording), scripts/site_broll/shoot_youtube_card.mjs (one channel
card), scripts/place_inserts.py (word-search placement from a JSON list), scripts/composite_video.py (lay a
manifest over a cut), scripts/broll_library.py --search <words>.
The plan file
Plain Python, content only. Start from examples/broll_plan.example.py. Must set EDL, WORDS, CUT; optional
NAME, THEME ("clean"), RAIL, RAIL_KICKER, MANDATORY, ACK, DRIFT, CHANNEL, FIGURE_SHEET,
FIGURE_LOOK, DIAGRAM_IMAGES. One call per insert, each naming the LINE it starts on:
EDL = PROJECT / "cuts/final.json"; WORDS = PROJECT / "transcripts/raw_word.json"; CUT = PROJECT / "cuts/cut.mp4"
RAIL = ["Find the leak", "Fix the page", "Measure it"]
add("card", "hook", "pages leak", 3.5, "the claim", type="title",
spec={"title": ["Pages leak"], "highlight": "leak"}, split=dict(w=0.48, shift=0.23))
add("diagram", "d_leave", "half of them are gone", 6, "visitors leave", scene="visitors_leave",
beats={"leave": "half of them are gone"})
add("stat", "s1", "went up", 3.5, "the number", spec={"value": 43.4, "decimals": 1, "suffix": "%"})
add("steps", "rail1", "step one is", 3, "rail", reached=1)
fig("f_desk", "staring at the numbers", 5, "figure at a desk", prompt="<the whole still>", motion="<only what moves>")
add("site", "s_page", "their pricing page", 5, "real page", url="https://example.com/pricing", find="Simple pricing")
add("ytcard", "yt", "in another video", 4, "channel card", id="<videoId>")
add("keep", "k1", "and you wait", 4, "library clip", file=LIBRARY["older_project"] / "f_wait.mp4", status="kept")
Insert options: after=<cut s> (a line said twice), split=dict(w, shift) (beside the face), box={w,x,y},
canvas=(w,h), reuse="<slug>" / reuse_file=<path>, new_ok="why" (generate despite a library match),
clip=5|10 (figure length), zoom=, dim=, align="top" (site), beats={name: phrase} (diagram),
item_say=[...] (list card, one phrase per item).
| kind | made by | use it when |
|---|---|---|
card / stat / steps | make_hf_graphic.py (title, list, stat, steps, map, record) | text, lists, numbers, the step rail. No video model renders text. |
diagram | a scene in hf_graphics/diagrams/diagram/index.html (SC.<scene>) | a mechanism or a relationship. Add a scene there; never copy the folder. |
figure | action-figure-broll: make_character_ref.py still -> animate_still.py | a person in a situation, no text |
site | record_site.mjs | the speaker names a page that exists |
ytcard | shoot_youtube_card.mjs | the speaker points at another of their videos |
keep | a library clip | the library already has it |
Diagram scenes: site_build, same_grid, tools, advice, generic_page, thread, feed_model, prompt_avg, band (spider chart, variants), artist_styles, ninety, signature, skill_plug, fanout, effects_pile, max_stats, signals, pattern_brain, broll_grid, equation, three_patterns, threeword_page, busy_page, banner_push, visitors_leave, familiar_page, roadmap, template_ai. Read a scene's code for its variants and beat names; every beat has a default.
Rules (the tool stops on the first four)
- Place every insert by word search on the final EDL; a line it cannot find is an error. It starts on the FIRST word of the phrase it answers, never after: late b-roll reads as disconnected.
- Mandatory inserts: what the plan's
MANDATORYlists must be on screen within -1..+5 s of the words (default: a mention of another video needs its channel card).ACK = {"phrase": "why"}only for a hit that is not a mention. - Face first: nothing full frame in the first 2 s; hook visuals go beside the face (
split). Viewers stay for a face. - Library first: a new figure with a strong library match is not generated unless
new_ok="why". Reuse compounds; generation costs every time. - Show the owner work only after the gates pass and you have looked at the frames yourself; the owner is not the QA.
- One sample before a batch: the free review pack, then the paid stills, then motion. Never buy motion on an unchecked still.
- Density is high: visuals over most explanatory moments, about 45-55% of runtime. Under 10% reads as "lacking visuals".
- The first 30 s carry retention: a visual beat on nearly every sentence, with the face in frame about 60% of it.
- Explanations get DIAGRAMS, not text cards. An idea that returns reuses the SAME diagram one step further.
- A graphic explains the sentence it sits on, with concrete objects from that sentence. Abstract tokens moved on the beat read as random motion.
- Real things are recorded, not drawn: a named page is recorded live (a plain scroll ending on the section; zoom only on the element named). A quote read aloud shows the real screenshot; if the original is gone, a labelled quote card, never a mock-up.
- A line read aloud is a card; a list card STAYS UP, each item appearing on the word that names it. Build every card from the CUT, not the raw transcript.
- The step rail: the count goes on the words that state it (
reached: 0, names hidden); each section opens with the rail one step further. Never list every step in the hook. - Numbers on screen are the SOURCE's number, not the rounded one spoken.
- Never over the payoff: nothing in the last 4 s or over the call to action.
- Beside or full frame: sparse and drawn goes beside the face (
split=dict(w=0.48, shift=0.23)orbox, measure where the face is first); dense and real (a control panel, a long page) goes full frame. - Figures: the world of the SENTENCE (a line about websites is a desk and a screen, not a workshop). Two steps always: the still carries identity and composition, the motion prompt says only what MOVES. No text-shaped surfaces (plaques, labelled consoles): video models write garbled lettering. Figures are animated, never left as stills; a missing clip gets a push-in stand-in (
--standins), never an empty slot. Kling lengths are 5 or 10 s; generated audio is stripped. - In the composite: b-roll moves to start before a join it lands just after (hides the cut); a face gap under 1.5 s between two inserts is closed (no face flashes); overlaps are refused; the cut's audio passes through untouched.
- Renders go through
shared/video_jobs.py(free-RAM concurrency, below-normal priority). Never start renders or headless browsers outside it: a dozen headless Chromes freeze the machine. - Paid runs: print count x price and the live fal balance first; one paid run at a time (a lock refuses a second); never kill or restart a started run; tickets on disk are collected at $0.
- Tool output is the truth, not exit codes: read what each step printed.
Landmines
- A rough EDL that is a bare list (not
{"version", "sources", "ranges", ...}) dies on a TypeError. - The cut runs slightly longer than its EDL sum (frame rounding, VFR phone audio); the drift is measured from
CUT. If the cut was re-rendered, rerun--plan. record_site.mjscannot scroll some documentation sites with their own scroll containers; plan a graphic there. Dark sites needdim=0. Exit 4 = recorded but the sentence ended off-centre: look at it.- fal's storage upload can 403 on a funded account; the fal helper falls back to a data URI.
- Verify a render with a decode pass (
ffmpeg -v error -i FILE -f null -), not a probe: a corrupt file reports the right duration. --stillonmake_hf_graphic.pywrites PNGs: look at one frame before rendering hundreds.- Check the composite on pulled frames (
ffmpeg -ss T -i FILE -frames:v 1 x.png) at three or four insert points before handing it over. - Two renders writing one path corrupt the file: a killed Python parent can leave its ffmpeg child running.
- A channel card needs
youtube_channelin config orCHANNELin the plan; YouTube's consent wall and lazy grid are handled, but its markup changes: if the card crops wrong, look at the PNG.
Cost per paid step
| Step | Price | Notes |
|---|---|---|
| Graphics, diagrams, site recordings, channel cards, composite | $0 | local HyperFrames, Playwright, ffmpeg |
Figure still (--stills) | ~$0.15 each | gpt-image edit via fal, see action-figure-broll |
Figure motion (--motion) | ~$0.42 per 5 s, ~$0.84 per 10 s | Kling image-to-video via fal |