fablecut 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md CHANGED
@@ -21,17 +21,27 @@ Every Claude Code session then has these tools:
21
21
  - `fablecut_get_project` / `fablecut_set_project` — read / replace the timeline JSON.
22
22
  `fablecut_get_project {compact:true}` returns a one-line-per-clip summary instead.
23
23
  - `fablecut_patch_project` — apply targeted ops (add/update/remove clip/media,
24
- set project fields) without round-tripping the document. **Prefer this for edits.**
24
+ set project fields, add and open sequences) without round-tripping the document. **Prefer this for edits.**
25
25
  - `fablecut_import_media` — copy a local file (or download an `https://` URL)
26
26
  into `./media/` and register it. The stored `src` is always `/media/…`.
27
27
  - `fablecut_analyze_reference` — turn a reference video into an edit blueprint
28
28
  (shots, beats, BPM, energy, drop) + extract its music. See "Remake a reference video".
29
- - `fablecut_encode_profiles` — list export presets from `encoding-profiles.json` (each is a
30
- raw ffmpeg args list). Set `project.encodeProfile` via patch to pin a project default.
29
+ - `fablecut_frame` — **look at** a moment and get back an actual image.
30
+ `{path, t}` returns one frame of a source clip; `{path, frames}` returns a
31
+ contact sheet across it; with no `path`, `{time}` renders the composed
32
+ timeline. See "Look at the footage" below.
33
+ - `fablecut_encode_profiles` — list the **delivery presets** (YouTube, Shorts, Reels, TikTok,
34
+ X, LinkedIn, Master, Broadcast, Web, Archive, saved ones) and the raw ffmpeg **encoding
35
+ profiles** from `encoding-profiles.json`. `{preset:"youtube"}` returns one preset's spec.
36
+ See "Export" below.
31
37
  - `fablecut_normalize_audio` — measure clips (BS.1770 LUFS or sample peak, via ffmpeg) and
32
38
  set their clip gain to a loudness target. See "Audio mix" below.
33
39
  - `fablecut_auto_duck` — find where the voice tracks speak and write `duck` keyframes that
34
40
  dip the music under it. See "Audio mix" below.
41
+ - `fablecut_frame` — **see** a moment. `{path, t}` → one JPEG frame of a source
42
+ clip; `{path, frames:12}` → a contact sheet across it; `{time}` → the composed
43
+ timeline, graded, as export renders it. Returns a real image, not numbers.
44
+ See "Look at the footage" below.
35
45
  - `fablecut_denoise` — reduce background noise on audio clips (renders a cleaned copy of the
36
46
  file and switches the clip's stems to it). See "Audio mix" below.
37
47
  - `fablecut_export` — render the timeline to a file in `exports/` with the editor's own
@@ -41,6 +51,14 @@ Every Claude Code session then has these tools:
41
51
  select. See "Color" and "Masks" below.
42
52
  - `fablecut_track` — motion tracking: follow a region of a video clip, store it as
43
53
  a track, and make a mask or another clip follow it. See "Tracking" below.
54
+ - `fablecut_proxy` — make, check or delete proxies: light copies of heavy footage
55
+ the editor plays while editing (export always reads the originals). See
56
+ "Media management" below.
57
+ - `fablecut_projects` — list, open, create (from a canvas or a saved template),
58
+ duplicate, rename, annotate, archive and delete projects. `./project.json` is
59
+ always the open one. See "Projects" below.
60
+ - `fablecut_versions` — a project's saved versions: save one before big edits, compare
61
+ a version with now, restore one (never destructive), mark the final cut. See "Versions" below.
44
62
 
45
63
  ### Token-efficient editing (important for agents)
46
64
 
@@ -59,8 +77,12 @@ Editing via full get→modify→set costs thousands of tokens per change. Cheape
59
77
  Re-check the clips, then retry with that revision.
60
78
  3. **Docs**: request `fablecut_docs {section:"schema"}` (or "Recipes", "Remake", …)
61
79
  instead of the whole manual; skip it entirely if the schema is already in context.
62
- 4. **Media questions** (duration, fps, size): read them from the registered media
63
- entries — don't shell out to ffprobe; the browser probes and writes them back.
80
+ 4. **Media questions** (duration, resolution, fps, codec, audio channels, file
81
+ size, how often it is used): read them from the registered media entries or
82
+ the compact view's MEDIA lines — don't shell out to ffprobe; the editor
83
+ probes every file and writes them back (see "Media management").
84
+ For what the footage *looks like*, use `fablecut_frame` — it is far cheaper
85
+ than reading a file, and far more reliable than inferring from a number.
64
86
  5. Batch related changes into ONE patch call (ops apply in order, one revision bump).
65
87
  6. **Cut and trim with the edit ops** (next section) rather than recomputing
66
88
  `start` / `in` / `duration` by hand — they keep linked stems in sync.
@@ -121,9 +143,9 @@ then `/plugin install fablecut@fablecut`) does the registration for you.
121
143
 
122
144
  ### Where the files are
123
145
 
124
- `project.json`, `media/`, `exports/`, `analysis/` and `library/` normally sit in
146
+ `project.json`, `projects/`, `media/`, `exports/`, `analysis/` and `library/` normally sit in
125
147
  the repo next to `server.js`; installed from npm (`npx fablecut`) they sit in
126
- `~/FableCut`. Set **`FABLECUT_DATA_DIR`** to move all five
148
+ `~/FableCut`. Set **`FABLECUT_DATA_DIR`** to move all six
127
149
  somewhere else; the code and the static app files stay in the install directory
128
150
  either way. The plugin sets this so a plugin update can replace the install
129
151
  directory without touching anyone's timeline or footage. **Don't assume
@@ -133,6 +155,9 @@ reports the real paths.
133
155
  Tests (and nothing else) may set **`FABLECUT_NO_FS_WATCH=1`** to skip `fs.watch`.
134
156
  On Windows, libuv can abort the process when a file is created under a temp
135
157
  data dir. Production leaves watching on so the UI live-reloads.
158
+ Tests may also set **`FABLECUT_NO_AUTOSTART=1`** so `ensureUIServer()` reports
159
+ a missing editor server instead of spawning one — the auto-start is detached,
160
+ so a test that triggers it would leave a `server.js` running after it finishes.
136
161
 
137
162
  ## Run
138
163
 
@@ -254,6 +279,10 @@ Examples in `library/svg/`: `sparkles.svg` (loop), `lower-third.svg`,
254
279
  "untargetedTracks": [ "V2" ],
255
280
  // ^ optional — lanes edits skip (split, insert, ripple, close gap…); default: all targeted
256
281
  "encodeProfile": "hq", // optional — fast-export profile id (see encoding-profiles.json)
282
+ "delivery": { "preset": "youtube", "width": 1920, "height": 1080, "…": "…" },
283
+ // ^ optional — the delivery spec exports use by default (see "Delivery presets"); setProject takes a preset id
284
+ "outputs": [ { "id": "o_1", "on": true, "preset": "master", "…": "…" } ],
285
+ // ^ optional — batch outputs: files made together, one render per frame rate (see "Batch outputs and the export queue")
257
286
  "master": { "gain": -1.5, "fx": [ { "type": "limiter", "ceiling": -1 } ] },
258
287
  // ^ optional — master fader, dB (−60 = silence … +12; omit = 0 dB) and master effects (see "Audio mix")
259
288
  "tracks": [ // optional — timeline lanes (default V3…V1 + A1…A4)
@@ -268,13 +297,20 @@ Examples in `library/svg/`: `sparkles.svg` (loop), `lower-third.svg`,
268
297
  { "id": "A4", "kind": "audio" }
269
298
  ],
270
299
  "buses": [ { "id": "B1", "name": "Dialogue", "gain": -2, "fx": [ { "type": "compressor" } ] } ],
300
+ // ^ optional — submix buses B1…B8: name, gain (dB), pan, mute, fx; tracks route in with `out`
301
+ "collections": [ { "id": "col_sel", "name": "Selects", "media": [ "m_abc" ] } ],
302
+ // ^ optional — Project-bin collections: media grouped across folders; see "Media management"
271
303
  "comps": [ { "id": "lt", "name": "Lower third", "width": 1280, "height": 720, "duration": 5, "clips": [ /* … */ ] } ],
272
304
  // ^ optional — compositions (nested sequences), placed with kind:"comp" clips; see "Compositions (nested sequences)"
273
- // ^ optional — submix buses B1…B8: name, gain (dB), pan, mute, fx; tracks route in with `out`
305
+ "sequence": "main", "sequences": [ { "id": "main", "name": "Main" }, { "id": "seq_v9", "name": "Reel 9:16", "width": 1080, "height": 1920, "clips": [ /* … */ ] } ],
306
+ // ^ optional — several timelines in one project; the open one is this top level; see "Sequences"
274
307
  "media": [
275
308
  { "id": "m_abc", "name": "intro.mp4", "kind": "video", // video|audio|image|svg
276
309
  "src": "/media/intro.mp4", // path under ./media or ./library (never a raw https:// URL)
277
310
  "duration": 12.4, "width": 1920, "height": 1080,
311
+ "fps": 29.97, "codec": "h264", "audioCodec": "aac", "audioChannels": 2, "sampleRate": 48000,
312
+ "size": 45200000, "bitrate": 29300000, // probed from the file (read-only; see "Media management")
313
+ "favorite": true, "tags": [ "interview", "day 1" ], // optional: bin organization
278
314
  "folderId": null }, // optional: id of a folders[] entry
279
315
  { "id": "m_abd", "name": "intro.denoise-medium.flac", "kind": "audio", "src": "/media/intro.denoise-medium.flac",
280
316
  "derivedFrom": "m_abc", "denoise": "medium" } // a noise-reduced copy of m_abc (see "Audio mix")
@@ -1346,6 +1382,343 @@ with `fields:{logo:"<your logo's media id>", brand, accent}` at 0;
1346
1382
  it in every project; **titles that arrive and leave the same way** —
1347
1383
  `applyPreset` an In and an Out on every title in one patch.
1348
1384
 
1385
+ ### Media management
1386
+
1387
+ The Project bin knows each file's details and helps find, group and track
1388
+ footage. Everything here is organization: none of it changes what plays or
1389
+ exports.
1390
+
1391
+ **Metadata.** The editor reads every file in `media/` and `library/` with
1392
+ ffprobe (via `GET /api/media-info`) and writes what it finds onto the media
1393
+ entry. These fields are read-only — they describe the file:
1394
+
1395
+ | key | does |
1396
+ |---|---|
1397
+ | `fps` | video frame rate (29.97, 25, 59.94 …); absent for stills and audio |
1398
+ | `codec` | video codec (`h264`, `hevc`, `prores`, `vp9` …), or the image format (`png`, `mjpeg`) |
1399
+ | `audioCodec` · `audioChannels` · `sampleRate` | first audio stream: codec, channel count (`0` = the file has no audio), Hz |
1400
+ | `size` · `bitrate` | file size in bytes · overall bitrate, bits per second |
1401
+ | `width` · `height` · `duration` | as before; filled in when missing (phone footage shot rotated reports its upright size) |
1402
+
1403
+ Without ffprobe on PATH only `size` is filled in; the browser still probes
1404
+ `duration`, `width` and `height`.
1405
+
1406
+ **Organizing.** `favorite: true` stars a file; `tags` is a list of free-form
1407
+ labels (at most 24, each up to 32 characters, matched without regard to case).
1408
+ `collections` at the top of the document group media across folders — a file
1409
+ can be in any number of them, while it sits in one folder (`folderId`).
1410
+
1411
+ **Usage.** A file's *placements* are the clips that show it, on the main
1412
+ timeline and inside every composition. A video and the audio stems linked to it
1413
+ count as one placement, so a shot used twice reads "used 2×".
1414
+
1415
+ In the editor, the Project tab has:
1416
+
1417
+ - **Search** — every word must match the name, kind, extension, codec,
1418
+ resolution (`3840x2160`, `2160p`) or a tag; `#word` matches tags only. Esc clears it.
1419
+ - **Show** — All media · ★ Favorites · Used in the edit · Unused · a kind · a
1420
+ collection · a tag. While searching or filtering, the bin lists the hits flat
1421
+ (each with its folder), with a count and **Clear**; a collection's view also
1422
+ has **Rename** and **Delete** (its media stay).
1423
+ - **Sort** — name (natural: `shot 2` before `shot 10`), kind, duration,
1424
+ resolution, frame rate, codec, audio channels, file size or times used, with
1425
+ ↑ / ↓. Files missing a value sort last either way. Folders keep their tree;
1426
+ the sort applies inside each.
1427
+ - **☰ List view** — one row per file with columns: name, duration, resolution,
1428
+ FPS, codec, audio, size and uses; click a column heading to sort by it. On a
1429
+ narrow bin the columns drop out right to left; widen the panel to see them all.
1430
+ - On each file: **☆** stars it, the **uses** badge opens its placements.
1431
+ Right-click a file → **Open in Source**, **Find timeline instances** (every
1432
+ placement, main timeline and comps, with track and time — click one to jump
1433
+ there, opening its comp if needed), **Media info…**, favorites, **Tags…**,
1434
+ **Add to / Remove from** a collection, **New collection…**, **Remove from project**.
1435
+ - Right-click a clip on the timeline → **Reveal in project** scrolls the bin to
1436
+ its file (or its comp), opening folders and clearing a search that hides it.
1437
+
1438
+ **Offline media.** A file is *offline* when its `src` names nothing under
1439
+ `media/` or `library/` — it was moved, renamed or deleted. The editor checks
1440
+ on load and whenever those folders change. An offline file's clips stay where
1441
+ they are: the timeline hatches them red (**⚠ Offline**), the monitor and the
1442
+ export draw a **Media offline** slate in the picture's place, and its audio is
1443
+ silent. The bin marks the file **OFFLINE**, says how many are missing, and the
1444
+ Show filter gains **⚠ Offline**. The Export dialog warns before rendering one.
1445
+ Files under `media/` may sit in subfolders (`/media/archive/a.mp4`).
1446
+
1447
+ - **Relink** points a media entry at the same footage where it is now; clips
1448
+ keep their In points, edits and everything else. Right-click the file →
1449
+ **Relink…** (or **Relink…** on the offline banner for all of them). The
1450
+ dialog looks through `media/` and `library/` for each file — same name, the
1451
+ same name with another extension, a similar name, the same size — and
1452
+ picks a same-name match for you. **Browse…** picks one file and **Choose
1453
+ folder…** matches a whole folder by name; either copies the chosen files
1454
+ into `media/`. A relinked file whose length differs from the original gets
1455
+ a warning (is it really the same footage?).
1456
+ - **Replace file…** (right-click a file) puts a *different* file behind the
1457
+ media entry — a new render, a better take. Every clip using it switches;
1458
+ each keeps its In point and timing, trimmed to fit a shorter file. The name
1459
+ and details follow the new file; favorites, tags and collections stay. To
1460
+ swap the file of one clip only, use the Inspector's **Source** menu instead.
1461
+ - Relink and replace are one undo step each.
1462
+
1463
+ **Proxies.** Heavy footage — 4K, HEVC, ProRes, long phone clips — can stutter
1464
+ while you scrub and play. A *proxy* is a light copy the editor plays instead
1465
+ while you edit: H.264 at 540p (or 720p / 1080p, never larger than the
1466
+ source), a keyframe every 12 frames so seeking is quick, the source's own
1467
+ timestamps (frame for frame — no frames added or dropped) and its first audio
1468
+ stream. The edit always refers to the original: the timeline, `project.json`
1469
+ and every clip stay the same whether proxies are on or off.
1470
+
1471
+ **Export always reads the originals**, and so do `fablecut_frame` (timeline
1472
+ mode), `fablecut_scopes`, tracking and every other measurement — the
1473
+ players switch to the original files for the render and back afterwards. A
1474
+ proxy only changes how smoothly the preview runs, never the result.
1475
+
1476
+ - Right-click a video in the bin → **Create proxy (540p)** / **(720p)**;
1477
+ right-click the **Project** tab → **Create proxies for N videos**. ffmpeg
1478
+ makes them on the server one at a time in the background; the bin shows
1479
+ each file's progress (**P 42%**), then a green **P** once it is ready.
1480
+ **Delete proxy** removes one. The bin's list view has a **Proxy** column,
1481
+ Show has **Has a proxy** / **Video without a proxy**, and **Media info**
1482
+ says which file is playing.
1483
+ - The monitor's **Proxy** button turns proxy playback on and off (on by
1484
+ default; remembered in this browser). The Source monitor follows it too.
1485
+ - Proxies live in `analysis/proxies/`, a disposable cache: each is named
1486
+ after its source file *and that file's size and modification time*, so a
1487
+ re-rendered or replaced original simply has no proxy until you make a new
1488
+ one. Deleting the folder loses nothing but time. Proxies need ffmpeg.
1489
+
1490
+ **Agents:**
1491
+
1492
+ - `{op:"updateMedia", id | ids, set:{name?, favorite?, tags?, folderId?}, addTags?, removeTags?}`
1493
+ — organize files (`favorite:false` unstars; `tags:[]` clears). Metadata keys
1494
+ are refused: they come from the file.
1495
+ - `{op:"setCollection", id?, name?, media?, add?, remove?}` creates a collection
1496
+ (a new `id`, or a `name` no collection has) or changes one: `media` replaces
1497
+ its list, `add` / `remove` edit it. `{op:"removeCollection", id}` deletes it;
1498
+ its media stay. `removeMedia` takes a file out of every collection.
1499
+ - The compact view lists each file with its metadata, ★, tags, folder and
1500
+ `uses:N`, and the collections on one line:
1501
+ `m_abc video "intro.mp4" 12.4s 1920×1080 29.97 fps h264 stereo 48 kHz 45 MB ★ #interview uses:2`.
1502
+ - `fablecut_import_media` probes the file as it imports it, so the entry it
1503
+ returns already has these fields.
1504
+ - `fablecut_status` lists offline media, and the compact view marks each
1505
+ `OFFLINE (file missing — relinkMedia)` and each video with a proxy `proxy:540p`.
1506
+ - `fablecut_proxy {}` reports every video's proxy; `{create:true, mediaIds?, height?}`
1507
+ makes them (waits until done unless `wait:false`); `{delete:true, mediaIds?}`
1508
+ removes them. Proxies never change what you measure or export, so an agent
1509
+ only needs them when the user asks for smoother playback.
1510
+ - `{op:"relinkMedia", id, src:"/media/…", name?}` — the same footage found
1511
+ elsewhere: put the file in `media/` (copy it, or `fablecut_import_media` and
1512
+ `removeMedia` the extra entry it registers), then relink. The note warns when
1513
+ the new file's length differs.
1514
+ - `{op:"replaceMedia", id, src, name?}` — a different file behind the entry;
1515
+ clips keep their timing, trimmed to fit (the note says how many). `src` must
1516
+ be an existing file under `/media/` or `/library/` of the same kind (an
1517
+ audio entry may use a video container).
1518
+
1519
+ ### Projects
1520
+
1521
+ One FableCut keeps any number of projects. **`./project.json` is always the
1522
+ open project**: the editor, every MCP tool, the REST API and scripts read and
1523
+ edit that file as before. The others wait in `projects/`, and opening one
1524
+ swaps it in:
1525
+
1526
+ | path | holds |
1527
+ |---|---|
1528
+ | `projects/index.json` | `{active}` — the open project's id |
1529
+ | `projects/<id>/meta.json` | `{id, created, opened, archived, notes, tags, template?}` |
1530
+ | `projects/<id>/project.json` | the document (while that project is open, `./project.json` is the live copy) |
1531
+ | `projects/<id>/thumb.jpg` | the editor's last picture of it |
1532
+ | `library/project-templates/<id>.json` | a saved project template `{name, created, project}` |
1533
+
1534
+ `media/`, `exports/`, `analysis/` and `library/` are shared by every project,
1535
+ so a duplicate or a project made from a template copies no footage. The first
1536
+ time projects are used, the existing `./project.json` becomes the first
1537
+ project, unchanged. Ids look like `p_3f9a01c2de`.
1538
+
1539
+ **Opening a project** saves the open one into its folder, then copies the
1540
+ chosen one to `./project.json` with a `revision` above both. A save based on
1541
+ the project that was open before (an editor tab, an agent's
1542
+ `fablecut_set_project`, a `baseRevision` patch) is therefore refused as a
1543
+ CONFLICT instead of landing in the wrong project. Editor tabs reload, clear
1544
+ their undo history and close an open composition. `GET /api/project` names the
1545
+ open project in the `X-FableCut-Project` header, and the editor sends it back on
1546
+ every save, so an edit made for one project can never be written into another.
1547
+
1548
+ In the editor: **Projects** in the top bar (**Ctrl/Cmd+O**, or a click on the
1549
+ project name) opens the dashboard: cards with a picture, size, frame rate and length; search
1550
+ by name, notes or `#tag`; sort by last opened, last modified, created or name.
1551
+ Pick one to rename it, write notes, tag it, **Open** (or double-click / **Enter** on its card), **Duplicate**, **Save as
1552
+ template** or **Archive** it. **Archived** lists archived projects, where
1553
+ **Unarchive** brings one back and **Delete…** (click twice) removes it; only
1554
+ archived projects can be deleted, and the open one can be neither archived
1555
+ nor deleted. **+ New project** starts one from a canvas (Landscape 16:9 1080p,
1556
+ Vertical 9:16, Square 1:1, Portrait 4:5, 4K UHD, Landscape 720p) or a saved
1557
+ template, with its own frame rate. **Import…** adds a project file from
1558
+ elsewhere (an old backup, another machine); its media must be in `media/`,
1559
+ and Relink finds files that moved.
1560
+
1561
+ **Agents** use `fablecut_projects` (or `GET /api/projects`, `POST /api/projects`):
1562
+
1563
+ - `{}` or `{action:"list", archived?:"only"|"all"}` lists them: id, name, size,
1564
+ length, clips, tags, notes, and which is `(OPEN)`.
1565
+ - `{action:"open", id}` switches the editor to that project; re-read it with
1566
+ `fablecut_get_project {compact:true}` before editing.
1567
+ - `{action:"new", name, template?, fps?, width?, height?, notes?, tags?, open?}` —
1568
+ `template` is `landscape-1080` (default), `vertical-1080`, `square-1080`,
1569
+ `portrait-1350`, `uhd-4k`, `landscape-720` or a saved template's id; it opens
1570
+ unless `open:false`.
1571
+ - `{action:"duplicate", id, name?, open?}` · `{action:"update", id, name?, notes?, tags?}` ·
1572
+ `{action:"archive" | "unarchive" | "delete", id}`.
1573
+ - `fablecut_status` also counts the open project's versions; see "Versions" for them.
1574
+ - `{action:"templates"}` · `{action:"save_template", id, name}` (the project's
1575
+ canvas, tracks, clips and media references) · `{action:"delete_template", template}`.
1576
+ - Opening, archiving or deleting changes what the user sees: do it only when
1577
+ they asked. `fablecut_status` says how many projects there are.
1578
+
1579
+ Recipes: **one edit, three versions** — `duplicate` the project per client
1580
+ cut, put the brief in `notes`; **house canvas** — build an empty project with
1581
+ your tracks, intro and outro, `save_template`, then `new` from it for every
1582
+ episode; **park finished work** — `archive` delivered projects to keep the
1583
+ list short without deleting anything.
1584
+
1585
+ ### Versions
1586
+
1587
+ Every edit is saved as it happens, and undo covers the session. **Versions** are
1588
+ what you come back to later: full copies of a project, kept beside it, that are
1589
+ never overwritten. Restoring one is not destructive either — what is there is
1590
+ saved as a version first, so a restore can be undone by restoring that.
1591
+
1592
+ | path | holds |
1593
+ |---|---|
1594
+ | `projects/<id>/history/v0007.json` | the project as it was |
1595
+ | `projects/<id>/history/v0007.meta.json` | `{v, name, note, kind, created, revision, clips, duration, final}` |
1596
+
1597
+ A version's `kind` says where it came from:
1598
+
1599
+ | kind | made |
1600
+ |---|---|
1601
+ | `manual` | by you (**Save version**, **Ctrl/Cmd+S**) or an agent (`fablecut_versions {action:"save"}`) |
1602
+ | `auto` | every 10 minutes while the open project changes, whoever changes it (`FABLECUT_AUTO_VERSION_MIN` sets the minutes); the newest 30 are kept |
1603
+ | `agent` | before an agent's first edit of a session (again after 10 quiet minutes), and before every `fablecut_set_project` rewrite |
1604
+ | `restore` | what was there just before a restore |
1605
+
1606
+ One version per project can be marked **final** (the cut that went out); a final
1607
+ version can't be deleted until it is unmarked. Manual, agent and restore
1608
+ versions are never pruned.
1609
+
1610
+ **Compare** tells what changed between a version and now (or two versions):
1611
+ clips added, removed and changed (timing, which props, keyframes, effects,
1612
+ transitions, source, track), media added and removed, the length, and project
1613
+ settings (name, canvas, frame rate, IN / OUT, tracks, markers, comps, mix,
1614
+ delivery, …).
1615
+
1616
+ **Backup and recovery.** **Download backup** saves a project with all its
1617
+ versions as one `.fablecut-backup.json` file; **Import…** in the dashboard brings
1618
+ it back, versions included. When `project.json` can't be read as the server
1619
+ starts (another tool crashed mid-write, a bad hand edit), the server keeps the
1620
+ broken file as `project.corrupt-<time>.json` and puts back the newest good copy:
1621
+ the latest version, or the project's last parked copy.
1622
+
1623
+ In the editor: **Ctrl/Cmd+S** saves a version of the open project. In the
1624
+ Projects dashboard, a project's **Versions…** lists its versions, newest first,
1625
+ with **Save version** (name and note), and per version **Compare with now**,
1626
+ **Restore…** (click twice), **Mark final**, **Rename**, **Download** and
1627
+ **Delete…** (click twice). Esc goes back to the projects.
1628
+
1629
+ **Agents** use `fablecut_versions` (or `GET` / `POST /api/versions`):
1630
+
1631
+ - `{}` lists the open project's versions (`project` picks another one).
1632
+ - `{action:"save", name?, note?, final?}` — **save one before a big or risky
1633
+ change** (a restructure, a remake, a new grade on every shot) and when the user
1634
+ is happy with a cut, so there is a named point to go back to.
1635
+ - `{action:"diff", version, to?}` — what changed since that version (to now, or
1636
+ to version `to`). Use it to tell the user what an edit session changed.
1637
+ - `{action:"restore", version}` — only when the user asked; then re-read the
1638
+ project. `{action:"update", version, name?, note?, final?}` ·
1639
+ `{action:"delete", version}`.
1640
+
1641
+ Recipes: **try a bold alternative** — save a version, make the change, compare,
1642
+ and restore if the user prefers the old one; **client rounds** — save "Round 1",
1643
+ "Round 2", … with the feedback in the note, mark the approved one final;
1644
+ **what did the agent do?** — `diff` against the "Before agent edits" version.
1645
+
1646
+ ### Sequences
1647
+
1648
+ A project can hold several **sequences**: timelines of their own that share
1649
+ the project's media, folders, collections and compositions. Typical uses: a
1650
+ 16:9 cut and a 9:16 cut of the same edit, a 30 s and a 15 s version, a client
1651
+ cut beside an alternative, or a stringout of selects next to the edit. A
1652
+ project with one sequence (every project, until you add one) is exactly the
1653
+ document described above.
1654
+
1655
+ **The open sequence is the document's top level.** `clips`, `tracks`,
1656
+ `markers`, `inPoint` / `outPoint`, the canvas (`width`, `height`, `fps`,
1657
+ `background`, `exportFrame`), the mix (`master`, `buses`), the track switches
1658
+ and the delivery settings (`delivery`, `outputs`, `encodeProfile`) are the open
1659
+ sequence's. Every tool, op, export and the compact view work on them, as
1660
+ always. The others wait in `sequences`, each with its own copy of those keys:
1661
+
1662
+ ```jsonc
1663
+ "sequence": "main", // the open one
1664
+ "sequences": [
1665
+ { "id": "main", "name": "Main" }, // the open one: its timeline is the top level
1666
+ { "id": "seq_v9", "name": "Reel 9:16", "width": 1080, "height": 1920, "fps": 30,
1667
+ "clips": [ /* … */ ], "tracks": [ /* … */ ], "markers": [ /* … */ ], "delivery": { "preset": "instagram-reels" } }
1668
+ ]
1669
+ ```
1670
+
1671
+ Opening another sequence parks the top-level keys in the open one's entry and
1672
+ brings the other's up, with a new `revision` — like any edit. A clip in a
1673
+ sequence that isn't open still counts: its media shows "used" in the bin,
1674
+ can't be removed while it is there (`removeMedia` and **Remove from project**
1675
+ refuse and name the sequence), and **Replace file…** trims it too; a comp it
1676
+ places can't be removed either. A project with one sequence named Main has
1677
+ neither key.
1678
+
1679
+ In the editor: the **sequence menu** at the left of the timeline toolbar (it
1680
+ shows the open sequence's name, and how many there are) lists them — click one
1681
+ to open it — and has **New sequence…** (a name, a canvas — the same as the open
1682
+ one, or 16:9, 9:16, 4:5, 1:1 — and, optionally, a copy of the open sequence's
1683
+ timeline to start from), **Duplicate**, **Rename…** and **Delete…** (click
1684
+ twice; the project is first kept as a version, so a deleted sequence can be
1685
+ restored from **Projects → Versions**). For the session each sequence keeps its
1686
+ own undo history, playhead and selection. The Export dialog, the Mixer, IN /
1687
+ OUT and the canvas settings all belong to the open sequence. **Find timeline
1688
+ instances** lists placements in other sequences too; clicking one opens its
1689
+ sequence.
1690
+
1691
+ **Agents** (`fablecut_patch_project`):
1692
+
1693
+ - `{op:"addSequence", name?, id?, from?, width?, height?, fps?, open?:true}` —
1694
+ `from:"empty"` (default; the open sequence's canvas and frame rate, no clips),
1695
+ `"open"` (a copy of the open sequence's timeline) or a sequence id (a copy of
1696
+ that one). `width` / `height` / `fps` change the copy's canvas: the clips keep
1697
+ their positions relative to the centre, and an `exportFrame` is dropped.
1698
+ - `{op:"inSequence", sequence, ops:[…]}` runs ops on a sequence **without
1699
+ opening it**: clip and timeline ops, `setProject` (its canvas, markers, IN /
1700
+ OUT, delivery), `setTrack`, `setBus`, `setFx` on its tracks, and
1701
+ `updateSequence` (name, index) — not `addSequence`, `openSequence`,
1702
+ `removeSequence` or another `inSequence`. The user's editor stays where it is.
1703
+ - `{op:"openSequence", id}` changes what the user's editor shows, and what
1704
+ `fablecut_export`, `fablecut_frame {time}` and `fablecut_scopes` render: do it
1705
+ when the user asked, or to export that sequence.
1706
+ - `{op:"updateSequence", id, set:{name?, index?}}` renames or reorders one;
1707
+ `{op:"removeSequence", id}` deletes one (only when asked; the last one stays,
1708
+ deleting the open one opens its neighbour, and one holding locked clips or
1709
+ tracks needs `force:true`).
1710
+ - The compact view and `fablecut_status` list every sequence (id, name,
1711
+ canvas, clips, length, which is open). A version's **Compare** reports each
1712
+ sequence's changes on its own, sequences added and removed, and which one
1713
+ was open.
1714
+
1715
+ Recipes: **vertical cut of a finished edit** — `addSequence {name:"Reel 9:16",
1716
+ from:"open", width:1080, height:1920}`, then `inSequence` ops to re-position
1717
+ or re-scale the shots and `setProject {delivery:"instagram-reels"}` in it;
1718
+ **cut-downs** — duplicate the edit as "30 s" and "15 s" and tighten each with
1719
+ the trim ops inside `inSequence`; **selects reel** — an empty sequence the
1720
+ user drops favourite takes on, cut into the edit from the Source monitor.
1721
+
1349
1722
  ### Semantics
1350
1723
 
1351
1724
  - Rendering order: V1 is drawn first, then V2, V3, … on top. SVG/image/text clips
@@ -1441,6 +1814,44 @@ it in every project; **titles that arrive and leave the same way** —
1441
1814
  - `bgRemove` and `chromaKey` can combine with all filters; heavy pixel work is
1442
1815
  automatic (only runs when those props are set).
1443
1816
 
1817
+ ## Look at the footage (`fablecut_frame`)
1818
+
1819
+ `fablecut_analyze_reference` gives you the **ears** — where the cuts are, how hard
1820
+ each shot hits. `fablecut_frame` gives you the **eyes**. It answers with a real
1821
+ image (an MCP `image` content block), so you can judge a shot instead of
1822
+ inferring it from an `energy` value.
1823
+
1824
+ | call | returns |
1825
+ |---|---|
1826
+ | `{path:"/media/x.mp4", t:3.2}` | that exact frame |
1827
+ | `{path:"/media/x.mp4", frames:12}` | a 4×3 contact sheet across the whole clip |
1828
+ | `{path:"/media/x.mp4", frames:12, from:30, to:90}` | a contact sheet across part of it |
1829
+ | `{time:8.5}` (no `path`) | the **composed timeline** at 8.5 s, graded, all tracks |
1830
+ | `{path}` with an absolute path | the file is read in place without copying into `media/` |
1831
+ | `{path, text:true}` | text-only statistics (luma, colors, texture, saturation, motion) for non-vision agents |
1832
+
1833
+ Each answer leads with a text line naming the source, the timestamp(s) and (in
1834
+ timeline mode) the clips on screen, so you always know what you are looking at.
1835
+ `width` sets the pixel width (default 768 for one frame, 320 per contact-sheet
1836
+ cell); `text:true` returns descriptive statistics instead of an image block, for
1837
+ agents without vision capability — luma levels (min, p1, median, mean, p99, max,
1838
+ all 0–1 like `fablecut_scopes`), dominant colors, texture, saturation and
1839
+ per-cell motion; `where`/`timeout` apply to timeline mode only.
1840
+
1841
+ The REST endpoint `/api/frame` accepts `src`, `t`, `frames`, `from`, `to`, `w`,
1842
+ `q` (JPEG quality 1–31) and `text=1` (statistics mode) as query parameters.
1843
+
1844
+ **When it pays.** Before choosing a clip's `in` point, sample a few candidate
1845
+ moments — the blueprint tells you a shot spans 2.1 s–4.9 s and reads
1846
+ `energy: 88`, but only a frame tells you whether that is a car jump or a pan
1847
+ across a landscape. Contact sheets are the cheap survey: one call shows you
1848
+ what a whole 3-minute clip holds, then you grab single frames where it matters.
1849
+ Timeline mode answers "what did I actually build?" — the same picture the user
1850
+ sees and export renders, grades and transitions included.
1851
+
1852
+ Needs ffmpeg on PATH for the source modes. Timeline mode runs in the open editor
1853
+ tab, else a headless browser, like `fablecut_export`.
1854
+
1444
1855
  ## Remake a reference video (analyze → blueprint → rebuild)
1445
1856
 
1446
1857
  Given a reference edit (a reel/montage the user likes), FableCut can analyze it
@@ -1480,6 +1891,8 @@ obvious cuts were missed, raise it if motion is being misread as cuts.
1480
1891
  (hard cuts by default — that's what shot detection saw). Pick source footage
1481
1892
  whose motion matches each shot's `energy` (calm ≤40, action ≥70), and choose
1482
1893
  each clip's `in` so something interesting happens inside the window.
1894
+ **Then look**: `fablecut_frame {path, frames:12}` to survey a candidate clip,
1895
+ `{path, t}` at the exact moment you want, before committing to an `in`.
1483
1896
  4. The `drop`: put the hero shot there; classic garnish = a speed ramp landing
1484
1897
  on it, an impact `adjust` layer (shake+rgbSplit), or a whip transition.
1485
1898
  5. Pacing garnish to taste: shots shorter than ~0.6 s read as beat-flashes;
@@ -1492,9 +1905,44 @@ obvious cuts were missed, raise it if motion is being misread as cuts.
1492
1905
  - `PUT /api/project` — replace project JSON (body = full document).
1493
1906
  **Conflict-safe**: if the body's `revision` ≤ the revision currently on disk,
1494
1907
  the server rejects with **409** and returns `{"error":"…","revision":<current>}`.
1495
- Append `?force=1` to overwrite unconditionally. Writes are atomic (tmp file +
1908
+ Append `?force=1` to overwrite unconditionally. A request with an `X-FableCut-Project`
1909
+ header (the editor sends the id of the project it loaded) is also refused with 409 when
1910
+ another project is open (see "Projects"). Writes are atomic (tmp file +
1496
1911
  rename), so a crashed write never corrupts the file.
1497
1912
  - `GET /api/media` — list files in ./media (name, src, size)
1913
+ - `GET /api/media-info?src=/media/x.mp4` → `{src, info}` · `POST /api/media-info {srcs:[…], stat?}` →
1914
+ `{info:{src: info}}` (up to 2000; `stat:true` answers only `{size, mtimeMs}`, no ffprobe —
1915
+ how the editor checks for offline files) — a file's metadata from ffprobe: `size`, `fps`, `codec`,
1916
+ `audioCodec`, `audioChannels`, `sampleRate`, `bitrate`, `duration`, `width`, `height` and
1917
+ `probe` (`"ffprobe"`, or `"stat"` when only the size could be read). `info` is `null` when
1918
+ the src names no file under `/media/` or `/library/`. Cached per file version.
1919
+ - `POST /api/proxy {srcs:[…], height?:540|720|1080}` → `{status:{src: status}}` queues proxies
1920
+ (ffmpeg, one at a time); `POST /api/proxy/status {srcs}` → `{status:{src: status | null}}`;
1921
+ `POST /api/proxy/delete {srcs}` → `{deleted:{src: n}}`. A status is
1922
+ `{state:"ready", src:"/proxies/…", width, height, size}`, `{state:"queued"|"running", progress, height}`,
1923
+ `{state:"failed", error}` or `{state:"none"}` (`null` = no such source file). Progress and
1924
+ results are also pushed as SSE event `proxy` (`{src, status}`). `GET /proxies/<name>` serves
1925
+ a proxy file from `analysis/proxies/`. `/api/proxy` answers 503 without ffmpeg.
1926
+ - `POST /api/relink/candidates {media:[{id, name, src?, size?, kind?}]}` →
1927
+ `{candidates:{id:[{src, name, size, score, why}]}}` — where a missing file might be now:
1928
+ files under `media/` and `library/` (subfolders included) of the same kind, ranked by
1929
+ name (same name, same name with another extension, similar name) and size, best 5 each.
1930
+ - `GET /api/projects[?archived=only|all]` → `{active, projects:[{id, name, active, archived, notes, tags, created,
1931
+ opened, modified, width, height, fps, duration, clips, media, thumb}], templates:[…]}` ·
1932
+ `POST /api/projects {action, …}` — the actions of `fablecut_projects` (plus `import {project, name?}`).
1933
+ The answer depends on the action: `{id, project}` for open / new / duplicate / update / archive /
1934
+ unarchive / import (plus `from` when the open project changed, `already` when it was open), `{id, deleted}`
1935
+ for delete, `{templates}` for templates, `{template}` for save_template (the saved one) and
1936
+ `{template, deleted}` for delete_template · `GET` / `PUT /api/projects/thumb?id=`
1937
+ — a project's JPEG thumbnail (1 MB max). SSE event `projects` (`{action, id, active}`) after each
1938
+ change. See "Projects".
1939
+ - `GET /api/versions[?project=]` → `{project, versions:[{v, name, note, kind, created, revision, clips, duration,
1940
+ final}]}` (newest first; default the open project) · `POST /api/versions {action, project?, version?, …}` —
1941
+ `save {name?, note?, final?}` → `{project, version}` · `diff {version, to?}` → `{same, lines, added, removed,
1942
+ changed, mediaAdded, mediaRemoved, settings}` · `restore {version}` → `{restored, saved}` · `update {version,
1943
+ name?, note?, final?}` → `{version}` · `delete {version}` → `{deleted}`. `GET /api/versions/file?project=&version=`
1944
+ is that version's document; `GET /api/projects/backup?id=` a project with all its versions (import it with
1945
+ `POST /api/projects {action:"import", project:<the backup>}`). SSE event `versions` (`{project, action}`). See "Versions".
1498
1946
  - `GET /api/library?dir=sfx|elements|svg|fonts|presets|templates` — list library assets
1499
1947
  - `GET /api/presets` · `GET /api/templates` — the saved presets / templates, validated (bad files skipped);
1500
1948
  `POST /api/presets {preset}` · `POST /api/templates {template}` — validate one and save it as
@@ -1520,9 +1968,27 @@ obvious cuts were missed, raise it if motion is being misread as cuts.
1520
1968
  - `POST /api/analyze` — body `{src:"/media/ref.mp4", threshold?, music?}`: analyze a
1521
1969
  reference video into an edit blueprint (see "Remake a reference video"); extracts
1522
1970
  its music into ./media. `GET /api/analyze?src=…` returns the cached blueprint.
1971
+ - `GET /api/frame?src=/media/x.mp4&t=3.2` — one JPEG still of a source clip, the
1972
+ "eyes" to go with `/api/analyze`'s ears (see "Look at the footage"). Optional
1973
+ `w` (pixel width, default 768) and `q` (ffmpeg `-q:v` 1–31, default 4).
1974
+ `&frames=N[&cols=][&from=][&to=][&w=320]` instead returns one N-up **contact
1975
+ sheet** across the clip (N 2–60; `cols` omitted → the squarest layout, so 6
1976
+ frames give 3×2 rather than 4×2 with two black cells). `src` must name an
1977
+ existing file under `/media/` or `/library/` (404 otherwise). `?path=` reads
1978
+ any file on the machine but only with the `X-FableCut-Client: mcp` request
1979
+ header, which only the local MCP client sends — without it the request is
1980
+ refused (403) before the path is even resolved. Results are cached in
1981
+ `analysis/frames/` keyed by source path, size and mtime; the cache is capped
1982
+ (500 files / 128 MB, oldest first). The response carries
1983
+ `X-FableCut-Frame-Times` (comma-separated sample times, so a sheet's cells can
1984
+ be mapped back to timestamps) and `X-FableCut-Frame-Source`.
1985
+ - `POST /api/scopes/request` also takes `{"image":true}`, which makes the editor
1986
+ return the measured still as a JPEG data URL in `result.image` — how
1987
+ `fablecut_frame {time}` shows an agent the composed program picture.
1523
1988
  - `GET /api/events` — SSE: named event `change` when project.json, ./media or
1524
1989
  ./library changes; named event `profiles` when `encoding-profiles.json` changes
1525
- (UI refreshes the export-profile list only — no project reload)
1990
+ (UI refreshes the export-profile list only — no project reload); named event
1991
+ `proxy` as a proxy is queued, makes progress, finishes or is deleted
1526
1992
  - Fast / WebCodecs export (browser compositor → server ffmpeg):
1527
1993
  `GET /api/export/ffmpeg` → `{available}` · `GET /api/export/profiles[?detail=1]` →
1528
1994
  `{default, profiles, issues}` · `POST /api/export/begin`
@@ -1744,6 +2210,10 @@ Export is the Export button → dialog, or `fablecut_export` from an agent (belo
1744
2210
  ffmpeg, or WebCodecs is unavailable. Plays the timeline once and records it;
1745
2211
  keep the tab focused.
1746
2212
 
2213
+ Fast and WebCodecs export decode MP4 / MOV clips with WebCodecs
2214
+ (`mp4-demux.js` + `VideoDecoder`), frame-exact. Fragmented, rotated or
2215
+ undecodable files and `bgRemove` clips fall back to the `<video>` element.
2216
+
1747
2217
  The exported span is chosen in the Export dialog (**Range**: Entire
1748
2218
  timeline / IN–OUT). IN–OUT is the default when `inPoint` / `outPoint` are
1749
2219
  set; pick Entire timeline to keep those markers for split/trim. Effective
@@ -1765,12 +2235,135 @@ agent last wrote, so an export right after a patch includes that patch.
1765
2235
 
1766
2236
  - `fablecut_export {}` — waits, then returns the file path under `exports/`.
1767
2237
  Range: `inPoint`→`outPoint` when either is set, else the whole timeline;
1768
- `range:"entire"|"in-out"` overrides. `profile:"hq"` picks an encoding profile.
2238
+ `range:"entire"|"in-out"` overrides.
2239
+ - `preset:"instagram-reels"` picks a delivery preset; `delivery:{…}` changes any of its
2240
+ settings (`{preset:"youtube", delivery:{fps:60, video:{rate:"vbr", bitrate:16000}}}`).
2241
+ `profile:"hq"` picks a raw encoding profile instead. With neither, `project.delivery`
2242
+ is used when set, else `project.encodeProfile`, else the server's default profile.
2243
+ - `outputs:true` exports the project's checked batch outputs; `outputs:[{preset:"master"},
2244
+ {preset:"youtube"}, {preset:"instagram-reels"}, …]` exports a list. One render per
2245
+ frame rate; the reply lists every file (or why one failed).
1769
2246
  - `where:"headless"` renders in the background and leaves the user's tab alone;
1770
2247
  `where:"tab"` refuses if no tab is open.
1771
2248
  - Long edits: `wait:false` returns a job id at once; poll with `{job:"x_…"}`
1772
2249
  and stop one with `{cancel:"x_…"}`. One export runs at a time.
1773
2250
 
2251
+ ### Delivery presets
2252
+
2253
+ The Export dialog's **Preset** list. Each preset is a structured spec — no ffmpeg
2254
+ arguments to write — that `delivery.js` turns into one ffmpeg pass:
2255
+
2256
+ | Preset | Output |
2257
+ |---|---|
2258
+ | `youtube` | 1920×1080, H.264 CRF 18, keyframe every 0.5 s, AAC 384k 48 kHz |
2259
+ | `youtube-shorts` | 1080×1920, as YouTube; warns past 3 min |
2260
+ | `instagram-reels` | 1080×1920, H.264 CRF 19 capped at 25 Mb/s, AAC 256k; ≤ 60 fps, warns past 3 min |
2261
+ | `tiktok` | 1080×1920, H.264 CRF 19 capped at 20 Mb/s, AAC 256k; warns past 10 min |
2262
+ | `x` | 1920×1080, H.264 CRF 20 capped at 25 Mb/s, AAC 192k; warns past 2:20 and 512 MB |
2263
+ | `linkedin` | 1920×1080, H.264 CRF 20 capped at 20 Mb/s, AAC 192k; warns past 15 min and 5 GB |
2264
+ | `master` (default) | the picture's own size, H.264 CRF 16, AAC 320k |
2265
+ | `broadcast` | 1920×1080 ProRes 422 HQ MOV, PCM 24-bit 48 kHz, Rec. 709, normalized to −23 LUFS / −1 dBTP (EBU R128); warns off 25 / 29.97 / 50 / 59.94 fps |
2266
+ | `web` | 1280×720 H.264 CRF 23, AAC 128k, fast start |
2267
+ | `archive` | the picture's own size, lossless FFV1 4:2:2 10-bit MKV, PCM 24-bit |
2268
+ | `custom` | your own settings |
2269
+
2270
+ A spec (every key optional — what is left out comes from its `preset`):
2271
+
2272
+ ```jsonc
2273
+ {
2274
+ "preset": "youtube",
2275
+ "width": 1920, "height": 1080, // null = the picture's own size (the export frame, else the canvas)
2276
+ "fps": null, // null = the project's; 23.976 / 29.97 / 59.94 are exact NTSC rates
2277
+ "reframe": "fill", // another shape: fill crops the middle (or the export frame), fit pads, stretch
2278
+ "container": "mp4", // mp4 · mov · mkv · webm · mxf
2279
+ "video": {
2280
+ "codec": "h264", // h264 · hevc · av1 · vp9 · prores · dnxhr · mpeg2 (XDCAM HD422) · ffv1
2281
+ "encoder": "libx264", // or h264_nvenc / h264_qsv / h264_amf … — listed only when they work here
2282
+ "rate": "crf", // crf · vbr · cbr (ProRes, DNxHR, XDCAM, FFV1 are fixed)
2283
+ "crf": 18, "bitrate": 12000, "maxrate": null, // kb/s; maxrate caps a CRF or VBR encode
2284
+ "keyint": 2, // seconds between keyframes, 0 = the encoder's default
2285
+ "speed": "balanced", // fast · balanced · best
2286
+ "pixFmt": "yuv420p", // 4:2:0 / 4:2:2 / 4:4:4, 8 or 10 bit, as the codec allows
2287
+ "profile": null // ProRes: proxy lt standard hq 4444 4444xq · DNxHR: lb sq hq hqx 444
2288
+ },
2289
+ "audio": { "codec": "aac", "bitrate": 320, "sampleRate": 48000, "channels": 2,
2290
+ "loudness": null, "truePeak": -1 },
2291
+ // aac · opus · mp3 · pcm16 · pcm24 · flac · none
2292
+ // loudness: a LUFS target (−14 streaming, −16 podcast, −23 EBU R128, −24 ATSC) or null
2293
+ "color": "bt709", // bt709 · bt709-full · bt601-625 (PAL) · bt601-525 (NTSC)
2294
+ "filename": "{project}_{preset}_{res}",
2295
+ // tokens: {project} {preset} {res} (1080p, 1080x1920, 1080sq) {w} {h} {fps} {codec} {date} {time} {range} {n}
2296
+ "metadata": { "title": "", "artist": "", "description": "", "copyright": "", "date": "", "keywords": "" }
2297
+ }
2298
+ ```
2299
+
2300
+ - **Impossible combinations are corrected, and the reply says how** — ProRes moves to MOV,
2301
+ WebM takes Opus, Quick Sync gets 4:2:0. The dialog shows the same notes.
2302
+ - **Reframing happens in ffmpeg**: the browser sends the whole canvas and ffmpeg crops
2303
+ the export frame (or the middle, for another shape) and scales. The dialog warns
2304
+ when the output is upscaled or cropped, when a platform's length, size or frame-rate
2305
+ limit is passed, and estimates the file size where it can (bitrate and fixed-rate
2306
+ codecs; CRF cannot know).
2307
+ - Outputs that keep more than 4:2:0 8-bit (ProRes, DNxHR, FFV1, 10-bit, 4:2:2, 4:4:4)
2308
+ get raw RGBA frames instead of JPEG, so no chroma is lost on the way. Slower to send.
2309
+ - The audio is cut to exactly the frames' length.
2310
+ - **Loudness** (`audio.loudness`): the mix is measured and turned to the target with
2311
+ ffmpeg's two-pass `loudnorm` — one linear gain, and a true-peak limiter at `truePeak`.
2312
+ When the peaks leave no room for the gain it compresses instead and may land under the
2313
+ target; the check after the export says so. Off (null) leaves the mix as mixed —
2314
+ except Broadcast, which normalizes to −23 LUFS / −1 dBTP. Mixes shorter than 3 s may
2315
+ not reach the target.
2316
+ - **Checked after the export.** Every file is read back with ffprobe and measured
2317
+ (BS.1770 integrated loudness and true peak) and compared with what was asked:
2318
+ size, frame rate, frame count, codec, color tags, audio codec / rate / channels,
2319
+ length, loudness against the target (±1 LU) and the true-peak ceiling, and file size
2320
+ against the platform's limit. Without a target the report says where the platform
2321
+ plays it ("YouTube plays it 4.2 dB quieter"). The report shows in the queue, a toast
2322
+ after a single export, and the `fablecut_export` reply.
2323
+ - **Saved presets**: "Save preset…" in the dialog writes `library/delivery/<id>.json`,
2324
+ listed under "Saved" in every project (`GET / POST /api/export/presets`,
2325
+ `POST /api/export/presets/delete {id}`).
2326
+ - The settings are checked by a 0.1 s ffmpeg dry run before anything renders.
2327
+ - The dialog remembers the last settings in this browser. `setProject {delivery:"youtube"}`
2328
+ (or a spec) pins them in the project, for the dialog and for `fablecut_export`.
2329
+ - Fast export only — WebCodecs and Realtime export encode their own way.
2330
+
2331
+ ### Batch outputs and the export queue
2332
+
2333
+ **One project → many files.** `project.outputs` is the project's list of files to make
2334
+ (up to 16), each a delivery spec plus `{id, on}`. In the Export dialog, **Batch outputs**
2335
+ lists them: **+ Add these settings** adds the preset shown above, **+ Typical set** adds
2336
+ Master, YouTube 1080p, Reel 1080×1920, Square 1080 and a 720p preview, the checkbox picks
2337
+ which go out, **Load** shows one's settings above. **Export checked** queues the checked
2338
+ ones and starts.
2339
+
2340
+ ```jsonc
2341
+ // setProject {outputs:[…]} — a preset id or a spec each; stored complete with an id
2342
+ {"op":"setProject","set":{"outputs":[
2343
+ "master", "youtube",
2344
+ {"preset":"instagram-reels"},
2345
+ {"preset":"custom","width":1080,"height":1080,"filename":"{project}_square_{res}"},
2346
+ {"preset":"web","filename":"{project}_preview_{res}","on":false}
2347
+ ]}}
2348
+ ```
2349
+
2350
+ - **Rendered once.** Outputs with the same frame rate and range go out in ONE render:
2351
+ the compositor draws each frame once and every output's ffmpeg encodes it (up to 8 per
2352
+ render). Four 1080p files take about as long as one. Outputs at another frame rate get
2353
+ their own render. When any output needs full chroma (ProRes, 10-bit, lossless) the
2354
+ frames go as RGBA to all of them.
2355
+ - **The export frame** is the picture for outputs of its own shape (and for the
2356
+ picture's own size). An output of another shape reframes the whole canvas — a project
2357
+ framed for 9:16 still makes a proper 16:9 file.
2358
+ - **The export queue** (Export dialog → **Add to queue**, or **Queue**) runs waiting
2359
+ outputs back to back with a progress bar each, **Stop**, **Retry** for a failed one,
2360
+ **Open** for a finished file and **Clear finished**. It lives in the tab: a reload
2361
+ empties it. One output that fails does not stop the others in its render.
2362
+ - REST: `POST /api/export/begin {deliveries:[{delivery, name}, …], canvasW, canvasH,
2363
+ region?, duration, fps, hasAudio}` → `{id, input, jpegQuality, outputs:[{file, spec,
2364
+ summary, notes, size}]}`; frames and audio as for one output; `/api/export/end` →
2365
+ `{src, outputs:[{file, ok, src, report:{ok, checks:[{ok, text}], line}, mixLoudness?} | {file, ok:false, error}]}`.
2366
+
1774
2367
  ### Encoding profiles (`encoding-profiles.json`)
1775
2368
 
1776
2369
  User-editable at the repo root. A profile is a **raw ffmpeg argument list** plus the
@@ -1808,7 +2401,8 @@ ffmpeg -y -f image2pipe -framerate <fps> -i - [-i audio.wav] <jpeg-color> <args
1808
2401
 
1809
2402
  - **There is no allow-list.** Any codec, filter, container or flag your local ffmpeg
1810
2403
  supports works — ProRes, DNxHD, NVENC/QSV/VideoToolbox, VP9/AV1, 10-bit, HDR tags.
1811
- See the shipped `prores422` and `broadcast1080i50` profiles.
2404
+ See the shipped `prores422`, `broadcast1080i50`, `nvenc-h264` and `nvenc-hevc`
2405
+ profiles (the NVENC ones need an NVIDIA GPU and an ffmpeg built with NVENC).
1812
2406
  - **Args are validated by ffmpeg itself**, not by a schema: when an export starts the
1813
2407
  server dry-runs the profile against a 0.1 s synthetic input (`lavfi`). A typo or an
1814
2408
  encoder your build lacks is rejected up front with ffmpeg's own message, instead of
@@ -1834,11 +2428,12 @@ ffmpeg -y -f image2pipe -framerate <fps> -i - [-i audio.wav] <jpeg-color> <args
1834
2428
  not `-i source.mp4`. Filters and codec settings apply to that frame stream. To transcode
1835
2429
  an existing file verbatim, run ffmpeg directly — that is outside the compositor path.
1836
2430
 
1837
- **Which profile is used (priority):**
1838
- 1. Profile picked in the Export dialog (one-off; saved to browser settings unless overridden)
1839
- 2. `project.encodeProfile` — set via UI reload or `{op:"setProject", set:{encodeProfile:"hq"}}`
1840
- 3. Browser setting `encodeProfile` in localStorage (set when you change the Export dropdown)
1841
- 4. `default` in `encoding-profiles.json`
2431
+ Encoding profiles are listed at the bottom of the Export dialog's Preset list.
2432
+
2433
+ **What the Export dialog opens on (priority):**
2434
+ 1. `project.delivery`, then `project.encodeProfile` — set with `setProject`
2435
+ 2. The last preset or profile used in this browser
2436
+ 3. The `master` delivery preset
1842
2437
 
1843
2438
  **MCP:** `fablecut_encode_profiles` lists profiles; `{detail:true}` includes each `args`
1844
2439
  array; `{profile:"hq"}` returns one profile. `fablecut_status` shows the effective profile.