TL;DR

  • I built a small CLI harness that takes a product brief to a finished, captioned, sung vertical ad for about $2 to $4 per cut in API calls (list estimates, dated late 2026). Five finished cuts across two proof-of-concept rounds, none published.
  • The valuable part is not the model names. It is the order - song first, word timestamps, shot table against real timings, stills, clips, assembly - and the seams between steps. Every model slot is swappable and should be re-tested quarterly.
  • The failure list matters more than the success list: providers return the wrong audio format, photoreal people get rejected by video models, rate limits bite under $10 of credit, and generated lettering always garbles. Each one has a cheap fix, and the fixes are now the pipeline rules.
  • The default format - full-voiceover, 100% B-roll, no lip-sync, the song uncut - is what makes the cheapest video models viable for every shot.
  • The render queue stopped being the bottleneck. A clip costs cents and takes seconds to minutes. The thinking is the bottleneck, and that stays human.

This is the build record for the pipeline. The research map of the genre itself - the story structure, the variant factory, the unit economics, the platform risk - is a separate post: The Sung VSL: A Research Map of the AI Song-Ad Genre. Everything below refers to files in the project repo; paths like harness/lyria_run.py are repo-relative. The finished cuts and songs live in that repo too, not hosted here.

The brief and the constraints

The test product is a fictional consumer-product brief, built for this pipeline test and deliberately generic: a stand-in for any product sold on a mechanism and a feeling, which is what the format needs. The concept, briefs, and finished cuts stay internal; this post documents the machinery. The deliverable shape: a 60-second, 9:16 sung ad with burned-in lyric captions and a drawn end card.

The working constraints came before any model choice:

  • CLI only. No GUI tools, no editor apps. Scripted API calls, ffmpeg, and plain text files. Every step is a command you can re-run.
  • One operator plus AI agents. Production is prompt-level end to end. The agents write prompts and scripts; the operator listens to song drafts, approves the cut, and decides what is safe to publish.
  • USD 20 cap per session. Replicate’s invoice is the source of truth for spend; everything in the docs is a list estimate. Every paid call gets logged with model, purpose, result, wall time, and estimated cost.
  • No publishing. Nothing here went to an ad platform. The pipeline stops at the finished file.

Those constraints are why the harness exists. If production is prompt-level and CLI-able, then the durable artifacts are the scripts, the prompts, and the logs - not a browser session.

What is in the repo

(root)/          package skeleton (CLI, config, DB); unused by the cuts
harness/         five reusable API drivers and the batch runner
templates/       fixed prompt blocks and caption styles
examples/        the worked builds: cut, song, refs, frames, scripts, logs
docs/research/   the pipeline research and per-build notes
tools/           the .env bootstrap (loads .env into os.environ)
tmp/             raw POC trees, kept read-only for provenance

harness/ is deliberately small. Five scripts, each between 35 and 110 lines:

ScriptJob
lyria_run.pySong generation through OpenRouter, streamed chat completions with audio output
replicate_run.pyOne Replicate prediction, create-poll-save
run_batch.pyThrottle-aware batch: bounded in-flight predictions, 429 backoff, resume by existing output
transcribe_groq.pyWord-level timestamps from Groq whisper-large-v3
upload_file.pyUpload a local still to Replicate files, print the durable URL

There is no pipeline orchestrator. The agent running the session is the orchestrator; the scripts are the durable seams. Assembly is example-specific because segment timing comes from each song’s own word timestamps, so each examples/<build>/scripts/assemble.py is the working reference for that cut.

The pipeline, step by step

The order is the finding. Out of order, every step gets more expensive: cut a video to fit a song and you re-render; generate stills before the style is locked and you throw them away; storyboard before you have timestamps and every shot lands wrong.

  1. Script and lyrics. Written as ad copy first, in the buyer’s language. The song is the thing you cannot change later, so the lyrics get written before any generation.
  2. Song first. The song is the source of truth for pacing and cannot be cut.
  3. Character and product sheets. Anything that appears more than once gets a reference image: the cast on one sheet, the recurring set pieces as separate stills.
  4. Word timestamps. Transcribe the locked song with word granularity.
  5. Shot table. One row per shot against real timestamps: time window, lyric line, visual, source file.
  6. Start frames, then clips. Generate the stills, upload them, and run image-to-video per shot.
  7. Assembly. Clips time-fitted to their segments, captions burned in, the uncut song as the only audio.
A character sheet: one reference image per recurring character, fed to every generation that includes them. Image: Starpop.

A character sheet: one reference image per recurring character, fed to every generation that includes them. Image: Starpop.

The driver commands, exactly as the harness runs them:

python harness/lyria_run.py prompts/song.txt out/song
python harness/transcribe_groq.py out/song.mp3 out/song_words.json
python harness/upload_file.py refs/char.jpg
python harness/replicate_run.py bytedance/seedream-4.5 in/f1.json out/f1.json
python harness/run_batch.py wan-video/wan-2.2-i2v-fast in/ clips/ mp4

lyria_run.py posts a streaming chat completion with modalities: ["text","audio"] and writes <basename>.mp3 plus a JSON sidecar with the transcript and usage. replicate_run.py resolves the model’s latest version, creates one prediction, polls to termination, and saves the prediction JSON. run_batch.py does the same for every *_input.json in a directory, skips names whose output already exists (so a failed batch resumes without re-spend), and backs off on 429 responses.

The song-first rule earned its place immediately. The first song draft came back 60.92s with a 4.78s instrumental intro, verse at 4.78s, chorus at 32.26s, tag at 50.10s, last vocal at 55.68s. The whole shot table was built from those Whisper numbers. A later experiment taught the reverse lesson: asked for a 30-second song with a changed first line, the model returned 178.99s, opened vocals at 20s, and improvised extra verses. It was rejected and the earlier track stayed. You do not fix timing by cutting the song; you fix the song.

This build used single-shot start frames throughout: one still per shot, one clip per shot. The alternative route is a multi-shot storyboard canvas - several panels in one image, one generation returning one clip with the cuts and transitions already inside it. It costs fewer generations and buys transitions, at the price of less control per shot.

A four-panel storyboard canvas: one generation returns one clip with four shots, cuts and transitions included. Image: Starpop.

A four-panel storyboard canvas: one generation returns one clip with four shots, cuts and transitions included. Image: Starpop.

The routes and the cost ladder

One worked configuration, clearly labeled: this is what the five cuts used, not a recommendation. Prices are list estimates, dated 2026-11-30 to 2026-12-01, from the build logs and provider pages at build time. Re-test before a production run; this market reprices quarterly.

SlotModelList price (dated)
Song (60s, vocals)google/lyria-3-pro-preview via OpenRouter~$0.08 per song
Song (30s clip)google/lyria-3-clip-preview~$0.04 per clip
Stillsbytedance/seedream-4.5 at 2K~$0.04 per image
Video (i2v)wan-video/wan-2.2-i2v-fast, 720p, 16 fps conformed to 30 fps~$0.03 per second
Word timingsGroq whisper-large-v3negligible
Assemblybundled ffmpeg via imageio-ffmpeg, ASS captions, drawtext end cardlocal, free

The research behind these choices lists the alternatives it tested against, and the slots are interchangeable:

  • Song: ElevenLabs Music and MiniMax Music are the direct-API fallbacks. Suno is named in every practitioner workflow but had no public API as of 2026-11-30; unofficial reseller wrappers breach its terms and are ruled out for production. Lyria won this build for a boring reason: it was reachable through the OpenRouter key that was already in the environment, with timed lyrics that map onto the timestamp step.
  • Video: Seedance 2.0 Fast is the other budget workhorse (about $0.022/s direct). MiniMax H3 Max is the pick when a shot must sing or lip-sync on beat, because it takes the song slice as an audio reference; that is the expensive step this build skips. Veo 3.1 and Kling 3.0 are the premium hero-shot tier. The routing pattern - workhorse for 70-90% of shots, premium only for hero shots - is a pattern, not a model.
  • Stills: Seedream 4.0 is cheaper; Nano Banana 2 follows fixed prompt blocks better and works as the retouch layer; GPT-Image variants cover storyboard canvases.

The cost ladder for one 8-second clip, from the pricing scan (2026-11-30): full-price aggregator list ~$6 for a Veo-class clip; direct provider API ~70% cheaper; fast tiers $0.40-1.20; community services under a dollar; local or rented GPU cheapest if saturated. The Wan route this build used lands around $0.24 per 8-second clip. The research’s hidden-cost rule of thumb is list price times 1.7 (discard rate, regens, upscaling); these five builds came in near list, mostly because retries were single stills rather than whole batches.

Per-cut spend, all list estimates:

CutSongRefs and framesClipsTotal
POC1, 30s (superseded)~$0.25~$0.76 (incl. discarded photoreal detour)~$1.20~$2.21
POC1, 60s v2 (approved)$0.08~$0.24~$1.20session total ~$3.70
POC2 variant 1, 60s$0.08~$0.52~$1.52~$2.12
POC2 variant 2, 60s$0.08~$0.84~$2.00~$2.92
POC2 variant 3, 60s$0.08~$0.92~$2.05~$3.05

Every session ended well under the $20 cap. Wall time is the other number: the POC1 30s cut was about 17 minutes end-to-end after style approval (the discarded photoreal detour had cost another ~25 minutes), and the three POC2 variants about 42, 36, and 35 minutes. In each log, roughly half the wall time was planning, operator pauses, QC, and documentation - not generation.

The five builds and what each taught

POC1, 30s. The first full pipeline run, and the build’s most instructive detour: a photoreal version first. Seedance rejected every photoreal frame with a privacy filter (“may contain real person”) across seven attempts, a Kling test never returned, and Wan passed the same frames - but the brief fit a stylized Pixar look better anyway. The pivot cost about 25 minutes and most of the image spend, all thrown away. Lesson: lock the style before mass-producing frames, and stylized frames are both safer and better-fitting for this format.

POC1, 60s v2 (approved). The cut that proved the loop can be re-entered without re-building. The song was replaced with the preferred Lyria draft, the edit extended to 11 segments aligned to the new word timings, and three video hallucinations fixed with regenerated stills: a fake interface rendered onto a phone screen, a phantom garment behind a character, and a prop close-up that needed wider framing. Captions were regenerated from the new word timings so they match the sung words. A second song rewrite with a changed first line ran $0.08, came back 179 seconds with invented verses, and was discarded. Output in the POC1 example folder: 60.92s, 1080x1920, 30 fps.

POC2 variant 1, 60s. The first additive variant: same cast and pipeline, one new lead character and a new story. One new song draft, three new refs, ten new frames, nine new clips - and every reusable piece (character sheet, background plate, caption style, drivers) came from POC1 untouched. Two practical fixes: the hook and CTA caption lines overflowed the 1080-wide frame and were split into two lines each, and no clip needed more than a 1.08x time-stretch to fit its segment.

POC2 variant 2, 60s. A full recast to non-human characters, which stress-tested the regen discipline. Three stills came back wrong and were regenerated individually: a background plate that summoned extra characters, a product close-up that refused to stay character-free, and a sign with garbled lettering that was regenerated as a plain blank sign (one background character remained, accepted). A new failure class: Whisper hallucinated “Subtitles by the Amara.org community” on the instrumental outro - not in the audio - so the timing map had to be hand-cleaned.

POC2 variant 3, 60s. The most useful build: a darker, semi-realistic variant. The semi-realistic style block held identity across all 13 clips, and it passed the video providers where POC1’s full photoreal frames had been rejected - confirming the problem is photoreal people, not realism as such. The music brief described the sound (slow, dark, low-register, orchestral) instead of naming a band, which is both the safe route and the one that worked in one draft. And the blank-sign convention: every sign and the end card are drawn on a plain blank surface, so no rendered lettering can garble. Known accepted issues are documented: the song improvised its final chorus and tag, a few prop motifs read wrong in close-up, and minor hair drift in one group shot.


flowchart TD
    A[Brief + sub-avatar card] --> B[Script + lyrics as ad copy]
    B --> C[Song draft via lyria_run.py
song cannot be cut] C --> D[Character + product sheets
fixed prompt blocks] D --> E[Word timestamps via transcribe_groq.py] E --> F[Shot table: time / lyric / visual / source] F --> G[Start frames via Seedream] G --> H[i2v clips via run_batch.py
Wan 2.2, safety checker off] H --> I{QC each shot} I -- broken shot --> G2[Regenerate that shot only] G2 --> H I -- ok --> J[Assemble: muted clips + ASS captions
+ drawtext end card, uncut song only audio] J --> K[QC: duration, resolution, loudness,
no rendered text, no gaps]

The failure table

Every failure below happened at least once in these builds or in the community workflow the research documented, and each has a rule attached now.

FailureWhat it looked likeThe rule
Wrong audio formatLyria returned MP3 bytes (ID3 header, C2PA manifest) even though the request asked for pcm16; treating them as raw PCM produces noise. Two mis-wrapped artifacts sat in the tree before anyone checked the signature.Save and decode as MP3 when the provider says PCM. The driver now writes MP3 directly.
Photoreal people rejectedSeedance refused every photoreal frame with “may contain real person,” seven attempts. Stylized Pixar frames passed the same model family.Stylize, or go semi-realistic. The safety checker stays off only where the content is safe to disable.
Rate limiting under $10 creditA 7-parallel still batch hit Replicate’s 429: 60 predictions/min with a burst of 5 while account credit is under $10. Two predictions were recovered by id; nothing re-spent.Use the throttle-aware batch runner: bounded in-flight creates, 429 backoff, resume by existing output.
Song drift under instructionA 30s request came back 179s with improvised verses; one variant song improvised its final chorus and tag.Never cut inside the song to fit the edit - fix the song. Trimming the intro or the instrumental tail is allowed; the rule covers the middle.
Rendered text garblesA sign in one generated still came back garbled; a hook phone invented a fake interface; an end-card still returned the wrong characters.All on-screen text is drawn in the edit. Blank signs and blank screens in the generated stills; ASS captions and drawtext carry every word.
Gaps at slice boundariesFrom the community workflow: drop half a second at a slice boundary and every clip is fine alone and unusable together.Slices must touch exactly. The shot table sums to the final duration - 60.30s exactly on the POC2 cuts - before any generation runs.
Accidental cuts at seamsAn unstated transition gets whatever the model picks, and the model picks a cut.Batch by seam, not scene: state every transition, plan continuity per seam, and regenerate only the broken shot.
Character driftFeeding a generated output back in as a reference; five generations of that and the face is somebody else.Character sheets plus fixed prompt blocks repeated word for word. Consistency comes from the sheet and the blocks, never from “same style as before.”
Generated clip audioGenerated clips return with the model’s own sound on the slice - a re-performance that phases against the real track.Mute every generated clip. The uncut song is the only audio.

One more failure class deserves its own note: Whisper hears things that are not there. It mangled the sung brand name, misheard “four hundred” as “four hollers,” and invented a caption credit on the instrumental tail. The fixes that worked: captions are corrected to the written lyric, not the transcript; a kids’ echo after the brand line forced clean diction in a test draft; and the timing map is hand-checked against the song before the shot table is built.

Continuous song slices versus gapped slices, and what each does to pacing. Image: Starpop.

Continuous song slices versus gapped slices, and what each does to pacing. Image: Starpop.

Assembly and QC

The assembly pattern is stable across all four 60s cuts, and it is the same regardless of which models made the clips:

  • One muted clip or still per segment, time-fitted to its song segment (trim, or a slow-down capped at 1.15x; none of the POC2 clips needed the cap).
  • The segments are concatenated into a silent video; the uncut song goes on as the only audio track, except the instrumental tail, trimmed to 60.30s on the POC2 cuts.
  • ASS captions burned in from a hand-checked file, bottom third, white with black outline.
  • A drawtext hook over the first shot (two short lines) and a drawtext end card on the instrumental tail (brand line, promise line, call to action, URL), on a blank-sign still.
  • Output: 1080x1920, 30 fps, H.264/AAC, CRF 18.
The layer stack: title hook, captions, muted clips, and the full uncut song as the only audio. Image: Starpop.

The layer stack: title hook, captions, muted clips, and the full uncut song as the only audio. Image: Starpop.

The pattern in one line from one variant’s assemble.py (abridged):

filt = f"[0:v]subtitles={ASS},{hook1},{hook2},{card1},... ,format=yuv420p[v]"

and the mux maps [v] plus the song, nothing else. Every clip is scaled, padded, and muted with -an before it ever reaches the concat list.

QC is a checklist run per cut, all from the logs: duration matches the shot table exactly; 1080x1920 at 30 fps; audio loudness measured (the four 60s cuts land near a mean of -14 dB); captions legible at phone size; faces and outfits consistent across cuts (anchored by one hair detail and one outfit color per character); no generated on-screen text or fake UI anywhere; no gaps at segment boundaries. The mouth-on-beat check from the genre’s workflow applies only to singing shots, and these cuts have none by design: full voiceover means nobody mouths the words.

What the harness does not do

Worth stating plainly, because it is also the design:

  • No lip-sync. The default is a full-voiceover ad, 100% B-roll. That is the format’s core insight, not a limitation: skipping lip-sync opens the cheapest workhorse models for every shot. Singing shots on an audio-reference model are a planned follow-up for hero variants only.
  • No publishing. The pipeline stops at the finished file. Uploading to an ad platform is an operator decision with its own compliance surface.
  • No claims approval. Nothing in the pipeline decides what a product may say. Claims sign-off is between the operator and their regulator; the human owns the promise.
  • No automatic model selection. The drivers run the model you name. A small routing layer that picks the model per job is a future step, not something in the harness.

What to copy, and what to re-test

Copy the order and the seams:

  • Song first, timestamps second, shot table third, generation last. The order is what keeps regens cheap and local.
  • Fixed prompt blocks plus character sheets, repeated word for word.
  • All type in the edit. Blank signs, blank screens. Muted clips, uncut song.
  • A per-call cost and time log with a session cap - the only way to know what a cut actually costs.
  • The QC checklist above.
  • Bounded, resumable batch generation. Resume-by-existing-output is what makes a failed batch cost nothing.

Re-test before trusting:

  • Every model name and price here is dated. The budget tier was dropping about 30% a year at scan time, leaderboards churn monthly, and one provider removed its API mid-scan. Re-verify before a production run.
  • The lip-sync route: audio-reference generation on MiniMax H3 Max versus Seedance for the 2-3 singing hero shots.
  • Multi-shot storyboard canvases versus single-shot start frames. This build used single-shot start frames throughout - the stable, controllable choice; the canvas workflow trades stability for fewer generations.
  • Direct APIs versus the aggregator, once volume justifies it.
  • The 30s Clip model versus Pro for ad-length spots, now that both timing behaviors are known.

Repo and sources

All files referenced here live in the project repo: the drivers in harness/ (with harness/README.md as the exact-behavior reference), the fixed prompt blocks in templates/prompts/, the four curated builds in examples/ with their final cuts, songs, shot tables, scripts, and cost logs, and the build notes in docs/research/. The provider-neutral pipeline research is docs/research/ai-song-ad-pipeline.md; it carries the practitioner sources behind every community-workflow claim above. The workflow illustrations in this post are from Starpop’s public build guides, credited inline.

The companion post on the genre itself - the story structure, the anchor case, the variant factory, and the risk picture - is The Sung VSL: A Research Map of the AI Song-Ad Genre. The five cuts described here are the working evidence behind that research; they are not published anywhere.