rb · guides
rafabenedetti.com
user guides · 2026
Reference · User guide

shotrunner: user guide

A command-line tool that turns a shot list into AI-generated takes ready to cut in Final Cut Pro, with one command per provider and a hard budget cap. What it does, how to install it, every command, and the rules learned on a real scene.

shotrunner turns a shot list into takes that are ready to cut in Final Cut Pro, with one command per provider. It is the handoff from AI generation to the edit, and nothing else: no prompt writing, no picking takes, no UI. As of commit 60bbd96 all milestones (M1 to M6) have passed and it has carried one real scene (1939½, N3 stairwell) from plates to a cut.

For each shot in the list, shotrunner run:

  1. Reads the shot list (YAML) and the model catalog (models.yaml).
  2. Plans every take, prices it from the catalog, and refuses the whole run if the total is over your --budget. Nothing is sent until the plan passes.
  3. Sends each take to the provider (fal, ElevenLabs, or a local ComfyUI) and logs prompt, seed, model, parameters, cost and request id to SQLite.
  4. Downloads the original the moment it exists and keeps it untouched, with its SHA-256.
  5. Transcodes video to ProRes 422 at the project frame rate (bt709, timecode 00:00:00:00), and audio-only takes to 24-bit 48 kHz WAV padded to whole frames.
  6. Writes one FCPXML 1.14 file: an event with every take (keywords, the prompt as a note) and a stringout project with every take in shot order and a marker on each clip (take=N seed=S cost=C model=M).

A second run of the same list is free: finished takes are skipped, unfinished ones are picked up again by request id.


1. Requirements

shotrunner runs on one Mac with Apple silicon. There is no Intel, Linux or Windows support.

NeedWhatNotes
MacApple silicon, macOSThe M5 Max is the reference machine.
Python3.11Managed by uv; you never call python for shotrunner directly.
uvAstral’s uvCreates the environment and runs every command (uv run …).
ffmpeg, ffprobeHomebrew, at /opt/homebrew/bin/Called by full path. Tested on ffmpeg 9.0.1.
xmllintShips with macOSDTD validation of every FCPXML.
Final Cut Pro12.3, the Creator Studio buildThe app is named “Final Cut Pro Creator Studio”. Import is the ground truth.
fal accountAPI-scope key named shotrunnerPrepaid credits, auto-recharge off. Video: Kling, Veo, Seedance, Wan.
ElevenLabs accountCreator plan, key named shotrunnerSound effects and dialogue. Lossless output needs the Pro plan.
Local ComfyUI (optional)0.37.0 at http://127.0.0.1:8190Free local Wan 2.2 and LTX-2.5. Slow: minutes per clip.
Media spaceA folder you keep for the whole projectNever /tmp: macOS wipes it on restart.
GitHub accessThe private repo rafabenedetti/shotrunnerAsk Rafa to add your GitHub account.

Keys live only in the macOS Keychain under the names FAL_KEY and ELEVENLABS_API_KEY. They are exported by hand in the Terminal tab that runs a live job, never in .zshrc, and never written into a shot list, the database, logs or the FCPXML.

2. Installing

Installing takes five steps and ends with the test suite passing. Run each block in Terminal and check its output before the next.

  1. Tools. Install ffmpeg and uv with Homebrew, then check both:

    brew install ffmpeg uv
    /opt/homebrew/bin/ffmpeg -version | head -1
    uv --version
  2. The repo. It’s private on GitHub (rafabenedetti/shotrunner), so clone it while signed in to GitHub:

    git clone https://github.com/rafabenedetti/shotrunner.git ~/Developer/shotrunner
    cd ~/Developer/shotrunner
    git --no-pager log --oneline -1
  3. The gate. The first uv run builds the environment from the pinned versions. The suite runs with the network blocked and never spends money:

    cd ~/Developer/shotrunner
    uv run pytest -q
    uv run shotrunner --help

    Expect 174 passed (the count at 60bbd96; it only grows). The Apple FCPXML 1.14 DTD lives in the repo at vendor/fcpxml/FCPXMLv1_14.dtd; a missing DTD is a failing test, never a skip.

  4. Keys. Store each key once in the Keychain. security asks for the value, so it never lands in your shell history:

    security add-generic-password -a "$USER" -s FAL_KEY -w
    security add-generic-password -a "$USER" -s ELEVENLABS_API_KEY -w
  5. Each live session. In the Terminal tab that will run paid takes, and only there:

    export FAL_KEY="$(security find-generic-password -s FAL_KEY -w)"
    export ELEVENLABS_API_KEY="$(security find-generic-password -s ELEVENLABS_API_KEY -w)"
    echo "FAL_KEY ${FAL_KEY:+is set}; ELEVENLABS_API_KEY ${ELEVENLABS_API_KEY:+is set}"

For local ComfyUI, start it in its own tab (comfy-v, port 8190). shotrunner reads COMFYUI_URL and COMFYUI_TIMEOUT_S from the environment if you need other values.

To update later: cd ~/Developer/shotrunner, git pull, uv run pytest -q. Only run paid takes on a green gate.

3. The commands

There are three commands: run, verify and cost. Always run them from ~/Developer/shotrunner with uv run. Check flags with --help before trusting a guide, this one included.

shotrunner run

uv run shotrunner run SHOTLIST --provider PROVIDER --out DIR [--live --budget DOLLARS] [--retry-failed] [--workers N] [--models FILE]
FlagWhat it does
SHOTLISTThe shot list YAML. Image paths inside it are relative to this file.
--providerOne of fal, elevenlabs, comfyui, fake. One provider per run; shots for other providers are skipped and named.
--outWhere the .sqlite and the .fcpxml go ({out}/{project}.sqlite, {out}/{project}.fcpxml). Media never goes here.
--liveAllows a paid provider. Without it only fake works.
--budgetHard dollar cap for this run, required with --live. The plan is priced first; over the cap, nothing is sent. Use 0 for local ComfyUI.
--retry-failedAlso resubmits takes that failed. Without it, failed takes are left alone.
--workersTakes in flight at once. Each provider has its own cap (fal 2, ComfyUI 1).
--modelsAnother model catalog than models.yaml.

Exit codes: 0 done; 1 refused (no --live, a plan-time refusal such as a missing image or a duration a model can’t make, or a failed take); 2 over budget, nothing sent; 3 media on disk that this database doesn’t own, nothing sent.

shotrunner verify

uv run shotrunner verify OUT/PROJECT.fcpxml

Checks the FCPXML against Apple’s DTD and the project’s FCPXML rules, checks every media file exists and matches the database, checks the stringout adds up in exact frames, reads it back through OpenTimelineIO, and runs ffprobe on every ProRes and WAV (bt709, size, rate, channels). Expect OK: … (0 problems; DTD, rules, media, spine, database, OTIO round trip). Import nothing that fails verify.

shotrunner cost

uv run shotrunner cost OUT/PROJECT.sqlite

Prints every take with status, model, seed, the estimated cost and the provider’s own billing unit (billed, never summed), then total (done). Failed takes show their estimate but are left out of the total. Check real spend against fal’s usage CSV and the ElevenLabs dashboard.

4. The shot list and the catalog

A shot list is one YAML file per project. Keep it next to its plates, outside the repo. This is the shape that ran the N3 scene, cut to two shots:

project: 1939h_n3_stairwell            # plain ASCII; names the .sqlite, the .fcpxml and the media folder
fps: 24                                # 24, or 23.976
resolution: 1920x1080                  # the FCP project format
media_root: /Users/you/Movies/1939h_shotrunner_test   # absolute, ASCII, never /tmp; set once
defaults: {model: klingo3_i2v, takes: 2}
shots:
  - id: sh010b
    scene: n3_stairwell
    prompt: "A tired woman in her forties in a gray usherette uniform sits on a concrete step... The camera does not move."
    image: plates/N3-Stairwell-Closed.png   # start frame, relative to this file
    duration_s: 5
    seed: 111                          # take N uses seed + N - 1
    keywords: [n3, ara, face]
  - id: sh010fx
    scene: n3_stairwell
    model: el_sfx
    takes: 1
    prompt: "Slow chewing of a bread sandwich and the crinkle of its waxed-paper wrapper, in a small concrete stairwell."
    duration_s: 5
    keywords: [n3, sfx]

Other fields: refs: (reference images, in order, for reference-to-video entries; Seedance prompts cite them as @Image1), a top-level voices: mapping names to ElevenLabs voice ids with voice: on a dialogue shot (see examples/smoke_elevenlabs.yaml). A dialogue shot takes no duration_s of its own; a sound-effect shot needs one. The stringout follows shot order, so put each effect right after its shot and give it a matching id: sh010, sh010b, sh010fx, sh020. Quote any value that is on, off, yes or no, or YAML reads it as true or false.

Models you can name

The catalog is models.yaml in the repo; prices there drive the budget guard. These are the entries proven live (prices per requested second unless noted):

Model keyProviderKindPriceLengthsFacesFrame
klingo3_i2vfalimage-to-video$0.084/s3 to 15 sHolds the plate’s faceKeeps the plate’s shape, about 720p area (21:9 → 1472x624)
veo31_i2v_silentfalimage-to-video$0.20/s4, 6, 8 sHolds to three-quarter1920x1080 16:9 only
veo31_silentfaltext-to-video$0.20/s4, 6, 8 sIts own faces1920x1080
seedance25_i2v_720pfalimage-to-video, with sound$0.473/s4 to 30 sRefusedFollows the plate’s shape
kling3_profaltext-to-video$0.112/ssee catalogIts own faces1080p
wan22_480p, wan22_720pfaltext-to-video, 16 fps$0.04/s, $0.08/ssee catalogIts own faces832x480, 1280x720
el_sfxelevenlabssound effect$0.12/minanyn/aWAV
el_v3_dialogueelevenlabsdialogue$0.10 per 1k charactersfrom the linen/aWAV
wan22_i2v_q8_lightx2v_local, ltx25_i2v_q8_localcomfyuiimage-to-video, local$0on each model’s frame gridUntested832x480, 768x448

The catalog also holds Seedance 2.5 reference-to-video and Seedance 2.0 Mini draft entries; read models.yaml for their names and prices. A model missing from the catalog is refused. An entry older than 45 days prints a price warning on live runs: re-check the vendor’s page and update checked_on.

5. Using it on a scene

A scene goes from brief to picks in FCP in nine steps; the N3 stairwell took about an hour of running and $4.03. Spend money only at steps 5 and 6, and only after a free check.

  1. Brief. Write the scene brief in the film’s own project: per shot, what happens, the prompt, whether a readable face is in frame, the start plate, the length, and the sound. Add the face angle, the plate’s state at frame 0, and the number of actions (see the rules below).

  2. Plates. Export the locked plates and put them in {media_root}/plates/. PNG is safest; convert a webp losslessly with ffmpeg -i plate.webp plate.png. Check sizes with ffprobe. 21:9 is fine for Kling; Veo needs 16:9.

  3. Shot list. Write {media_root}/{project}.yaml. Route each shot: faces to klingo3_i2v (or veo31_i2v_silent for a 16:9 hero plate), no-face shots to Kling or Seedance, effects to el_sfx. Leave out shots that are better as a still in the edit.

  4. Free check, per provider. Run with --live and a budget too small to pass. It must end exit 2, show the plan and the estimate, and write no media:

    cd ~/Developer/shotrunner
    SL=~/Movies/1939h_shotrunner_test/1939h_n3_stairwell.yaml
    DB=~/Movies/1939h_shotrunner_test/db
    uv run shotrunner run "$SL" --provider fal --live --budget 0.10 --out "$DB"; echo "exit $?"
    uv run shotrunner run "$SL" --provider elevenlabs --live --budget 0.001 --out "$DB"; echo "exit $?"

    Any refusal other than the budget (a missing image, a length the model can’t make, a plate outside Kling’s limits) shows here, for free.

  5. One test take when something is new (a new model, a new aspect, a new kind of shot): a one-shot, one-take copy of the list with the same project, media_root and --out. The full run later counts it as done.

  6. Full run, once per provider, into the same --out, with a real budget a little over the estimate:

    uv run shotrunner run "$SL" --provider fal --live --budget 3.20 --out "$DB"; echo "fal exit $?"
    uv run shotrunner run "$SL" --provider elevenlabs --live --budget 0.10 --out "$DB"; echo "elevenlabs exit $?"
  7. Check. verify the FCPXML (0 problems), print cost, and make contact sheets and last frames to judge faces and continuity before you open FCP:

    uv run shotrunner verify "$DB"/1939h_n3_stairwell.fcpxml
    uv run shotrunner cost "$DB"/1939h_n3_stairwell.sqlite
  8. Import. open -a "Final Cut Pro Creator Studio" "$DB"/1939h_n3_stairwell.fcpxml. Expect no warning dialog, every take in the event with keywords and its prompt as a note, and the stringout in shot order with a marker per clip. A re-import makes a second event, so delete the old one first.

  9. Pick and iterate. Judge every face against the character’s hero and sheet. A take that fails is fixed with a new shot id and a new prompt or plate, never by rerunning the old id. Compare the bill with fal’s usage CSV the same day.

Keep shell lines short (use variables as above). A long line pasted into zsh can split in two and run half a command.

6. Rules learned the hard way

Every rule here cost a take or more to learn; the full record is in docs/failures.md.

7. Where things land

Media goes under media_root; only the database and the FCPXML go under --out. The clip name {shot}_tk{NN} is a take’s identity on disk and in FCP.

WhatPath
Originals, untouched, with the provider’s JSON beside them{media_root}/{project}/originals/{shot}/
ProRes 422 for video takes{media_root}/{project}/prores/{shot}/{shot}_tk{NN}.mov
WAV for dialogue and effects{media_root}/{project}/audio/{shot}/{shot}_tk{NN}.wav
Database (every take, request id, cost, SHA-256){out}/{project}.sqlite
FCPXML (event and stringout){out}/{project}.fcpxml

In FCP each take carries keywords (shot id, scene, provider, model, your own keywords) and its full prompt as a note; its stringout clip carries a marker on frame 0 with take, seed, cost and model. A clip whose size isn’t the project’s (Kling’s 1472x624, say) gets its own format and sits letterboxed in the 1080p stringout. Video with sound and dialogue take the dialogue role; effects take the effects role.

Back up the originals folder with the project. The database’s SHA-256 of each file is how the runner knows the media is its own.

8. Troubleshooting

Read the whole message first; shotrunner names the shot, the file or the limit it refused on.

SymptomCauseFix
exit 1 and nothing sent, on a paid provider--live missingAdd --live --budget N.
over budget: … Nothing submitted (exit 2)The plan costs more than --budgetRaise the budget, or cut takes. It leaves planned rows behind; the next run submits them.
exit 3, files named “not owned” by this databaseThose media files belong to another database, or a changed prompt reuses an old clip nameRerun with the --out that holds the project’s database, or give the new direction a new shot id. Never delete media to get past it.
skip sh010fx: el_sfx belongs to elevenlabsNormal: one provider per runRun again with that --provider, same --out.
--provider: expected one argumentA pasted long line split in twoUse short lines with shell variables.
An image-to-video shot refused at plan timeNo image: on the shot, or the file isn’t thereAdd the plate path, relative to the shot list.
Kling refuses a plateUnder 300 px a side, aspect outside 0.4 to 2.5, over 50 MB, or unreadable (“ffprobe found no picture in it”)Re-export the plate. A 3-byte or broken PNG reads as 0x0.
A length refused, with the nearest valid onesVeo takes 4, 6, 8 s; local Wan and LTX need their frame gridUse a listed length and trim in the edit.
fal 422 content_policy_violation, partner_validation_failed on image_urlSeedance refuses a photoreal faceNot billed. Route the shot to Kling or Veo.
A fal error cut off mid-sentence in the databaseThe runner stores 500 charactersFull text: api.fal.ai/v1/models/requests/by-endpoint?endpoint_id=…&expand=payloads with your API key.
The face isn’t the characterAn angle the plate didn’t show, or “young” in the promptKeep the head near the plate’s angle, or make a plate with the angle; state the real age. New shot id.
The take ends mid-actionToo many actions for the lengthSplit the shot, or cut before the end.
The frame driftsModels ignore “the camera does not move” at timesStabilize or crop in FCP, or pick the other take.
FCP shows media offlineMedia moved, or media_root under /tmp or an iCloud-synced folderKeep media in a fixed local folder; relink in FCP.
Unable to find application named 'Final Cut Pro'The Creator Studio build’s nameopen -a "Final Cut Pro Creator Studio" …
A second event appears in FCPRe-importing the same FCPXMLDelete the old event first.
A price warning on a live runA catalog entry is over 45 days oldCheck the vendor’s page; update price_per_s and checked_on in models.yaml.
cost total looks low next to the billElevenLabs bills in credits, never summedCheck the ElevenLabs dashboard; fal’s usage CSV for fal.
The gate fails after git pullThe repo or an adapter changedDon’t run paid takes. Note the failing test and ask before changing anything.
ComfyUI takes never finishComfyUI not running, wrong port, or a model not loadedStart comfy-v (port 8190); check its log for “Prompt executed in”.

When something new goes wrong, write it in docs/failures.md with the exact error. That file is how the next scene avoids it.