From 01d53cc0cf7a2388d79fee76fb4afb030b4c6fb5 Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 13:52:53 +0530 Subject: [PATCH 1/9] Music: search openly licensed music and sound effects (Openverse) with licence labels The bin's Music tab and the fablecut_music tool search Openverse by mood, genre or instrument; every result shows its licence and what it allows. Importing keeps the licence on the media entry; Media info copies the credit, and the Export dialog and fablecut_export list the edit's music credits. --- CHANGELOG.md | 12 ++ CLAUDE.md | 84 ++++++++- README.md | 1 + app.js | 229 ++++++++++++++++++++++++- docs/demo/app.js | 229 ++++++++++++++++++++++++- docs/demo/index.html | 3 + docs/demo/music.js | 195 +++++++++++++++++++++ docs/demo/style.css | 31 ++++ docs/demo/sync.js | 2 +- docs/docs/audio/index.html | 6 +- docs/docs/build.js | 5 + docs/docs/captions/index.html | 4 +- docs/docs/color/index.html | 4 +- docs/docs/compositing/index.html | 4 +- docs/docs/compositions/index.html | 4 +- docs/docs/editing/index.html | 4 +- docs/docs/export/index.html | 4 +- docs/docs/frames/index.html | 4 +- docs/docs/index.html | 6 +- docs/docs/library/index.html | 4 +- docs/docs/masks/index.html | 4 +- docs/docs/mcp/index.html | 4 +- docs/docs/media/index.html | 4 +- docs/docs/motion-paths/index.html | 4 +- docs/docs/motion/index.html | 4 +- docs/docs/music/index.html | 120 +++++++++++++ docs/docs/presets-templates/index.html | 4 +- docs/docs/project-json/index.html | 4 +- docs/docs/projects/index.html | 4 +- docs/docs/props/index.html | 4 +- docs/docs/recipes/index.html | 4 +- docs/docs/remake/index.html | 4 +- docs/docs/rest-api/index.html | 6 +- docs/docs/sequences/index.html | 4 +- docs/docs/studio/index.html | 2 +- docs/docs/tracking/index.html | 4 +- docs/docs/transcripts/index.html | 6 +- docs/docs/versions/index.html | 4 +- docs/docs/workflows/index.html | 4 +- docs/index.html | 1 + docs/llms.txt | 4 + docs/sitemap.xml | 6 + import-url.js | 11 +- index.html | 3 + manifest.json | 1 + mcp-server.js | 118 +++++++++++-- music.js | 195 +++++++++++++++++++++ project-ops.js | 1 + server.js | 4 +- style.css | 31 ++++ test/music.test.js | 176 +++++++++++++++++++ 51 files changed, 1495 insertions(+), 85 deletions(-) create mode 100644 docs/demo/music.js create mode 100644 docs/docs/music/index.html create mode 100644 music.js create mode 100644 test/music.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 22761d07a..e91cd86da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- **Music.** The bin's new **Music** tab searches openly licensed music and + sound effects from Openverse (Jamendo, Freesound, ccMixter, Wikimedia Commons + and more), by mood, genre or instrument, with a length filter and **OK to + monetize**. Every result shows its licence and what it allows: free to use, + credit the artist, non-commercial, share alike, or no edits. Preview a track, + import it, or add it at the playhead. An imported track keeps its licence, its + **Media info** has **Copy credit**, and the Export dialog lists the edit's + music credits for the video's description. Agents use the new + `fablecut_music` tool to search, import a track and list the credits, and + `fablecut_export` adds the credits to its reply. + ### Fixed - **Frames and exports from a background tab.** When the editor tab was in the background, every seek waited about 3 s for a frame the browser never shows diff --git a/CLAUDE.md b/CLAUDE.md index df2f226aa..848bcee3f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -54,6 +54,9 @@ Every Claude Code session then has these tools: on that canvas whose shots follow the subject. See "Sequences" below. - `fablecut_highlights` — the best moments of long footage cut into a short edit, in a new sequence. See "Sequences" below. +- `fablecut_music` — find openly licensed music and sound effects (Openverse), each with + its licence, import one into the project, and list the credits the edit needs. See + "Music" below. - `fablecut_transcribe` — turn speech into words with times (Whisper, in the browser), read them on the timeline, find a phrase and cut it out. See "Transcripts and text-based editing" below. @@ -695,6 +698,84 @@ edits the key under the playhead. Agents: balance whole lanes (dialogue against the music bed), and a **bus** when several lanes need the same processing or one fader. +### Music + +The bin's **Music** tab and `fablecut_music` find music and sound effects that +may be used in a video: openly licensed tracks from **Openverse** +(openverse.org), which indexes Jamendo, Freesound, ccMixter, Wikimedia Commons +and more. Results show every licence, not only the free ones, and each result +says what its licence allows. FableCut is made with Openverse but isn't endorsed +or certified by it. The licence is the artist's, and Openverse doesn't check it, +so the person publishing the video is the one who must respect it. + +| licence | label | may it go in a video? | +|---|---|---| +| `cc0` · `pdm` | free to use | yes, any use; no credit needed | +| `by` | credit | yes, any use; credit the artist | +| `by-sa` | credit · share alike | yes; credit, and the video is shared under CC BY-SA too | +| `by-nc` · `by-nc-sa` | credit · non-commercial | not in ads, sponsored or monetized videos; credit (NC-SA: share alike too) | +| `by-nd` · `by-nc-nd` | no edits | **no**: Creative Commons counts music set to video as a derivative | +| `sampling+` · `nc-sampling+` | credit · non-commercial | parts may be sampled and remixed; the whole track only non-commercially | + +Search with words about the music (mood, genre, instrument: "chill lo-fi +piano"); leave the words out to see the newest tracks. Music comes from the +`music` category, sound effects from Freesound. Lengths are Openverse's: under +30 s, 30 s – 2 min, 2 – 10 min, over 10 min. Without an account Openverse +answers 20 results a page, 240 per search and about 20 searches a minute and 200 +a day per address. The search runs from the editor tab (or the MCP server) +straight to Openverse, and the file goes through the editor server's URL import +into `media/`. + +**An imported track keeps its licence** on its media entry, so the credits can +be listed later: + +```jsonc +{ "id": "m_x", "name": "Cinematic — Jahzzar", "kind": "audio", "src": "/media/Cinematic%20-%20Jahzzar.mp3", + "license": { "code": "by-sa", "label": "CC BY-SA 3.0", "url": "https://creativecommons.org/licenses/by-sa/3.0/", + "title": "Cinematic", "creator": "Jahzzar", "page": "https://www.jamendo.com/track/918921", + "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } } +``` + +The **credits** are every licensed file the edit uses (main timeline, comps +and other sequences; a denoised copy counts as its original), one line each: +`"Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921`, +with a warning for a licence that limits the video (non-commercial, share +alike, no derivatives). They go in the video's description. + +In the editor: the bin's **Music** tab has the search box, **Music / Sound +effects**, a length, **OK to monetize** (only licences that allow commercial +use and edits), and mood chips to start from. Each result shows its artist, +length, genres, source, a licence badge (green: free to use, blue: credit, +amber: non-commercial, red: no edits; hover for what it allows, click for the +licence) and a link to its page. **▶** previews it, **⬇** imports it into the +Project bin, **+** (or a double-click) imports it and adds it at the playhead. +**More results** loads the next page. A file's **Media info** shows its licence +and credit with **Copy credit**, and the **Export** dialog lists the edit's +music credits with **Copy**. Importing needs the editor server (or Studio). + +**Agents** use `fablecut_music`: + +- `{query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?}` + searches: 20 tracks a page, each `id "title" — artist · m:ss · licence [flags] · genres · source`. + `commercial:true` keeps licences that allow commercial use, `edits:true` leaves out + ND; pass both when the video will be monetized. +- `{import:""}` downloads it into `media/` (named "Title - Artist") and + registers it with its `license`; the reply gives the licence, the credit and + an `addClip` to place it. Then `fablecut_beats {clipId}` finds its tempo, + `retime` cuts to it, and `fablecut_auto_duck` dips it under speech. +- `{credits:true}` lists the edit's credits and licence warnings. `fablecut_export` + adds them to its reply when the edit uses licensed music. +- Say which licence a track has before the user publishes, and search with + `commercial:true, edits:true` when they plan to monetize. Import what the user + picked, or the best fit when they asked you to choose. The compact view shows + an imported file's `licence:"CC BY 3.0"`. + +Recipes: **music under a reel** — search the mood with `length:"short"`, +import one, place it on A1, `fablecut_beats {clipId, retime:{every:2}}`; +**a whoosh on every cut** — `kind:"sfx", query:"whoosh"`, import a CC0 one, +place it just before each cut; **music for a sponsored video** — +`commercial:true, edits:true`, and give the user the credits from the reply. + ### Transcripts and text-based editing FableCut turns the speech in a clip into **words with times**, so an edit can be @@ -2321,8 +2402,9 @@ obvious cuts were missed, raise it if motion is being misread as cuts. MP4/MOV/M4V uploads are auto-remuxed with `+faststart` (needs ffmpeg on PATH). Files copied straight into ./media by external tools skip this — remux big ones yourself (`ffmpeg -i in.mp4 -c copy -movflags +faststart out.mp4`) or playback stalls. -- `POST /api/import-url` — body `{url:"https://…"}` downloads the file into +- `POST /api/import-url` — body `{url:"https://…", name?}` downloads the file into `./media/` and returns `{src,name}` (same-origin `/media/…`, like upload). + `name` is the file name to save as (its extension follows the download). HTTPS only; rejects localhost, private/link-local/CGNAT addresses, and redirects to those. Remote SVG is refused (`/media/*.svg` is served same-origin as `image/svg+xml` — a scripted SVG opened as a document would diff --git a/README.md b/README.md index 0598f1fad..c538d3b3c 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,7 @@ big operation (cutting silences, snapping to the beat, reframing), and every - **Projects** — a dashboard of every project with pictures, notes and tags: open, create from a canvas or a saved project template, duplicate, rename, archive and delete, import an old project file; media is shared, so copies cost no footage - **Sequences** — several timelines in one project (a 16:9 and a 9:16 cut, cut-downs, alternatives) sharing its media and compositions, each with its own canvas, frame rate, mix and delivery settings; switch from the menu at the left of the timeline toolbar - **Versions** — non-destructive history: save a version (Ctrl/Cmd+S), automatic versions every 10 minutes and before an agent edits, compare a version with now, restore (the current state is kept as a version first), mark the final cut; backups carry every version, and an unreadable `project.json` is recovered at startup +- **Music** — the bin's **Music** tab searches openly licensed music and sound effects from Openverse (Jamendo, Freesound, ccMixter…), every result labelled with what its licence allows (free to use, credit, non-commercial, share alike, no edits); preview, import or add at the playhead, and the Export dialog lists the credits for the video's description (`fablecut_music`) - **Workflows** — save a routine you want repeated (a podcast clean-up, the weekly reel) as plain-language steps plus the tool calls that did them, in `library/workflows/`; an agent lists them and follows one on the next project, fitting each step to the new footage (`fablecut_workflows`) - **Proxies** — light, frame-accurate H.264 copies of 4K / HEVC / ProRes footage made in the background (ffmpeg); edit on the proxy with the monitor's **Proxy** button, export always renders the originals - **Import from URL** — **+ URL** downloads an HTTPS video/audio/image into diff --git a/app.js b/app.js index 62d11f632..7aea26f95 100644 --- a/app.js +++ b/app.js @@ -1673,6 +1673,8 @@ function projectJSONHere() { if (m.favorite === true) mo.favorite = true; if (m.tags && m.tags.length) mo.tags = m.tags.slice(); if (derivedFrom) { mo.derivedFrom = derivedFrom; if (denoise) mo.denoise = denoise; } + const lic = FableCutMusic.cleanLicense(m.license); + if (lic) mo.license = lic; return mo; }), clips: clips.map(serializeClip), @@ -1757,7 +1759,7 @@ async function syncFromServer(force) { if (state.gesture || state.exporting) { runtime.pendingSync = true; return false; } runtime.pendingSync = false; if (state.binTab === "templates") fetchSaved("templates").then(() => { if (state.binTab === "templates") renderTemplatesTab(); }); - else if (state.binTab !== "project" && state.binTab !== "shapes") fetchLibrary(state.binTab).then(renderLibrary); + else if (state.binTab !== "project" && state.binTab !== "shapes" && state.binTab !== "music") fetchLibrary(state.binTab).then(renderLibrary); fetchSaved("presets"); loadLibraryFonts(); fetchEncodeProfiles(); @@ -2622,12 +2624,16 @@ function showMediaInfo(m, x, y) { })()], ["Folder", folder ? folder.name : ""], ["Tags", (m.tags || []).map((t) => "#" + t).join(" ")], ["Collections", cols.join(", ")], ["Favorite", m.favorite ? "★ yes" : ""], + ["Licence", m.license ? `${m.license.label} — ${FableCutMusic.licence(m.license.code).note}` : ""], + ["Credit", m.license ? FableCutMusic.creditLine(m.license) : ""], ].filter(([, v]) => v); const pop = document.createElement("div"); pop.className = "ctx-menu bin-pop bin-info"; pop.innerHTML = `
${rows.map(([k, v]) => ``).join("")}
${escapeHtml(k)}${escapeHtml(v)}
` + + (m.license ? `` : "") + (m.size == null && state.connected ? `
Reading the file's details…
` : ""); pop.querySelector(".bin-pop-title").textContent = m.name; + pop.querySelector(".bin-copy-credit")?.addEventListener("click", () => copyCredits([FableCutMusic.creditLine(m.license)])); showPopover(pop, x, y); if (m.size == null) refreshMediaInfo([m]); } @@ -3233,6 +3239,7 @@ function renderLibrary() { } } function setBinTab(tab) { + if (tab !== "music") musicPreviewStop(); state.binTab = tab; for (const b of els.binTabs.querySelectorAll("[data-tab]")) b.classList.toggle("on", b.dataset.tab === tab); @@ -3241,10 +3248,229 @@ function setBinTab(tab) { els.libList.classList.toggle("hidden", isProj); if (els.binTools) els.binTools.classList.toggle("hidden", !isProj); if (tab === "shapes") renderShapesTab(); + else if (tab === "music") renderMusicTab(); else if (tab === "templates") { renderTemplatesTab(); fetchSaved("templates").then(() => { if (state.binTab === "templates") renderTemplatesTab(); }); } else if (!isProj) fetchLibrary(tab).then(renderLibrary); } +/* ═══════════════════════════ MUSIC (Openverse) ═══════════════════════════ */ +/* The bin's Music tab: openly licensed music and sound effects from Openverse + (music.js builds the search and reads the licences). The browser asks + Openverse directly; importing downloads the file through /api/import-url, + and the media entry keeps the track's licence (m.license) for the credits. */ +const music = { query: "", kind: "music", length: "", commercial: false, tracks: [], page: 0, pages: 0, count: 0, + busy: false, error: "", seq: 0, preview: null, importing: new Set() }; +function musicPreviewStop() { + if (music.preview) { music.preview.audio.pause(); music.preview = null; } +} +async function musicSearch(more) { + const seq = ++music.seq; + const page = more ? music.page + 1 : 1; + music.busy = true; music.error = ""; + if (!more) { music.tracks = []; music.page = 0; musicPreviewStop(); } + renderMusicTab(); + try { + const res = await fetch(FableCutMusic.searchUrl({ query: music.query, kind: music.kind, length: music.length, commercial: music.commercial, edits: music.commercial, page }), + { headers: { Accept: "application/json" } }); + const body = await res.json().catch(() => null); + if (seq !== music.seq) return; + if (res.status === 429) throw new Error("Openverse's limit for searches is used up for now — try again in a while"); + if (!res.ok) throw new Error("Openverse answered " + res.status + (body && body.detail ? ": " + body.detail : "")); + const r = FableCutMusic.results(body, page); + music.tracks = more ? music.tracks.concat(r.tracks) : r.tracks; + music.page = page; music.pages = r.pages; music.count = r.count; + } catch (e) { + if (seq !== music.seq) return; + music.error = e instanceof TypeError ? "Couldn't reach Openverse — are you online?" : e.message; + } + music.busy = false; + if (state.binTab === "music") renderMusicTab(); +} +function musicTogglePreview(t, btn) { + if (music.preview && music.preview.id === t.id) { + musicPreviewStop(); btn.textContent = "▶"; return; + } + musicPreviewStop(); + els.libList.querySelectorAll(".music-play").forEach((b) => (b.textContent = "▶")); + const a = new Audio(t.url); + a.onended = () => { if (music.preview && music.preview.audio === a) { music.preview = null; btn.textContent = "▶"; } }; + a.play().catch(() => { toast("Couldn't play " + t.title); btn.textContent = "▶"; }); + btn.textContent = "⏸"; + music.preview = { id: t.id, audio: a }; +} +/** Download a track into media/ and register it with its licence; place = add at the playhead too. */ +async function musicImport(t, place) { + if (!state.connected) { toast("Importing music needs the editor server"); return; } + if (music.importing.has(t.id)) return; + const have = project.media.find((m) => m.license && m.license.openverse === t.id); + if (have) { + if (place) addClipFromMedia(have, null, state.time); + else toast(`“${have.name}” is already in the project`); + return; + } + music.importing.add(t.id); + renderMusicTab(); + const gen = runtime.projectGen; + try { + const res = await fetch("/api/import-url", { + method: "POST", headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ url: t.url, name: FableCutMusic.fileName(t) }), + }); + const body = await res.json().catch(() => ({})); + if (!res.ok) throw new Error(body.error || "import failed (" + res.status + ")"); + const kind = libKind(body.name); + if (kind !== "audio" && kind !== "video") throw new Error("the track's file isn't audio: " + (body.name || "")); + const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind, src: body.src, folderId: null, + license: FableCutMusic.mediaLicense(t) }; + try { await loadMediaMetadata(m); ensureWave(m); } catch { /* probeMissingMeta retries */ } + if (gen !== runtime.projectGen) throw new Error("another project was opened — the file is in media/"); + project.media.push(m); + renderBin(); scheduleSave(); + if (place) addClipFromMedia(m, null, state.time); + toast(`Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`); + } catch (e) { + toast(e && e.message ? e.message : "Couldn't import the track"); + } finally { + music.importing.delete(t.id); + if (state.binTab === "music") renderMusicTab(); + } +} +function copyCredits(lines) { + navigator.clipboard.writeText(lines.join("\n")).then(() => toast(lines.length === 1 ? "Copied the credit" : `Copied ${lines.length} credits`), () => toast("Couldn't copy — the browser refused")); +} +/** The Export dialog's note: the licensed music the edit uses, its credits and any licence warnings. */ +function syncExportCredits() { + const box = $("exportCredits"); + if (!box) return; + const list = FableCutMusic.credits(usageDoc(), MediaLib.usageCounts(usageDoc())); + box.classList.toggle("hidden", !list.length); + box.innerHTML = ""; + if (!list.length) return; + const head = document.createElement("div"); + head.className = "export-credits-head"; + head.innerHTML = `Music credits — put these in the video's description `; + head.querySelector("button").addEventListener("click", () => copyCredits(list.map((c) => c.line))); + box.appendChild(head); + for (const c of list) { + const p = document.createElement("div"); + p.className = "export-credit"; + p.textContent = c.line + (c.needsCredit ? "" : " (no credit required)"); + box.appendChild(p); + for (const w of c.warnings) { + const q = document.createElement("div"); + q.className = "export-credit warn"; + q.textContent = "⚠ " + w; + box.appendChild(q); + } + } +} +function renderMusicTab() { + if (state.binTab !== "music") return; + const list = els.libList; + const focused = document.activeElement && document.activeElement.id === "musicQuery"; + list.innerHTML = ""; + const form = document.createElement("form"); + form.className = "music-search"; + form.innerHTML = ` + +
+ + + +
`; + const q = form.querySelector("#musicQuery"); + q.value = music.query; + form.querySelector("#musicKind").value = music.kind; + form.querySelector("#musicLength").value = music.length; + form.querySelector("#musicCommercial").checked = music.commercial; + form.addEventListener("submit", (e) => { e.preventDefault(); music.query = q.value.trim(); musicSearch(false); }); + form.addEventListener("change", (e) => { + if (e.target.id === "musicKind") music.kind = e.target.value; + else if (e.target.id === "musicLength") music.length = e.target.value; + else if (e.target.id === "musicCommercial") music.commercial = e.target.checked; + else return; + music.query = q.value.trim(); + musicSearch(false); + }); + list.appendChild(form); + if (focused) { q.focus(); q.setSelectionRange(q.value.length, q.value.length); } + + if (!music.tracks.length && !music.busy) { + const moods = document.createElement("div"); + moods.className = "music-moods"; + for (const w of FableCutMusic.MOODS) { + const b = document.createElement("button"); + b.type = "button"; b.className = "bin-tag chip"; b.textContent = w; + b.addEventListener("click", () => { music.query = w; musicSearch(false); }); + moods.appendChild(b); + } + list.appendChild(moods); + } + const status = (text, cls) => { + const p = document.createElement("div"); + p.className = "music-status" + (cls ? " " + cls : ""); + p.textContent = text; + list.appendChild(p); + }; + if (music.error) status(music.error, "err"); + else if (!music.busy && music.page && !music.tracks.length) status("Nothing found — try other words or another length."); + else if (music.page) status(`${music.count >= 240 ? "240+" : music.count} result${music.count === 1 ? "" : "s"}${music.query ? ` for “${music.query}”` : " — newest first"}`); + else if (!music.busy) status("Search openly licensed music, or pick a mood. Every track shows its licence."); + + for (const t of music.tracks) { + const item = document.createElement("div"); + item.className = "bin-item lib-item music-item"; + const busy = music.importing.has(t.id); + item.innerHTML = ` + +
+
+
+
+
+ + `; + item.querySelector(".bin-name").textContent = t.title; + item.querySelector(".bin-name").title = t.title + (t.tags.length ? "\n#" + t.tags.join(" #") : ""); + item.querySelector(".bin-sub").textContent = [t.creator, t.duration != null ? FableCutMusic.fmtLen(t.duration) : "", t.genres.join("/"), t.source].filter(Boolean).join(" · "); + const lic = item.querySelector(".music-lic"); + const badge = document.createElement(t.license.url ? "a" : "span"); + badge.className = "music-badge" + (!t.license.edits ? " no" : !t.license.commercial ? " nc" : !t.license.credit ? " free" : ""); + badge.textContent = t.license.label; + badge.title = t.license.note; + if (t.license.url) { badge.href = t.license.url; badge.target = "_blank"; badge.rel = "noopener"; } + lic.appendChild(badge); + const fl = document.createElement("span"); + fl.className = "music-flags"; + fl.textContent = t.flags.join(" · "); + fl.title = t.license.note; + lic.appendChild(fl); + if (t.page) { + const a = document.createElement("a"); + a.className = "music-page"; a.href = t.page; a.target = "_blank"; a.rel = "noopener"; a.textContent = "page ↗"; + a.title = "The track's page at " + (t.source || "its source"); + lic.appendChild(a); + } + const play = item.querySelector(".music-play"); + play.addEventListener("click", () => musicTogglePreview(t, play)); + item.querySelector(".music-get").addEventListener("click", () => musicImport(t, false)); + item.querySelector(".lib-add").addEventListener("click", () => musicImport(t, true)); + item.addEventListener("dblclick", (e) => { if (!e.target.closest("button, a")) musicImport(t, true); }); + list.appendChild(item); + } + if (music.busy) status("Searching…"); + else if (music.page && music.page < music.pages) { + const more = document.createElement("button"); + more.type = "button"; more.className = "btn tiny music-more"; more.textContent = "More results"; + more.addEventListener("click", () => musicSearch(true)); + list.appendChild(more); + } + const about = document.createElement("p"); + about.className = "music-about"; + about.innerHTML = `Made with Openverse, not endorsed or certified by it. Licences are the artists' — check one before you publish, and credit where it says so (the Export dialog lists the credits).`; + list.appendChild(about); +} + /* ═══════════════════════════ PROJECTS (dashboard) ═══════════════════════════ */ /* Several projects in one data folder (projects.js on the server). The open one is always ./project.json, so everything else in the editor is unchanged; the @@ -16683,6 +16909,7 @@ async function openExportSetup() { `${offUsed.length === 1 ? `“${offUsed[0].name}” is` : offUsed.length + " files are"} offline and will export as “Media offline” — relink first (right-click in the bin → Relink…).`; warn.classList.remove("hidden"); } + syncExportCredits(); fillExportRangeSelect(); syncExportRangeUi(); syncExportProfileVisibility(); diff --git a/docs/demo/app.js b/docs/demo/app.js index 62d11f632..7aea26f95 100644 --- a/docs/demo/app.js +++ b/docs/demo/app.js @@ -1673,6 +1673,8 @@ function projectJSONHere() { if (m.favorite === true) mo.favorite = true; if (m.tags && m.tags.length) mo.tags = m.tags.slice(); if (derivedFrom) { mo.derivedFrom = derivedFrom; if (denoise) mo.denoise = denoise; } + const lic = FableCutMusic.cleanLicense(m.license); + if (lic) mo.license = lic; return mo; }), clips: clips.map(serializeClip), @@ -1757,7 +1759,7 @@ async function syncFromServer(force) { if (state.gesture || state.exporting) { runtime.pendingSync = true; return false; } runtime.pendingSync = false; if (state.binTab === "templates") fetchSaved("templates").then(() => { if (state.binTab === "templates") renderTemplatesTab(); }); - else if (state.binTab !== "project" && state.binTab !== "shapes") fetchLibrary(state.binTab).then(renderLibrary); + else if (state.binTab !== "project" && state.binTab !== "shapes" && state.binTab !== "music") fetchLibrary(state.binTab).then(renderLibrary); fetchSaved("presets"); loadLibraryFonts(); fetchEncodeProfiles(); @@ -2622,12 +2624,16 @@ function showMediaInfo(m, x, y) { })()], ["Folder", folder ? folder.name : ""], ["Tags", (m.tags || []).map((t) => "#" + t).join(" ")], ["Collections", cols.join(", ")], ["Favorite", m.favorite ? "★ yes" : ""], + ["Licence", m.license ? `${m.license.label} — ${FableCutMusic.licence(m.license.code).note}` : ""], + ["Credit", m.license ? FableCutMusic.creditLine(m.license) : ""], ].filter(([, v]) => v); const pop = document.createElement("div"); pop.className = "ctx-menu bin-pop bin-info"; pop.innerHTML = `
${rows.map(([k, v]) => ``).join("")}
${escapeHtml(k)}${escapeHtml(v)}
` + + (m.license ? `` : "") + (m.size == null && state.connected ? `
Reading the file's details…
` : ""); pop.querySelector(".bin-pop-title").textContent = m.name; + pop.querySelector(".bin-copy-credit")?.addEventListener("click", () => copyCredits([FableCutMusic.creditLine(m.license)])); showPopover(pop, x, y); if (m.size == null) refreshMediaInfo([m]); } @@ -3233,6 +3239,7 @@ function renderLibrary() { } } function setBinTab(tab) { + if (tab !== "music") musicPreviewStop(); state.binTab = tab; for (const b of els.binTabs.querySelectorAll("[data-tab]")) b.classList.toggle("on", b.dataset.tab === tab); @@ -3241,10 +3248,229 @@ function setBinTab(tab) { els.libList.classList.toggle("hidden", isProj); if (els.binTools) els.binTools.classList.toggle("hidden", !isProj); if (tab === "shapes") renderShapesTab(); + else if (tab === "music") renderMusicTab(); else if (tab === "templates") { renderTemplatesTab(); fetchSaved("templates").then(() => { if (state.binTab === "templates") renderTemplatesTab(); }); } else if (!isProj) fetchLibrary(tab).then(renderLibrary); } +/* ═══════════════════════════ MUSIC (Openverse) ═══════════════════════════ */ +/* The bin's Music tab: openly licensed music and sound effects from Openverse + (music.js builds the search and reads the licences). The browser asks + Openverse directly; importing downloads the file through /api/import-url, + and the media entry keeps the track's licence (m.license) for the credits. */ +const music = { query: "", kind: "music", length: "", commercial: false, tracks: [], page: 0, pages: 0, count: 0, + busy: false, error: "", seq: 0, preview: null, importing: new Set() }; +function musicPreviewStop() { + if (music.preview) { music.preview.audio.pause(); music.preview = null; } +} +async function musicSearch(more) { + const seq = ++music.seq; + const page = more ? music.page + 1 : 1; + music.busy = true; music.error = ""; + if (!more) { music.tracks = []; music.page = 0; musicPreviewStop(); } + renderMusicTab(); + try { + const res = await fetch(FableCutMusic.searchUrl({ query: music.query, kind: music.kind, length: music.length, commercial: music.commercial, edits: music.commercial, page }), + { headers: { Accept: "application/json" } }); + const body = await res.json().catch(() => null); + if (seq !== music.seq) return; + if (res.status === 429) throw new Error("Openverse's limit for searches is used up for now — try again in a while"); + if (!res.ok) throw new Error("Openverse answered " + res.status + (body && body.detail ? ": " + body.detail : "")); + const r = FableCutMusic.results(body, page); + music.tracks = more ? music.tracks.concat(r.tracks) : r.tracks; + music.page = page; music.pages = r.pages; music.count = r.count; + } catch (e) { + if (seq !== music.seq) return; + music.error = e instanceof TypeError ? "Couldn't reach Openverse — are you online?" : e.message; + } + music.busy = false; + if (state.binTab === "music") renderMusicTab(); +} +function musicTogglePreview(t, btn) { + if (music.preview && music.preview.id === t.id) { + musicPreviewStop(); btn.textContent = "▶"; return; + } + musicPreviewStop(); + els.libList.querySelectorAll(".music-play").forEach((b) => (b.textContent = "▶")); + const a = new Audio(t.url); + a.onended = () => { if (music.preview && music.preview.audio === a) { music.preview = null; btn.textContent = "▶"; } }; + a.play().catch(() => { toast("Couldn't play " + t.title); btn.textContent = "▶"; }); + btn.textContent = "⏸"; + music.preview = { id: t.id, audio: a }; +} +/** Download a track into media/ and register it with its licence; place = add at the playhead too. */ +async function musicImport(t, place) { + if (!state.connected) { toast("Importing music needs the editor server"); return; } + if (music.importing.has(t.id)) return; + const have = project.media.find((m) => m.license && m.license.openverse === t.id); + if (have) { + if (place) addClipFromMedia(have, null, state.time); + else toast(`“${have.name}” is already in the project`); + return; + } + music.importing.add(t.id); + renderMusicTab(); + const gen = runtime.projectGen; + try { + const res = await fetch("/api/import-url", { + method: "POST", headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ url: t.url, name: FableCutMusic.fileName(t) }), + }); + const body = await res.json().catch(() => ({})); + if (!res.ok) throw new Error(body.error || "import failed (" + res.status + ")"); + const kind = libKind(body.name); + if (kind !== "audio" && kind !== "video") throw new Error("the track's file isn't audio: " + (body.name || "")); + const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind, src: body.src, folderId: null, + license: FableCutMusic.mediaLicense(t) }; + try { await loadMediaMetadata(m); ensureWave(m); } catch { /* probeMissingMeta retries */ } + if (gen !== runtime.projectGen) throw new Error("another project was opened — the file is in media/"); + project.media.push(m); + renderBin(); scheduleSave(); + if (place) addClipFromMedia(m, null, state.time); + toast(`Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`); + } catch (e) { + toast(e && e.message ? e.message : "Couldn't import the track"); + } finally { + music.importing.delete(t.id); + if (state.binTab === "music") renderMusicTab(); + } +} +function copyCredits(lines) { + navigator.clipboard.writeText(lines.join("\n")).then(() => toast(lines.length === 1 ? "Copied the credit" : `Copied ${lines.length} credits`), () => toast("Couldn't copy — the browser refused")); +} +/** The Export dialog's note: the licensed music the edit uses, its credits and any licence warnings. */ +function syncExportCredits() { + const box = $("exportCredits"); + if (!box) return; + const list = FableCutMusic.credits(usageDoc(), MediaLib.usageCounts(usageDoc())); + box.classList.toggle("hidden", !list.length); + box.innerHTML = ""; + if (!list.length) return; + const head = document.createElement("div"); + head.className = "export-credits-head"; + head.innerHTML = `Music credits — put these in the video's description `; + head.querySelector("button").addEventListener("click", () => copyCredits(list.map((c) => c.line))); + box.appendChild(head); + for (const c of list) { + const p = document.createElement("div"); + p.className = "export-credit"; + p.textContent = c.line + (c.needsCredit ? "" : " (no credit required)"); + box.appendChild(p); + for (const w of c.warnings) { + const q = document.createElement("div"); + q.className = "export-credit warn"; + q.textContent = "⚠ " + w; + box.appendChild(q); + } + } +} +function renderMusicTab() { + if (state.binTab !== "music") return; + const list = els.libList; + const focused = document.activeElement && document.activeElement.id === "musicQuery"; + list.innerHTML = ""; + const form = document.createElement("form"); + form.className = "music-search"; + form.innerHTML = ` + +
+ + + +
`; + const q = form.querySelector("#musicQuery"); + q.value = music.query; + form.querySelector("#musicKind").value = music.kind; + form.querySelector("#musicLength").value = music.length; + form.querySelector("#musicCommercial").checked = music.commercial; + form.addEventListener("submit", (e) => { e.preventDefault(); music.query = q.value.trim(); musicSearch(false); }); + form.addEventListener("change", (e) => { + if (e.target.id === "musicKind") music.kind = e.target.value; + else if (e.target.id === "musicLength") music.length = e.target.value; + else if (e.target.id === "musicCommercial") music.commercial = e.target.checked; + else return; + music.query = q.value.trim(); + musicSearch(false); + }); + list.appendChild(form); + if (focused) { q.focus(); q.setSelectionRange(q.value.length, q.value.length); } + + if (!music.tracks.length && !music.busy) { + const moods = document.createElement("div"); + moods.className = "music-moods"; + for (const w of FableCutMusic.MOODS) { + const b = document.createElement("button"); + b.type = "button"; b.className = "bin-tag chip"; b.textContent = w; + b.addEventListener("click", () => { music.query = w; musicSearch(false); }); + moods.appendChild(b); + } + list.appendChild(moods); + } + const status = (text, cls) => { + const p = document.createElement("div"); + p.className = "music-status" + (cls ? " " + cls : ""); + p.textContent = text; + list.appendChild(p); + }; + if (music.error) status(music.error, "err"); + else if (!music.busy && music.page && !music.tracks.length) status("Nothing found — try other words or another length."); + else if (music.page) status(`${music.count >= 240 ? "240+" : music.count} result${music.count === 1 ? "" : "s"}${music.query ? ` for “${music.query}”` : " — newest first"}`); + else if (!music.busy) status("Search openly licensed music, or pick a mood. Every track shows its licence."); + + for (const t of music.tracks) { + const item = document.createElement("div"); + item.className = "bin-item lib-item music-item"; + const busy = music.importing.has(t.id); + item.innerHTML = ` + +
+
+
+
+
+ + `; + item.querySelector(".bin-name").textContent = t.title; + item.querySelector(".bin-name").title = t.title + (t.tags.length ? "\n#" + t.tags.join(" #") : ""); + item.querySelector(".bin-sub").textContent = [t.creator, t.duration != null ? FableCutMusic.fmtLen(t.duration) : "", t.genres.join("/"), t.source].filter(Boolean).join(" · "); + const lic = item.querySelector(".music-lic"); + const badge = document.createElement(t.license.url ? "a" : "span"); + badge.className = "music-badge" + (!t.license.edits ? " no" : !t.license.commercial ? " nc" : !t.license.credit ? " free" : ""); + badge.textContent = t.license.label; + badge.title = t.license.note; + if (t.license.url) { badge.href = t.license.url; badge.target = "_blank"; badge.rel = "noopener"; } + lic.appendChild(badge); + const fl = document.createElement("span"); + fl.className = "music-flags"; + fl.textContent = t.flags.join(" · "); + fl.title = t.license.note; + lic.appendChild(fl); + if (t.page) { + const a = document.createElement("a"); + a.className = "music-page"; a.href = t.page; a.target = "_blank"; a.rel = "noopener"; a.textContent = "page ↗"; + a.title = "The track's page at " + (t.source || "its source"); + lic.appendChild(a); + } + const play = item.querySelector(".music-play"); + play.addEventListener("click", () => musicTogglePreview(t, play)); + item.querySelector(".music-get").addEventListener("click", () => musicImport(t, false)); + item.querySelector(".lib-add").addEventListener("click", () => musicImport(t, true)); + item.addEventListener("dblclick", (e) => { if (!e.target.closest("button, a")) musicImport(t, true); }); + list.appendChild(item); + } + if (music.busy) status("Searching…"); + else if (music.page && music.page < music.pages) { + const more = document.createElement("button"); + more.type = "button"; more.className = "btn tiny music-more"; more.textContent = "More results"; + more.addEventListener("click", () => musicSearch(true)); + list.appendChild(more); + } + const about = document.createElement("p"); + about.className = "music-about"; + about.innerHTML = `Made with Openverse, not endorsed or certified by it. Licences are the artists' — check one before you publish, and credit where it says so (the Export dialog lists the credits).`; + list.appendChild(about); +} + /* ═══════════════════════════ PROJECTS (dashboard) ═══════════════════════════ */ /* Several projects in one data folder (projects.js on the server). The open one is always ./project.json, so everything else in the editor is unchanged; the @@ -16683,6 +16909,7 @@ async function openExportSetup() { `${offUsed.length === 1 ? `“${offUsed[0].name}” is` : offUsed.length + " files are"} offline and will export as “Media offline” — relink first (right-click in the bin → Relink…).`; warn.classList.remove("hidden"); } + syncExportCredits(); fillExportRangeSelect(); syncExportRangeUi(); syncExportProfileVisibility(); diff --git a/docs/demo/index.html b/docs/demo/index.html index 28f5c7781..54647035c 100644 --- a/docs/demo/index.html +++ b/docs/demo/index.html @@ -60,6 +60,7 @@ + @@ -449,6 +450,7 @@

Export

+
@@ -721,6 +723,7 @@

Transcript side panel → Transcript

+ diff --git a/docs/demo/music.js b/docs/demo/music.js new file mode 100644 index 000000000..495143b1f --- /dev/null +++ b/docs/demo/music.js @@ -0,0 +1,195 @@ +/* FableCut music search — openly licensed music and sound effects from + Openverse (https://openverse.org), with each track's licence spelled out. + Zero dependencies; loaded by the editor as a plain script (global + `FableCutMusic`) and required by the MCP server, so the bin's Music tab and + `fablecut_music` search the same way and label licences the same way. + + Openverse indexes Jamendo, Freesound, ccMixter, Wikimedia Commons and more. + Its API needs no key: anonymous use allows 20 results a page, 240 results + per search (12 pages) and about 200 searches a day per address. Its terms + ask apps to say they are made with Openverse (not endorsed by it) and to + credit the works, which is what `credits` and `creditLine` are for. + + searchUrl(opts) → the API URL · track(result) → a plain track · licence(code, + version) → what it allows · mediaLicense(track) → what a media entry keeps + (m.license) · credits(doc, uses) → the credits the edit needs. */ +(function (root, factory) { + const api = factory(); + if (typeof module === "object" && module.exports) module.exports = api; + else root.FableCutMusic = api; +})(typeof self !== "undefined" ? self : this, function () { + "use strict"; + + const API = "https://api.openverse.org/v1/audio/"; + const PAGE_SIZE = 20; // the most an anonymous request may ask for + const MAX_PAGE = 12; // 240 results deep + const MAX_QUERY = 200; + // Openverse's length buckets, checked against its results + const LENGTHS = { + shortest: "under 30 s", short: "30 s – 2 min", medium: "2 – 10 min", long: "over 10 min", + }; + // sound effects: Freesound's (Openverse leaves their category empty, so a category filter misses them) + const KINDS = { music: { category: "music" }, sfx: { source: "freesound" } }; + const MOODS = ["upbeat", "chill", "cinematic", "epic", "lo-fi", "acoustic", "electronic", + "happy", "sad", "ambient", "piano", "corporate", "hip hop", "rock"]; + + /* What each licence lets a video editor do. edits: may it be cut, looped and + put under picture? Creative Commons counts music synced to moving images as + an adaptation, so ND (no derivatives) music can't go into an edit. */ + const LICENSES = { + cc0: { label: "CC0", commercial: true, edits: true, credit: false, note: "public domain dedication — use it any way you like" }, + pdm: { label: "Public domain", commercial: true, edits: true, credit: false, note: "public domain — use it any way you like" }, + by: { label: "CC BY", commercial: true, edits: true, credit: true, note: "any use, credit the artist" }, + "by-sa": { label: "CC BY-SA", commercial: true, edits: true, credit: true, note: "any use, credit the artist; the video must be shared under CC BY-SA too" }, + "by-nc": { label: "CC BY-NC", commercial: false, edits: true, credit: true, note: "non-commercial only (no ads, sponsored or monetized videos), credit the artist" }, + "by-nc-sa": { label: "CC BY-NC-SA", commercial: false, edits: true, credit: true, note: "non-commercial only, credit the artist; the video must be shared under CC BY-NC-SA too" }, + "by-nd": { label: "CC BY-ND", commercial: true, edits: false, credit: true, note: "no derivatives: music set to video counts as one, so it can't go into an edit" }, + "by-nc-nd": { label: "CC BY-NC-ND", commercial: false, edits: false, credit: true, note: "non-commercial and no derivatives: music set to video counts as one, so it can't go into an edit" }, + "sampling+": { label: "Sampling+", commercial: false, edits: true, credit: true, note: "parts may be sampled and remixed, also commercially (not for ads); the whole track only non-commercially; credit the artist" }, + "nc-sampling+": { label: "NC Sampling+", commercial: false, edits: true, credit: true, note: "parts may be sampled and remixed non-commercially; credit the artist" }, + }; + + /** What a licence allows: {code, label ("CC BY 4.0"), commercial, edits, credit, note, url}. */ + function licence(code, version, url) { + const c = String(code || "").toLowerCase(); + const base = LICENSES[c] || { label: c ? c.toUpperCase() : "Unknown licence", commercial: false, edits: false, credit: true, note: "unknown licence — check the track's page before using it" }; + const v = version && !/^(cc0|pdm)$/.test(c) ? String(version) : ""; + return { code: c, label: base.label + (v ? " " + v : ""), commercial: base.commercial, edits: base.edits, + credit: base.credit, note: base.note, url: url || "" }; + } + + /** The words that sum a licence up for a badge: "free to use", "credit", "non-commercial", "no edits", "share alike". */ + function flags(lic) { + const out = []; + if (!lic.credit && lic.commercial && lic.edits) out.push("free to use"); + if (lic.credit) out.push("credit"); + if (!lic.commercial) out.push("non-commercial"); + if (!lic.edits) out.push("no edits"); + if (/-sa$/.test(lic.code)) out.push("share alike"); + return out; + } + + /** The Openverse search URL. opts: {query, kind:'music'|'sfx', length:'shortest'|'short'|'medium'|'long', + * commercial:true (only licences that allow commercial use), edits:true (only ones that allow + * edits), licenses:[codes], page}. */ + function searchUrl(opts = {}) { + const q = String(opts.query == null ? "" : opts.query).trim().slice(0, MAX_QUERY); + const p = new URLSearchParams(); + if (q) p.set("q", q); + else p.set("unstable__sort_by", "indexed_on"); // nothing typed: the newest + const kind = KINDS[opts.kind] || KINDS.music; + for (const k of Object.keys(kind)) p.set(k, kind[k]); + if (opts.length && LENGTHS[opts.length]) p.set("length", opts.length); + const types = []; + if (opts.commercial) types.push("commercial"); + if (opts.edits) types.push("modification"); + if (types.length) p.set("license_type", types.join(",")); + const lic = (opts.licenses || []).map((l) => String(l).toLowerCase()).filter((l) => LICENSES[l]); + if (lic.length) p.set("license", lic.join(",")); + p.set("mature", "false"); + p.set("page_size", String(PAGE_SIZE)); + const page = Math.max(1, Math.min(MAX_PAGE, Math.floor(+opts.page || 1))); + if (page > 1) p.set("page", String(page)); + return API + "?" + p.toString(); + } + + /** One track's details by its Openverse id. */ + function trackUrl(id) { + if (!/^[0-9a-f-]{36}$/i.test(String(id || ""))) throw new Error("not an Openverse track id: " + id); + return API + String(id).toLowerCase() + "/"; + } + + // titles and names come HTML-escaped from some sources ("Jaief & Asong") + const ENT = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", "#39": "'" }; + const unescape = (s) => String(s).replace(/&(amp|lt|gt|quot|apos|#39);/g, (_, e) => ENT[e]).trim(); + + /** An Openverse result as a plain track. */ + function track(r) { + r = r || {}; + const lic = licence(r.license, r.license_version, r.license_url); + return { + id: r.id, title: unescape(r.title || "Untitled"), creator: unescape(r.creator || "Unknown artist"), + creatorUrl: r.creator_url || "", duration: r.duration ? Math.round(r.duration / 100) / 10 : null, + license: lic, flags: flags(lic), + url: r.url || "", page: r.foreign_landing_url || "", source: r.source || r.provider || "", + genres: (r.genres || []).slice(0, 6), tags: (r.tags || []).map((t) => t && t.name).filter(Boolean).slice(0, 10), + filetype: r.filetype || "", attribution: r.attribution || "", + }; + } + + /** A search answer → {count, pages, page, tracks}. */ + function results(json, page) { + json = json || {}; + return { count: json.result_count || 0, pages: Math.min(json.page_count || 0, MAX_PAGE), page: page || json.page || 1, + tracks: (json.results || []).filter((r) => r && r.url).map(track) }; + } + + /** 125.4 → "2:05". */ + function fmtLen(sec) { + const s = Math.round(+sec || 0); + return Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"); + } + + /** A friendly file name for the download: "Title - Artist.mp3". */ + function fileName(t) { + const ft = String(t.filetype || "mp3").toLowerCase(); + const ext = { mp32: "mp3", mp31: "mp3", oga: "ogg", opus: "ogg", aif: "wav", aiff: "wav" }[ft] || ft; + return (t.title + " - " + t.creator).replace(/[^\w.\- ()\[\]]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 100) + "." + ext; + } + + /** What a media entry keeps about where its file came from (m.license). */ + function mediaLicense(t) { + return { code: t.license.code, label: t.license.label, url: t.license.url, title: t.title, creator: t.creator, + page: t.page, source: t.source, openverse: t.id, attribution: t.attribution }; + } + + /** A media entry's licence as stored: only its text fields, trimmed; null when it isn't one. */ + function cleanLicense(l) { + if (!l || typeof l !== "object" || Array.isArray(l) || !l.code) return null; + const out = {}; + for (const k of ["code", "label", "url", "title", "creator", "page", "source", "openverse", "attribution"]) + if (typeof l[k] === "string" && l[k]) out[k] = l[k].slice(0, k === "attribution" ? 1000 : 300); + if (!out.label) out.label = licence(out.code).label; + return out; + } + + /** The credit to put in a video's description: "Title" by Artist (source) — CC BY 4.0 — page. */ + function creditLine(l) { + if (!l) return ""; + return `"${l.title}" by ${l.creator}` + (l.source ? ` (${l.source})` : "") + ` — ${l.label}` + + (l.url ? ` (${l.url})` : "") + (l.page ? ` — ${l.page}` : ""); + } + + /** The credits an edit needs: every licensed file the edit uses (a denoised + * copy counts as its original). uses: media id → placements (MediaLib.usageCounts). + * → [{mediaId, name, license, line, warnings}] */ + function credits(doc, uses) { + const media = (doc && doc.media) || []; + const byId = new Map(media.map((m) => [m.id, m])); + const origin = (m) => { + for (let i = 0; m && !m.license && m.derivedFrom && i < 8; i++) m = byId.get(m.derivedFrom); + return m && m.license ? m : null; + }; + const out = [], seen = new Set(); + for (const m of media) { + if (!(uses && uses.get ? uses.get(m.id) : 0)) continue; + const o = origin(m); + if (!o) continue; + const key = o.license.openverse || o.id; + if (seen.has(key)) continue; + seen.add(key); + const lic = licence(o.license.code); + const warnings = []; + if (!lic.edits) warnings.push(lic.label + " allows no derivatives — music set to video counts as one"); + if (!lic.commercial) warnings.push(lic.label + " is non-commercial only"); + if (/-sa$/.test(lic.code)) warnings.push(lic.label + ": share the video under the same licence"); + out.push({ mediaId: o.id, name: o.name, license: o.license, needsCredit: lic.credit, line: creditLine(o.license), warnings }); + } + return out; + } + + const ABOUT = "Music from Openverse (openverse.org) — made with Openverse, not endorsed or certified by it. Each track's licence is the artist's: check it before you publish."; + + return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, LICENSES, ABOUT, + licence, flags, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; +}); diff --git a/docs/demo/style.css b/docs/demo/style.css index d38fa0470..f4575e305 100644 --- a/docs/demo/style.css +++ b/docs/demo/style.css @@ -4825,3 +4825,34 @@ input[type=number]:hover::-webkit-inner-spin-button { opacity: .8; } @media (forced-colors: active) { .cmdk-item.active { outline: 2px solid Highlight; background: Highlight; color: HighlightText; } } + +/* Music tab (Openverse search) */ +.music-search { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; } +.music-search input[type="search"] { width: 100%; box-sizing: border-box; background: var(--panel); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font: 12px "Segoe UI", sans-serif; padding: 4px 8px; outline: none; user-select: text; } +.music-search input[type="search"]:focus { border-color: var(--accent); } +.music-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; } +.music-filters select { flex: 1 1 90px; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font: 11px "Segoe UI", sans-serif; padding: 3px 4px; } +.music-commercial { display: flex; align-items: center; gap: 4px; color: var(--dim); white-space: nowrap; cursor: pointer; } +.music-moods { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0 6px; } +.music-moods .bin-tag { font-size: 11px; padding: 2px 8px; } +.music-status { font-size: 11px; color: var(--dim); padding: 2px 2px 4px; } +.music-status.err { color: #f0c14a; } +.music-item { align-items: center; } +.music-item .bin-meta { min-width: 0; } +.music-item .music-play, .music-item .music-get { flex: none; width: 26px; padding: 3px 0; text-align: center; } +.music-lic { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 2px; font-size: 10px; color: var(--dim); } +.music-badge { padding: 0 5px; border-radius: 6px; background: #4f8cff26; color: #b9d0ff; text-decoration: none; white-space: nowrap; line-height: 1.5; } +.music-badge.free { background: #2fbf7126; color: #9be3bc; } +.music-badge.nc { background: #f0c14a24; color: #f0c14a; } +.music-badge.no { background: #e5484d26; color: #ff9c9f; } +.music-page { color: var(--dim); } +.music-page:hover, .music-badge:hover { text-decoration: underline; } +.music-more { align-self: center; margin: 4px 0; } +.music-about { font-size: 10px; line-height: 1.45; color: var(--dim); margin: 8px 2px 2px; } +.music-about a { color: inherit; } +.bin-info .bin-copy-credit { margin: 6px 0 2px; } +.export-credits { margin: 0 0 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-sub); font-size: 12px; line-height: 1.4; } +.export-credits-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; } +.export-credits-head .btn { margin-left: auto; } +.export-credit { color: var(--dim); overflow-wrap: anywhere; } +.export-credit.warn { color: #f0c14a; } diff --git a/docs/demo/sync.js b/docs/demo/sync.js index a76e149c2..4167cd22b 100644 --- a/docs/demo/sync.js +++ b/docs/demo/sync.js @@ -23,7 +23,7 @@ fs.writeFileSync(path.join(OUT, "index.html"), html); /* app.js and style.css are copied verbatim. Some of these only exist on branches that add them, so a missing one is skipped rather than fatal. */ -for (const f of ["app.js", "loudness.js", "ducking.js", "silence.js", "beats.js", "transcribe.js", "transcribe-worker.js", "captions.js", "audio-fx.js", "mask.js", "tracker.js", "reframe.js", "highlights.js", "motion.js", "color.js", "edit-ops.js", "comp.js", "sequences.js", "templates.js", "mp4-demux.js", "media-lib.js", "command-search.js", "delivery.js", "focus.js", "select-menu.js", "fx-worklet.js", "style.css", "favicon.svg", "ruler-worker.js", "meter-worklet.js", "svg-sanitize.js", "credits.js"]) { +for (const f of ["app.js", "loudness.js", "ducking.js", "silence.js", "beats.js", "transcribe.js", "transcribe-worker.js", "captions.js", "audio-fx.js", "mask.js", "tracker.js", "reframe.js", "highlights.js", "motion.js", "color.js", "edit-ops.js", "comp.js", "sequences.js", "templates.js", "mp4-demux.js", "media-lib.js", "command-search.js", "delivery.js", "focus.js", "select-menu.js", "music.js", "fx-worklet.js", "style.css", "favicon.svg", "ruler-worker.js", "meter-worklet.js", "svg-sanitize.js", "credits.js"]) { const from = path.join(ROOT, f); if (!fs.existsSync(from)) continue; fs.copyFileSync(from, path.join(OUT, f)); diff --git a/docs/docs/audio/index.html b/docs/docs/audio/index.html index 3be25cc2f..15c4e2876 100644 --- a/docs/docs/audio/index.html +++ b/docs/docs/audio/index.html @@ -75,17 +75,17 @@

Audio mix

How clips reach the speakers and the export: clip gain, channels, track faders, the master, and loudness normalize.

Every clip runs through the same chain in preview and export: source → channels (audioChannel / channelMode) → gain (dB) → clip fx → volume (keyframes, fades, duck) → pan → its A-track, then track fx → track fader → track pan → (submix bus fx → fader → pan) → master sum → master fx → master fader. A track has a fader (tracks[].gain, dB), a pan (tracks[].pan) and effects (tracks[].fx); the master has a fader (master.gain) and effects (master.fx). Submix buses (buses[], B1…B8) group tracks: a track with out:"B1" feeds that bus instead of the master, and the bus has its own effects, fader, pan and mute - e.g. every dialogue lane into one bus with one compressor and one fader. Audio on a video lane (a clip with volume > 0 on V1…) goes straight to the master. In the UI these are the strips in the Mixer tab beside the Inspector (its FX button edits that track's or the master's effects); mute / solo are the existing track switches (disabledTracks).

Effects (fx - an array processed in order; every parameter optional, out-of-range values are clamped; on:false bypasses one without losing its settings):

typeparameters (default)
eqlowFreq 120 Hz, lowGain 0 dB (low shelf) · midFreq 1000, midGain 0, midQ 1 (peak) · highFreq 8000, highGain 0 (high shelf); gains −18…+18
highpass / lowpassfreq (80 / 8000 Hz), q 0.71
compressorthreshold −20 dB, ratio 4, attack 10 ms, release 200 ms, knee 6 dB, makeup 0 dB
limiterceiling −1 dB, release 80 ms - brickwall, 5 ms lookahead; nothing passes the ceiling
gatethreshold −50 dB, range −40 dB (how far it closes), attack 2, hold 80, release 150 ms
delaytime 0.3 s, feedback 0.35, mix 0.25
reverbdecay 2 s, predelay 20 ms, mix 0.25
distortiondrive 0.3, mix 1
widenerwidth 1.5 (0 = mono, 1 = as is, 2 = extra wide)
pitchsemitones 0 (−12…+12; changes pitch, not speed - about 30 ms of delay), mix 1

Presets fill the chain with tweakable effects: Voice - clean-voice, podcast, radio, deep-voice (pitch down 4 semitones + a warmer EQ), telephone; Music - cinematic, wide, muffled (next room). Agents apply them (or any chain) with the patch op setFx: {op:"setFx", target:"clip", id:"c_vo", preset:"podcast"} · {op:"setFx", target:"track", id:"A3", fx:[{type:"eq", highGain:-3}]} · {op:"setFx", target:"master", fx:[{type:"limiter", ceiling:-1}], append:true} · {op:"setFx", target:"bus", id:"B1", preset:"podcast"} · fx:null clears. On a clip it applies to its linked stems too; chains are validated (unknown effect or preset → the whole patch is refused). The compact project view shows chains as fx:highpass·eq·… (lowpass~freq = automated).

Effect automation - any effect parameter except reverb decay can follow keyframes: keys on the effect, {param: [{t, v, ease?}]}. t is seconds from the clip's start for a clip's effects, and timeline seconds for a track's, a bus's or the master's; ease (linear · ease-in · ease-out · ease-in-out, default ease-in-out) shapes the segment arriving at that key, as with clip keyframes. While a parameter has keys they set it. Preview and export follow them the same way (export steps every 20 ms with a short glide). In the effects panel each parameter has a ◆: set or remove a key at the playhead; with keys, the slider edits the key under the playhead. Agents: {op:"setFxKeys", target:"bus", id:"B1", type:"lowpass", param:"freq", keys:[{t:0, v:18000}, {t:8, v:500, ease:"ease-in"}]} (index picks the effect when the type repeats; keys:null clears) - or write keys inside a setFx chain. Example - a filter sweep into the drop: a lowpass on the music clip keyed from 400 Hz up to 20000 Hz over the build.

  • Set a track fader / pan: {op:"setTrack", id:"A2", set:{gain:-8, pan:0}} (null or 0 resets). Master: {op:"setProject", set:{master:{gain:-1}}}.
  • Buses: {op:"setBus", id:"B1", set:{name:"Dialogue", gain:-2, pan?, mute?}} creates or updates one; route a track in with {op:"setTrack", id:"A1", set:{out:"B1"}} (out:"master" or null routes it back); {op:"removeBus", id:"B1"} sends its tracks back to the master. In the Mixer: + Bus, the → menu under a track's name, double-click a bus name to rename it.
  • Noise reduction - fablecut_denoise {clipIds, amount?:"light"|"medium"|"strong"|"off"} (default medium; the inspector's Noise control does the same). The file's noise floor is measured (its quietest 50 ms windows), then ffmpeg's FFT denoiser pulls everything near it down (10 / 18 / 30 dB) into a FLAC copy of the whole source file in media/, registered with derivedFrom (the original) and denoise (the amount). The clip and its linked audio stems switch to that copy; the picture keeps its own file, so links, in points and timing stay as they were. off switches back; a level already rendered is reused. Works on audio clips (a video's sound is on its linked stems). Needs ffmpeg. Use it before normalizing - the measured loudness changes.
  • Normalize - fablecut_normalize_audio {clipIds, mode?:"lufs"|"peak", target?} measures each clip's source window after its channel routing (ITU-R BS.1770 integrated loudness with EBU R128 gating, or sample peak) and sets props.gain to hit the target. Linked stems are measured together and share one gain; passing a video clip normalizes its stems. Targets: −14 LUFS streaming / social, −16 LUFS podcast / dialogue, −23 LUFS broadcast, or mode:"peak", target:-1. Locked clips are skipped unless force:true. The inspector's Normalize in the editor does the same measurement.
  • Fade curves - a fade transition on an audio clip may carry curve: "power" (constant power - the crossfade default, no dip in the middle), "linear" (constant gain - for crossfading the same material, e.g. a split of one take) or "exp" (slow start, natural fade to silence). No curve keeps the original eased shape. Only the volume follows the curve; picture fades are unchanged. {transitionOut:{type:"fade", duration:3, curve:"exp"}}.
  • Crossfades - overlap A and B on one track and give A transitionOut:{type:"fade", duration:d, curve:"power"} and B transitionIn the same, with d = the overlap. Shift+D in the editor does it for you: it borrows the overlap from spare media on both sides of the cut (half each, or more from the side that has it), so nothing after the cut moves; for a linked shot the stems crossfade and B's picture dissolves in.
  • Auto-duck - fablecut_auto_duck {clipIds:[music…], under?:["A1"], amount?:-12, threshold?:-40, attack?:0.3, release?:0.6} finds where the voice tracks (default: every other audio track) are above threshold dBFS - short gaps are bridged so the music doesn't pump between words - and writes keyframes.duck on the music: ramp down attack s before speech, hold, back up over release s. It replaces earlier ducking; amount:0 clears it. Same as the inspector's Auto-duck section or the clip menu's Auto-duck under other tracks.
  • Silence - fablecut_silence {clipIds, threshold?:-40, minSilence?:0.5, padding?:0.15, cut?, tracks?, force?} listens to the speech clips (a video brings its linked stems; each measured after its channel routing, gain and volume) and finds every stretch where none of them is above threshold dBFS for at least minSilence seconds. It keeps padding seconds of quiet after the phrase before and before the phrase after, so words aren't clipped; a clip's own start and end are cut to the first and last word. Cuts land on whole frames, and the gaps between clips are left alone. Without cut it only reports the spans (timeline seconds). With cut:true each one is removed with an extract on the targeted tracks (tracks picks others), last first, in one revision: later material moves up, linked stems stay in step, and locked tracks and clips stay where they are - lock the music bed first if it should keep running under the tightened edit. force:true cuts through locked material too, so pass it only when the user asked. Only time that was actually heard is cut: a clip with no audio stream (or disabled) is left alone, and so is one with a speed ramp (keyframes.speed) - its sound doesn't sit on the timeline at one speed. A version of the project as it was is kept before the cut; if that fails the reply says so in a warning, and then there is no version to go back to. Raise threshold toward −30 in a noisy room; lower minSilence for a tighter, jump-cut feel. In the editor: the Inspector's Silence section on an audio or video clip (or right-click → Find silences) - Find marks the silences on the timeline as amber bands, Cut N extracts them (one undo step), Clear removes the marks. The marks drop when the timeline, a clip's file, speed or level, or the frame rate changes.
  • Beats - fablecut_beats {clipId, markers?, snap?, retime?, every?, force?} listens to a music clip (an audio clip, or a video's sound) and finds its tempo (BPM), a steady beat grid - the tempo's period, phased and fitted to the hits, so it doesn't drift over a song - and the drop, all in timeline seconds through the clip's in point and speed. On its own it only reports. Then, in one revision: markers:true puts a cyan marker on every beat (other markers stay, and a beat that already has one keeps it); snap:true (or {tracks, maxShift}) rolls each cut on the targeted video tracks to the nearest beat within half a beat - a roll, so nothing else moves and linked stems follow; a cut whose clips have no spare footage to reach the beat stays where it is, and the reply says how many; retime:{track?, every?, from?} lays a track's clips (default the lowest video track with clips) back to back on the beat, every beats each (1, 2, 4, 8 or 16; default 2), from the first beat at or after from (default the music's start), in their order - a clip whose footage runs out gets fewer beats, clips past the music keep their length, and one with less than a beat of footage refuses the whole re-cut. Locked clips are left alone by snap and refuse retime, unless force:true (only when the user asked). A version is kept before snap or retime; if saving it fails, the edit still goes ahead and the reply says so in a warning. A re-cut clip that gets shorter loses the keyframes past its new end, and its transitions are kept no longer than the clip, as with a trim. The music clip itself (and its linked stems) is never re-cut, even when it sits on the track being re-cut. Cuts land on whole frames. A clip with a speed ramp is refused: its music doesn't keep time on the timeline. In the editor: the Inspector's Beats section on an audio or video clip - Find beats shows the beat as ticks across the timeline and the BPM and drop below; then Mark, Snap cuts, and Re-cut a track every N beats (each one undo step).
  • In the editor, each audio clip shows its volume line (yellow; dashed = after ducking): drag it to change the level, Ctrl/Cmd-click to add a keyframe, drag a point to move it, Alt-click or double-click to remove one. The corner fade grips drag a constant-power fade in or out. Both edit linked stems together.
  • Use gain for "this clip is too quiet / loud", volume keyframes for shaping, duck for dipping under dialogue, the track fader to balance whole lanes (dialogue against the music bed), and a bus when several lanes need the same processing or one fader.
- +
diff --git a/docs/docs/build.js b/docs/docs/build.js index e469cbc8d..d7051d0eb 100644 --- a/docs/docs/build.js +++ b/docs/docs/build.js @@ -53,6 +53,11 @@ const PAGES = [ lede: "How clips reach the speakers and the export: clip gain, channels, track faders, the master, and loudness normalize.", parts: [["project.json schema", "Audio mix"]], }, + { + slug: "music", nav: "Music", title: "Music", group: "Picture and sound", + lede: "Openly licensed music and sound effects from Openverse, each with its licence spelled out; import a track and FableCut keeps its credit for the video's description.", + parts: [["project.json schema", "Music"]], + }, { slug: "transcripts", nav: "Transcripts", title: "Transcripts and text-based editing", group: "Picture and sound", lede: "Turn speech into words with times, in the browser, then read, search and cut the edit like text: in the Transcript tab, or from an agent with fablecut_transcribe.", diff --git a/docs/docs/captions/index.html b/docs/docs/captions/index.html index 3aca9d406..ad7963d29 100644 --- a/docs/docs/captions/index.html +++ b/docs/docs/captions/index.html @@ -75,14 +75,14 @@

Captions

Captions timed word by word from the transcript, in four styles, burned into the picture; SRT and WebVTT out and in.

Captions are made from a transcript (see Transcripts and text-based editing): the timeline's words are grouped into captions, and each caption is an ordinary text clip with wordTimes (each word's start and end), so its animation follows the speech word by word, and caption: true, so captions can be found, replaced and exported as a group. Because they are text clips they render the same way in preview and export (burned into the picture), and the Inspector restyles them like any title.

stylelook
subtitle (default)plain text on a dark bar, low on the frame, up to two lines
karaokebold outlined text; each word lights up as it is said
highlightbig uppercase outlined words, the one being said in a colour (highlightColor) - the short-video look; up to five words
popone to three big words at a time, each popping in as it is said

A new caption starts at a pause of 0.6 s or more, after a sentence, after a comma once it has three words, or when it would run too long (lines, words or seconds). Lines are as long as fit the canvas at the style's size: sizes follow the canvas's shorter side, so a 9:16 reel gets narrower captions than a 16:9 video. Each caption stays about a quarter of a second after its last word, never into the next one, and starts and ends on whole frames.

They go on the video lane captions are already on; otherwise on the top video lane when nothing is there while they run, else on a new lane above it. Making captions again replaces the ones there. Make them after the cutting is done: a cut through a caption shortens it but doesn't re-time its words, so make them again after you change the edit. The editor says so for a moment whenever an edit shortens a caption.

In the editor, the Captions row of the Transcript tab: pick a style, then Add captions (one undo step). SRT and VTT download the timeline's captions as a subtitle file; Import… places the captions of an SRT or WebVTT file instead, re-broken to the style's line length, with their words spread over each caption. Select a caption to restyle it in the Inspector: the Highlight colour sits under Animation, and a note says its words follow the speech.

Agents use fablecut_captions:

  • {} or {style:"highlight"} makes captions from every clip with sound (transcribing what has no transcript yet, as fablecut_transcribe does), and answers with where they went and the first few. clipIds, from / to limit it; lines, words and size (a scale on the style's size) adjust it; track picks the lane; replace:false keeps the captions already there.
  • {export:"srt"} or {export:"vtt"} writes the captions that show (not disabled, not on a disabled track) to exports/<project name>.srt or .vtt, adding a number when that name is taken (<project name> 2.srt), and returns the path: use that one.
  • {import:"<path to .srt or .vtt>"} places a file's captions (the file's text works too).
  • {remove:true} deletes every caption clip. Locked captions are left alone and refuse the call unless force:true.
  • Check one with fablecut_frame {time} while a word is being said. Restyle them all with updateClip (e.g. props:{highlightColor:"#22d3ee", y:500}) on each caption id from the compact view, which lists a caption as [5 words timed to speech] instead of its times.
diff --git a/docs/docs/color/index.html b/docs/docs/color/index.html index ad34a284f..5c02d034d 100644 --- a/docs/docs/color/index.html +++ b/docs/docs/color/index.html @@ -75,7 +75,7 @@
keydoes
name · ona label; on:false turns the layer off
qualifier.hue[centre°, width°, soft°] - hues within ±width/2 of the centre, easing out over soft; wraps through red. Greys carry no hue, so a hue range leaves them out
qualifier.sat · qualifier.luma[low, high, soft] on 0…1 - saturation (HSV) / Rec.709 luma between low and high
qualifier.invertselect everything else
mask.shapeellipse · rect · poly · bezier (or freehand with a stroke, fitted into a bezier - see Masks)
mask.x · mask.ycentre, as fractions of the clip's picture (0…1, y down)
mask.w · mask.hsize, fractions of the picture's width / height (ellipse, rect)
mask.rotationdegrees, clockwise
mask.feathersoft edge, a fraction of the picture's height (0…0.5), centred on the outline
mask.pointspoly: 3–16 [dx, dy] corners around x, y (fractions of width / height); bezier: 3–24 anchors [dx, dy] or [dx, dy, inX, inY, outX, outY] with curve handles
mask.invertgrade outside the shape
mask.keysanimate it: [{t, x?, y?, w?, h?, rotation?, feather?, ease?}], t in seconds from the clip's start; each param eases between the keys that set it (ease on the arriving key, as for clip keyframes)

Masks live in the clip's own picture, so they follow the clip when it is moved, scaled, rotated, cropped or flipped. On an adjustment layer they are fractions of the canvas.

In the editor the strip under Copy / Paste lists Primary and the layers; + Layer adds one. With a layer picked, the wheels, sliders and curves edit that layer, and three more sections appear: the layer's name, On, Matte (the monitor shows what it selects, white = graded), ↑ ↓ to reorder, Delete; Qualifier - Pick then click a colour in the monitor to select its hue, saturation and luma, then tune the ranges; and Mask - pick a shape and drag it on the monitor (inside moves it, the handles resize it, the knob rotates it, Shift snaps to 15°; on a poly or bezier, Ctrl-click adds a point and double-click removes one), or Draw a free-hand outline on the monitor (it becomes a bezier). ◆ Key keys the shape at the playhead; once it has keys, every change to the shape keys.

Wheel colours. A wheel's r, g, b normally carry no brightness: they are a point on the vectorscope's Cb / Cr plane, so pushing a wheel toward a colour moves the picture's trace toward that colour's target. To tint shadows teal by about 0.03: lift: [-0.034, 0.008, 0.012, 0] (r = 1.5748·Cr, g = −0.1873·Cb − 0.4681·Cr, b = 1.8556·Cb, with Cb = 0.0065, Cr = −0.0216 here). Small values go a long way - ±0.02…0.05 on lift and offset, ±0.05…0.15 on gamma and gain.

Agents set a grade with the patch op setGrade and check it with fablecut_scopes:

  • {op:"setGrade", id:"c_a", grade:{exposure:0.3, temp:-15, contrast:1.15}} - merges into the clip's grade key by key; null on a key resets it; replace:true starts from neutral; grade:null clears it; ids:[…] grades several clips at once. curves merges per channel: grade:{curves:{r:[[0.5, 0.55]]}} keeps the other channels, curves:{y:null} removes the luma curve. layers replaces the whole layer list. Unknown keys or bad values refuse the whole patch. Locks apply (force:true as elsewhere).
  • {op:"setGradeLayer", id, layer, set:{…}} edits one layer: layer is an index (0 = first) or a name. A name that isn't there yet - or the index one past the end - adds a layer. set takes any layer key and merges like setGrade; qualifier and mask also merge key by key (mask:{x:0.6} moves it, qualifier:{luma:null} drops the luma range). replace:true starts the layer from scratch (keeping its name), remove:true deletes it. ids:[…] works too.
  • fablecut_scopes {time} renders the graded frame at time (default: the playhead) exactly as export would - an open editor tab, else headless - and returns numbers: luma min / 1st percentile / median / mean / 99th percentile / max (0–1), the % of pixels at pure black and pure white, mean R/G/B, average saturation, and the midtones' colour cast (hue name, hue angle, strength; "neutral" below 0.01), plus the clips on screen and their grades. With an exportFrame it measures the delivered crop.
  • fablecut_scopes {time, matte:{clip, layer}} also measures what one layer selects: the matte's coverage (% of that clip's own picture, measured alone - other clips and adjustment layers don't count) and the levels, mean RGB, saturation and cast of the selected pixels after grading. A coverage near 0 means the qualifier or mask misses; check it before trusting a secondary.

Reading the numbers: a normally exposed shot has its median near 0.35–0.5; whitePct above ~1 means clipped highlights (lower highlights / whites, or add highSoft); blackPct above ~2 means crushed shadows. A cast strength above ~0.03 on a scene that should be neutral wants white balance: move temp against the cast (orange / yellow → lower temp; blue / cyan → raise it) and tint against green / magenta, then measure again.

Secondary workflow: grade the whole shot first (primary), then add a layer for the one thing that needs its own correction - e.g. skin: {op:"setGradeLayer", id, layer:"Skin", set:{qualifier:{hue:[25, 40, 20], sat:[0.12, 0.7, 0.1]}, saturation:92}}, then fablecut_scopes {matte:{clip:id, layer:0}} - expect a coverage that matches how much of the frame is skin and a cast near orange (hue ~25–35°). A sky: qualifier:{hue:[210, 50, 25], luma:[0.45, 1, 0.1]} with hueSat:[[210, 1.25]]. A vignette or a relight: a feathered ellipse mask with invert:true and exposure:-0.5, or without invert and exposure:+0.3 on a face; give it keys to follow a move.

Workflow for matching shots: grade the hero shot, measure it, then grade every other shot of the scene until its median and cast land near the hero's. In the editor, Copy / Paste on the Color tab pastes one clip's grade onto every selected clip.

diff --git a/docs/docs/compositing/index.html b/docs/docs/compositing/index.html index 2ebea78e1..6e1ceedcc 100644 --- a/docs/docs/compositing/index.html +++ b/docs/docs/compositing/index.html @@ -75,14 +75,14 @@

Track mattes and blending

Cut a clip with the picture on another track by its alpha or its brightness, and lay clips over each other with blend modes, from the Inspector or from an agent with setMatte.

A track matte cuts a clip with the picture on another track: where that picture is opaque (alpha) or bright (luma), the clip shows. Set it on the clip being cut, the fill:

propdoes
mattealpha · alpha-inverted · luma · luma-inverted. Alpha keeps the clip where the matte's pixels are opaque, luma where they are bright (white = shows, black = gone, Rec. 709 weights). The inverted modes keep the opposite
matteTrackthe video track the matte comes from. Default: the video track directly above the clip (V2 for a clip on V1)

The matte track does not draw into the frame while a clip on screen uses it; it only cuts. Its clips keep their own transform, keyframes, opacity, masks and effects, so the matte can move, scale and animate on its own. When the matte track has nothing at that moment, alpha / luma show nothing of the clip and the inverted modes show all of it. Track mattes and masks combine: the matte cuts the clip, then its masks cut what is left, then opacity and blend composite it. A clip used as a matte is drawn without its own track matte. Audio clips take neither.

blend is how a clip lays over what is under it: normal · multiply · screen · overlay · darken · lighten · color-dodge · color-burn · hard-light · soft-light · difference · exclusion · hue · saturation · color · luminosity · lighter (add). Blending happens after masks and mattes, so a masked clip only blends where it is kept.

In the editor, Track matte and Matte track sit under Blend in the Inspector's Transform section (the Adjustment layer section for an adjustment layer). The timeline marks a clip with a track matte ◐ and shows the clips that serve as its matte hatched, labelled Matte.

Agents: {op:"setMatte", id, matte:"luma"} (or ids:[…]; track:"V3" picks the matte track, track:null goes back to the one above; matte:null removes it). blend, matte and matteTrack written through addClip / updateClip are validated too. fablecut_scopes lists each clip on screen with its matte (e.g. luma from V2), blend, and whether it is a matte itself.

Recipes: text filled with video - the text on V2, the video on V1 with matte:"alpha"; a shape reveal - an svg or a masked solid on V2 whose scale keys up, the shot on V1 with matte:"alpha"; light leaks / film burn on V2 with blend:"screen"; a grade only in the bright areas - an adjustment layer with matte:"luma" over a copy of the shot; a cut-out through a texture - luma-inverted against a black-and-white texture.

diff --git a/docs/docs/compositions/index.html b/docs/docs/compositions/index.html index b0e4fe89f..170fe9727 100644 --- a/docs/docs/compositions/index.html +++ b/docs/docs/compositions/index.html @@ -75,7 +75,7 @@
keydefaultdoes
id · name- · the idhow clips and agents refer to it · the label shown on its clips and in the bin
width · heightthe project'sthe comp's frame, px (16…8192)
duration-seconds; what the comp shows past its clips is transparent (or its background)
backgroundnonea colour behind the comp's clips; leave it out for transparent
tracksV3…V1, A1, A2the comp's own lanes, like the project's tracks
clips[]ordinary clips of any kind (comp clips too), with times inside the comp
template-set on a placed template: {id, hold, fields} (see Presets and templates)

A comp clip (kind:"comp", compId, no mediaId) shows the comp from its in (comp seconds) for its duration, at speed 1. It draws like a picture of the comp's size: fit defaults to none (the comp's own pixels), and its transform, keyframes, opacity, transitions, masks, track matte, blend, grade and filters all apply to the comp's frame as a whole. Trims and splits move its in like a video clip's; the window can't run past the comp's length.

The media inside a comp plays and exports as if it were on the timeline: its video frames, and its audio, which goes through the main timeline's audio track of the same name (its fader, effects and bus). A comp clip that is disabled, or sits on a disabled track, silences the comp's audio too. Comps nest up to 4 deep, and a comp can never contain itself.

In the editor: the bin's Project tab lists the comps; drag one onto the timeline to place it, and double-click it (or a comp clip, or Open in the Inspector's Composition section) to open it. An open comp takes over the timeline: every tool, shortcut and inspector works on its clips, and the breadcrumb above the timeline (or Esc, once nothing is selected) goes back out. Right-click clips → Precompose moves them into a new comp and puts a comp clip in their place; right-click the Project tab → New composition starts an empty one. The Composition section also sets the comp's name, size, length and background.

Agents:

  • {op:"addComp", comp:{id?, name, duration, width?, height?, background?, tracks?, clips?:[…]}} adds one (its clips go through the same checks as addClip). {op:"updateComp", id, set:{name?, width?, height?, duration?, background?, tracks?}} changes it; {op:"removeComp", id} is refused while a clip still uses it.
  • Place it with addClip {kind:"comp", compId, track, start, duration, in?}.
  • {op:"inComp", comp, ops:[…]} runs clip and timeline ops on the comp's own clips: addClip, updateClip, removeClip, split, rippleDelete, the trims, setShape, setMask, setGrade, setParent, setMotionPath, setTextPath, clip setFx, precompose, and inComp for a comp inside it.
  • {op:"precompose", ids:[…], name?, id?} moves those clips (here, or in the comp an inComp is running in) into a new comp that starts at the earliest of them; a comp clip of the same length takes their place.
  • The compact view shows a comp clip as comp(lt in:1.5) and lists every comp under COMPS with its clips.

Recipes: reusable lower third - a template (next section) gives every speaker their own copy with their own name; a plain comp suits a graphic that is the same every time; logo sting - a draw-on logo comp at the head and tail of the edit; picture in picture of a whole scene - precompose the scene's clips, then scale the comp clip down and move it into a corner; one grade for a sequence - precompose it and grade the comp clip once.

diff --git a/docs/docs/editing/index.html b/docs/docs/editing/index.html index 2a2e1576d..9fcc378d2 100644 --- a/docs/docs/editing/index.html +++ b/docs/docs/editing/index.html @@ -75,14 +75,14 @@

Editing rules

How tracks, links, locks, targeting and the trim tools behave, for people and agents alike.

  • Rendering order: V1 is drawn first, then V2, V3, … on top. SVG/image/text clips go on any V track (higher V lanes are handy overlay lanes). Add lanes with the timeline +V / +A buttons (or by listing them in tracks); up to 16 per kind. Right-click an empty track header → Remove track (disabled if the lane has clips or is the last video/audio track).
  • Audio tracks A1–An hold both standalone audio files and linked companions for imported video. Dropping a video creates the picture on a V track (props.volume: 0 so it isn't doubled) plus one kind:"audio" clip per source channel on consecutive A-tracks that share a linkGroup (and the same mediaId / timing). Each stem is mono-isolated then placed with pan (defaults preserve stereo: L −1, R +1). Standalone music/SFX also live on A-tracks. Linked partners move/trim/split together - edit timing on any member of the group; do not treat A-tracks as music-only.
  • Three track switches (Premiere-style), all in the track header and all persisted on project.json:
    • Enable (eye / speaker) → disabledTracks. Output only: a disabled lane is left out of preview, audio and export. It does not affect editing.
    • Target (click the track name - lit = targeted) → untargetedTracks. Decides which lanes an edit touches when nothing is selected: split at playhead (S), insert ripple (,), replace punches (.), ripple-delete shifting (⇧Del), close gap (⇧G), next gap (G), split / trim at IN/OUT (T / ⇧T) and jump to cut (↑ / ↓). Source placement follows targeting too: the picture lands on V1 if it is targeted, else the lowest targeted video lane (none → the edit lands audio-only); stems land on the first two targeted audio lanes. A selection is always edited wherever it sits.
    • Lock (padlock) → lockedTracks. Nothing on a locked lane can be moved, trimmed, split, deleted or edited in the inspector, and ripples leave it where it is while the other lanes shift. A locked lane is never an edit target. Typical use: lock the music bed, then ripple the picture freely.
  • Clip lock / enable - right-click a clip, or use the toggles at the top of the inspector. locked: true pins one clip the same way a locked lane does. disabled: true (⇧E) keeps the clip on the timeline but drops it from preview, audio and export - like a disabled lane, for a single clip. Both apply to the clip's whole linked group.
  • Locks and linked groups - a linked A/V group with any locked member (its own flag or its lane) counts as locked as a whole, so sync is never broken by a partial move.
  • Sync lock - edits that shift clips move the targeted lanes; linked AV partners always ride along, even on an untargeted lane, and locked groups stay put. On reload relinkClips rebuilds linkGroup from matching mediaId / start / in / duration.
  • Unlink / link (Ctrl/Cmd+L) - unlinking a group removes its linkGroup and stamps unlinked: true on each member, so the reload-time relink leaves them apart; picture and audio then move, trim and delete separately. Link (select one video clip plus its audio, Ctrl/Cmd+L) only joins clips of the same file that line up exactly - same start, in and duration - because a link here means identical timing.
  • Agents and locks - fablecut_patch_project refuses updateClip / removeClip on locked material (own flag, locked lane, or a linked partner of one) and addClip onto a locked lane. Treat locked clips as the user's finished work: leave them alone. Only when the user asks you to change one, pass force: true on that op, or unlock first with updateClip set:{locked:null} (always allowed). fablecut_set_project, REST PUT and direct file edits are not guarded - respect locks there too.
  • Media is fit-ted to the canvas (default "contain"), then crop → scale/x/y/ rotation → flips apply.
  • props keys are all optional - missing keys get the defaults above.
  • Video/audio clips must satisfy in + duration×speed ≤ media.duration.
  • Keyframes fully override the static prop value while present; they are clip-local and are re-based automatically when clips are split or trimmed.
  • Transitions modulate the evaluated props (fade also fades audio); they render on top of keyframes, so both can coexist.
  • Same-track overlap IS the crossfade idiom: overlap A and B by ~1 s and give B transitionIn: {type:"fade"} (for audio also A transitionOut, both with curve:"power" - see Audio mix).
  • A cut/split is just two clips: first with duration: t, second with start: +t, in: +t×speed, duration: rest.
  • Edit tools (timeline toolbar picker, or V / B / R / Y / U) change what a clip drag does. Agents run the same edits with the patch ops rippleTrim, roll, slip and slide (see Timeline edit ops).
    • Selection (V) - move and trim, as always.
    • Ripple edit (B) - drag a clip edge; everything after it on the targeted tracks (and the clip's own lanes) moves with it, so no gap opens or closes. Dragging a head keeps the clip's start and trims its source In.
    • Rolling edit (R) - drag a cut; the clip on one side lengthens by what the other loses, nothing else moves.
    • Slip (Y) - drag a clip to change its source In only (dragging left shows later source); position and length stay. Video / audio clips only.
    • Slide (U) - drag a clip along its track; the clip before it trims its tail and the clip after it its head, so the sequence length stays. All four are clamped to the available source media, MIN_DUR and the free room on the track, take linked partners with them, and refuse on locked clips; a readout by the pointer shows the offset while dragging.
  • Lift (;) / Extract (') - remove IN→OUT on the targeted tracks. Lift leaves the gap; Extract closes it. Linked partners are cut too, locked clips stay whole, and IN / OUT clear afterwards.
  • Jump to cut - ↑ / ↓ move the playhead to the previous / next clip In or Out. Selection first (that clip’s start then end); no selection walks targeted-track cuts. Source monitor: 0 / In / Out / duration. Does not change project.json.
  • bgRemove and chromaKey can combine with all filters; heavy pixel work is automatic (only runs when those props are set).
diff --git a/docs/docs/export/index.html b/docs/docs/export/index.html index 3b6f88140..e95091755 100644 --- a/docs/docs/export/index.html +++ b/docs/docs/export/index.html @@ -75,7 +75,7 @@

Export is one ffmpeg pass. The server owns the input side and the output path; args is everything in between (plus JPEG color conversion derived from color):

ffmpeg -y -f image2pipe -framerate <fps> -i - [-i audio.wav] <jpeg-color> <args…> exports/<name><extension>
  • There is no allow-list. Any codec, filter, container or flag your local ffmpeg supports works - ProRes, DNxHD, NVENC/QSV/VideoToolbox, VP9/AV1, 10-bit, HDR tags. See the shipped prores422, broadcast1080i50, nvenc-h264, nvenc-hevc, videotoolbox-h264 and videotoolbox-hevc profiles (the NVENC ones need an NVIDIA GPU; VideoToolbox requires macOS / Apple Silicon).
  • Args are validated by ffmpeg itself, not by a schema: when an export starts the server dry-runs the profile against a 0.1 s synthetic input (lavfi). A typo or an encoder your build lacks is rejected up front with ffmpeg's own message, instead of failing after every frame has been rendered.
  • Use the array form - each element is passed to spawn untouched, so no quoting is needed (["-vf", "drawtext=text='hi there'"] just works). A plain string is accepted and split on whitespace.
  • color controls JPEG→YUV conversion and stream tags (-colorspace / -color_primaries / -color_trc / -color_range). Default is BT.709 limited (range: "tv"). Use "range": "pc" for full-range masters. Do not put those flags in args - the engine strips them and applies color so vf and tags stay aligned. -pix_fmt stays in args (sampling / bit depth only).
  • Nothing else is injected for you: +faststart, -shortest, -strict -2 for Opus in MP4 and pixel-format choices are all yours to write.
  • Frames arrive as JPEG (4:2:0), so yuv422p/yuv444p cannot recover chroma the source never had; raise jpegQuality before reaching for a wider pixel format. Optional pixelFormat:"rgba" on /api/export/begin pipes uncompressed canvas frames instead (-f rawvideo) when a caller wants full chroma.
  • The audio mix is only present when the timeline has audio; with no audio there is a single input, so avoid hardcoded -map 1:a.

Note: Fast export pipes composited JPEG frames from the browser (-f image2pipe), not -i source.mp4. Filters and codec settings apply to that frame stream. To transcode an existing file verbatim, run ffmpeg directly - that is outside the compositor path.

Encoding profiles are listed at the bottom of the Export dialog's Preset list.

What the Export dialog opens on (priority):

  1. project.delivery, then project.encodeProfile - set with setProject
  2. The last preset or profile used in this browser
  3. The master delivery preset

MCP: fablecut_encode_profiles lists profiles; {detail:true} includes each args array; {profile:"hq"} returns one profile. fablecut_status shows the effective profile.

diff --git a/docs/docs/frames/index.html b/docs/docs/frames/index.html index e4a341241..a9a1fec3f 100644 --- a/docs/docs/frames/index.html +++ b/docs/docs/frames/index.html @@ -75,14 +75,14 @@

Look at the footage

Show an agent what the footage holds: one frame, a contact sheet across a clip, or the composed timeline - as an image, or as text-only measurements for models without vision.

fablecut_analyze_reference gives you the ears - where the cuts are, how hard each shot hits. fablecut_frame gives you the eyes. It answers with a real image (an MCP image content block), so you can judge a shot instead of inferring it from an energy value.

callreturns
{path:"/media/x.mp4", t:3.2}that exact frame
{path:"/media/x.mp4", frames:12}a 4×3 contact sheet across the whole clip
{path:"/media/x.mp4", frames:12, from:30, to:90}a contact sheet across part of it
{time:8.5} (no path)the composed timeline at 8.5 s, graded, all tracks
{path} with an absolute paththe file is read in place without copying into media/
{path, text:true}text-only statistics (luma, colors, texture, saturation, motion) for non-vision agents

Each answer leads with a text line naming the source, the timestamp(s) and (in timeline mode) the clips on screen, so you always know what you are looking at. width sets the pixel width (default 768 for one frame, 320 per contact-sheet cell); text:true returns descriptive statistics instead of an image block, for agents without vision capability - luma levels (min, p1, median, mean, p99, max, all 0–1 like fablecut_scopes), dominant colors, texture, saturation and per-cell motion; where/timeout apply to timeline mode only.

The REST endpoint /api/frame accepts src, t, frames, from, to, w, q (JPEG quality 1–31) and text=1 (statistics mode) as query parameters.

When it pays. Before choosing a clip's in point, sample a few candidate moments - the blueprint tells you a shot spans 2.1 s–4.9 s and reads energy: 88, but only a frame tells you whether that is a car jump or a pan across a landscape. Contact sheets are the cheap survey: one call shows you what a whole 3-minute clip holds, then you grab single frames where it matters. Timeline mode answers "what did I actually build?" - the same picture the user sees and export renders, grades and transitions included.

Needs ffmpeg on PATH for the source modes. Timeline mode runs in the open editor tab, else a headless browser, like fablecut_export.

diff --git a/docs/docs/index.html b/docs/docs/index.html index d77e6ee78..6e39b5667 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -75,14 +75,14 @@

FableCut docs

The manual for FableCut, built from CLAUDE.md in the repo: the same text your agent reads through the fablecut_docs tool, so what you read here is what it knows.

-
Studio (no install)The same editor at studio.fablecut.space, with nothing to install. It edits a folder on your own disk, and Claude Code, claude.ai, ChatGPT or any MCP client can drive it by link.MCP toolsConnect an agent, and the calls it uses to read and change your timeline without burning tokens.project.jsonThe whole edit in one file: canvas, markers, tracks, media and clips.Clip propsEvery property a clip can carry and its default. A key a clip leaves out falls back to these.CompositionsBuild a lower third, a logo sting or a whole scene once as a composition, then place it anywhere as one clip that moves, masks and grades like a picture, from the bin or by an agent with addComp, inComp and precompose.Media managementFile details, search, filters, sorting, tags and collections, where each file is used, relinking missing files, and proxies for heavy footage.ProjectsKeep many projects in one FableCut: a dashboard to open, create from a canvas or template, duplicate, rename, take notes on, tag, archive and delete them, and fablecut_projects for agents.VersionsSaved copies of a project you can compare and go back to, made by you, every few minutes, and before an agent edits; restoring is never destructive, and a backup carries them all.WorkflowsSave a routine you want repeated - steps in plain words plus the tool calls that did them - and have an agent follow it on the next project.SequencesSeveral timelines in one project - a 16:9 and a 9:16 cut, cut-downs, alternatives - sharing its media and compositions, each with its own canvas, mix and delivery settings.Editing rulesHow tracks, links, locks, targeting and the trim tools behave, for people and agents alike.Asset librarySound effects, overlays, fonts and animated SVGs that ship with the editor, and how to make your own.Audio mixHow clips reach the speakers and the export: clip gain, channels, track faders, the master, and loudness normalize.TranscriptsTurn speech into words with times, in the browser, then read, search and cut the edit like text: in the Transcript tab, or from an agent with fablecut_transcribe.CaptionsCaptions timed word by word from the transcript, in four styles, burned into the picture; SRT and WebVTT out and in.ColorGrade a clip with wheels, exposure, white balance and tone, and check it with scopes: in the Color workspace, or from an agent with setGrade and fablecut_scopes.MasksCut what a clip shows with rectangles, ellipses, bezier and free-hand shapes: feathered, expanded, inverted, combined and keyframed, from the monitor or from an agent with setMask.Track mattes and blendingCut a clip with the picture on another track by its alpha or its brightness, and lay clips over each other with blend modes, from the Inspector or from an agent with setMatte.TrackingFollow a point or a region through a video clip, then make a mask follow it or pin a title, sticker or another clip to it, from the Inspector or from an agent with fablecut_track.Shapes and parentingMotion graphics: vector shape layers with fills, strokes, groups and trim paths, null objects, parenting and the anchor point, keyframed on the monitor or by an agent with setShape and setParent.Motion pathsBend a clip's travel into a curve, turn it along the way, blur fast moves with a shutter angle, and set titles along lines, arcs, circles and drawn paths, on the monitor or by an agent with setMotionPath and setTextPath.Presets & templatesPut a ready-made entrance, exit, emphasis or loop on any clip, and place lower thirds, logo animations and social layouts whose text, colours and logo you fill in, from the bin and the Inspector or by an agent with applyPreset and addTemplate.RecipesShort answers for common edits: grades, captions, speed ramps, transitions and more, each one a few props away.Remake a referenceTurn a video you like into a blueprint of shots, beats and energy, then rebuild it with your own footage.Look at the footageShow an agent what the footage holds: one frame, a contact sheet across a clip, or the composed timeline - as an image, or as text-only measurements for models without vision.REST APIThe HTTP endpoints behind the editor, for scripts and tools that don't speak MCP.ExportThe three export engines, which range gets exported, and the ffmpeg encoding profiles.

Run#

node server.js        # → http://localhost:7777   (from npm: npx -y fablecut)

Files: index.html + style.css + app.js (editor UI), server.js (API + hosting), project.json (the timeline - THE file to edit), media/ (project footage), library/ (default asset library, see below).

How Claude Code edits a video#

  1. Ensure the server is running (background: node server.js, or fablecut_status).
  2. Put source files in ./media/ (copy them in, import via the UI / + URL, or fablecut_import_media with a local path or HTTPS URL).
  3. Read project.json, modify media / clips, increment revision, write it back.
  4. The browser UI (if open) reloads instantly. The user previews/exports from the UI.

Rules:

  • Prefer fablecut_set_project over direct file writes - it detects conflicts automatically (see the MCP section above). If you do write project.json directly, read it immediately before writing (never write from a stale read: if the user tweaked something in the UI between your read and write, that write destroys their changes). The UI detects external changes by revision comparison, so a write that does not bump revision is invisible to it.
  • Make each edit a single atomic write (read → modify → write once), and bump revision (integer). Partial multi-step edits can be picked up half-finished.
  • New media entries may omit duration - the browser probes it and writes it back. If you need the duration yourself, re-read project.json after a second or two, or probe with ffprobe.
  • Don't edit project.json while the UI may be mid-drag - the UI defers external reloads during gestures, then picks up the next change.
+
Studio (no install)The same editor at studio.fablecut.space, with nothing to install. It edits a folder on your own disk, and Claude Code, claude.ai, ChatGPT or any MCP client can drive it by link.MCP toolsConnect an agent, and the calls it uses to read and change your timeline without burning tokens.project.jsonThe whole edit in one file: canvas, markers, tracks, media and clips.Clip propsEvery property a clip can carry and its default. A key a clip leaves out falls back to these.CompositionsBuild a lower third, a logo sting or a whole scene once as a composition, then place it anywhere as one clip that moves, masks and grades like a picture, from the bin or by an agent with addComp, inComp and precompose.Media managementFile details, search, filters, sorting, tags and collections, where each file is used, relinking missing files, and proxies for heavy footage.ProjectsKeep many projects in one FableCut: a dashboard to open, create from a canvas or template, duplicate, rename, take notes on, tag, archive and delete them, and fablecut_projects for agents.VersionsSaved copies of a project you can compare and go back to, made by you, every few minutes, and before an agent edits; restoring is never destructive, and a backup carries them all.WorkflowsSave a routine you want repeated - steps in plain words plus the tool calls that did them - and have an agent follow it on the next project.SequencesSeveral timelines in one project - a 16:9 and a 9:16 cut, cut-downs, alternatives - sharing its media and compositions, each with its own canvas, mix and delivery settings.Editing rulesHow tracks, links, locks, targeting and the trim tools behave, for people and agents alike.Asset librarySound effects, overlays, fonts and animated SVGs that ship with the editor, and how to make your own.Audio mixHow clips reach the speakers and the export: clip gain, channels, track faders, the master, and loudness normalize.MusicOpenly licensed music and sound effects from Openverse, each with its licence spelled out; import a track and FableCut keeps its credit for the video's description.TranscriptsTurn speech into words with times, in the browser, then read, search and cut the edit like text: in the Transcript tab, or from an agent with fablecut_transcribe.CaptionsCaptions timed word by word from the transcript, in four styles, burned into the picture; SRT and WebVTT out and in.ColorGrade a clip with wheels, exposure, white balance and tone, and check it with scopes: in the Color workspace, or from an agent with setGrade and fablecut_scopes.MasksCut what a clip shows with rectangles, ellipses, bezier and free-hand shapes: feathered, expanded, inverted, combined and keyframed, from the monitor or from an agent with setMask.Track mattes and blendingCut a clip with the picture on another track by its alpha or its brightness, and lay clips over each other with blend modes, from the Inspector or from an agent with setMatte.TrackingFollow a point or a region through a video clip, then make a mask follow it or pin a title, sticker or another clip to it, from the Inspector or from an agent with fablecut_track.Shapes and parentingMotion graphics: vector shape layers with fills, strokes, groups and trim paths, null objects, parenting and the anchor point, keyframed on the monitor or by an agent with setShape and setParent.Motion pathsBend a clip's travel into a curve, turn it along the way, blur fast moves with a shutter angle, and set titles along lines, arcs, circles and drawn paths, on the monitor or by an agent with setMotionPath and setTextPath.Presets & templatesPut a ready-made entrance, exit, emphasis or loop on any clip, and place lower thirds, logo animations and social layouts whose text, colours and logo you fill in, from the bin and the Inspector or by an agent with applyPreset and addTemplate.RecipesShort answers for common edits: grades, captions, speed ramps, transitions and more, each one a few props away.Remake a referenceTurn a video you like into a blueprint of shots, beats and energy, then rebuild it with your own footage.Look at the footageShow an agent what the footage holds: one frame, a contact sheet across a clip, or the composed timeline - as an image, or as text-only measurements for models without vision.REST APIThe HTTP endpoints behind the editor, for scripts and tools that don't speak MCP.ExportThe three export engines, which range gets exported, and the ffmpeg encoding profiles.

Run#

node server.js        # → http://localhost:7777   (from npm: npx -y fablecut)

Files: index.html + style.css + app.js (editor UI), server.js (API + hosting), project.json (the timeline - THE file to edit), media/ (project footage), library/ (default asset library, see below).

How Claude Code edits a video#

  1. Ensure the server is running (background: node server.js, or fablecut_status).
  2. Put source files in ./media/ (copy them in, import via the UI / + URL, or fablecut_import_media with a local path or HTTPS URL).
  3. Read project.json, modify media / clips, increment revision, write it back.
  4. The browser UI (if open) reloads instantly. The user previews/exports from the UI.

Rules:

  • Prefer fablecut_set_project over direct file writes - it detects conflicts automatically (see the MCP section above). If you do write project.json directly, read it immediately before writing (never write from a stale read: if the user tweaked something in the UI between your read and write, that write destroys their changes). The UI detects external changes by revision comparison, so a write that does not bump revision is invisible to it.
  • Make each edit a single atomic write (read → modify → write once), and bump revision (integer). Partial multi-step edits can be picked up half-finished.
  • New media entries may omit duration - the browser probes it and writes it back. If you need the duration yourself, re-read project.json after a second or two, or probe with ffprobe.
  • Don't edit project.json while the UI may be mid-drag - the UI defers external reloads during gestures, then picks up the next change.
diff --git a/docs/docs/library/index.html b/docs/docs/library/index.html index d25834a5d..9fbd6e630 100644 --- a/docs/docs/library/index.html +++ b/docs/docs/library/index.html @@ -75,7 +75,7 @@

Examples in library/svg/: sparkles.svg (loop), lower-third.svg, confetti-burst.svg, underline-swoosh.svg (draw-on via stroke-dashoffset).

diff --git a/docs/docs/masks/index.html b/docs/docs/masks/index.html index 3fe29a4ce..dd12024e1 100644 --- a/docs/docs/masks/index.html +++ b/docs/docs/masks/index.html @@ -75,7 +75,7 @@
keydefaultdoes
shape-rect · ellipse · bezier (write freehand with a stroke to have one drawn for you)
x · y0.5centre, as fractions of the clip's picture (0…1, y down)
w · h0.5size, fractions of the picture's width / height (rect, ellipse)
points-bezier: 3–64 anchors around x, y, each [dx, dy] (a corner) or [dx, dy, inX, inY, outX, outY] (with curve handles relative to the anchor), all fractions of the picture's width / height
stroke-freehand only: [[u, v], …] picture fractions along an outline; it is simplified and stored as an editable bezier
scale · rotation1 · 0about the centre; degrees clockwise
modeaddhow this mask combines with the ones before it: add · subtract · intersect · difference
invertfalseuse everything outside the shape
opacity10…1, how strongly this mask counts
feather0soft edge, project pixels, centred on the outline
expand0grow (+) or shrink (−) the outline, project pixels
name · on-a label; on:false turns the mask off
keys-animate it: [{t, x?, y?, w?, h?, scale?, rotation?, feather?, expand?, opacity?, points?, ease?}], t in seconds from the clip's start; each param eases between the keys that set it (ease on the arriving key, as for clip keyframes). points keys morph the outline and need the shape's point count

Masks combine bottom-up (first in the list first). The first one starts from nothing when it adds and from the whole picture otherwise, so a lone subtract cuts a hole in a full picture. At most 8 masks per clip.

The picture a mask lives in is the clip's drawn rectangle for video, image and svg (after fit and crop), the text block for text, and the whole canvas for an adjustment layer. Masks follow the clip when it is moved, scaled, rotated or flipped, and keep the clip's keyframes.

In the editor, the Masks section of the Inspector has + Rect, + Ellipse, Pen (click points on the monitor, drag while placing one to pull curve handles, click the first point or press Enter to close) and Draw (drag a free-hand outline). Matte shows the clip's matte in the monitor (white = visible). Pick a mask's chip to edit it: mode, Invert, the sliders, ↑ ↓ to reorder, Copy, Delete, and on the monitor, drag inside to move it, the edge handles to resize it and the knob to rotate it (Shift snaps to 15°). On a bezier, drag a point to move it, drag its handles to curve it (Alt breaks the pair), Alt-drag a point to pull fresh handles, Ctrl-click the outline to add a point, and double-click a point to remove it. ◆ Key keys the whole mask at the playhead; once it has keys, every change keys. Esc steps back (point, then mask).

Agents edit masks with patch ops:

  • {op:"setMask", id, set:{shape:"ellipse", x:0.5, y:0.45, w:0.4, h:0.7, feather:40}} adds a mask (no mask, an index one past the end or a new name adds one; a new mask needs shape). {op:"setMask", id, mask:"Subject", set:{x:0.6}} edits one, by index (0 = first) or name, merging key by key (null resets a key). replace:true starts it over, keeping its name. ids:[…] edits several clips.
  • A drawn outline: set:{shape:"freehand", stroke:[[0.4, 0.3], [0.6, 0.32], …]}. It is stored as an editable bezier.
  • {op:"setMaskKeys", id, mask, keys:[{t:0, x:0.3}, {t:2, x:0.7}]} animates one (keys:null stops it); {op:"removeMask", id, mask} deletes one.
  • props.masks written through addClip / updateClip is validated the same way. Bad keys, shapes or values refuse the whole patch. Locks apply (force:true as elsewhere).
  • fablecut_scopes {time, mask:{clip}} measures them: the % of the clip's picture its masks keep (the feathered matte, measured alone) and the % of the frame the masked clip covers. The compact project view lists each clip's masks as [2 masks: ellipse feather 40, rect subtract].

Recipes: spotlight - a feathered ellipse on the clip; split screen - two clips on V1 / V2, a rect on the top one covering its half; cut a logo out of the background - a bezier around it, feather 2–4; reveal - a rect whose w (or x) keys from 0 to full; effects only on the face - an adjustment layer with a feathered ellipse, keyed to follow it; vignette through an adjustment layer - an inverted ellipse with feather:200 and the layer's brightness down.

diff --git a/docs/docs/mcp/index.html b/docs/docs/mcp/index.html index 782a103a8..58145afe1 100644 --- a/docs/docs/mcp/index.html +++ b/docs/docs/mcp/index.html @@ -75,12 +75,12 @@

MCP tools

Connect an agent, and the calls it uses to read and change your timeline without burning tokens.

-

Register the MCP server once at user scope as fablecut: claude mcp add -s user fablecut -- npx -y fablecut mcp (from npm, no path needed), or from a clone claude mcp add -s user fablecut -- node "<path-to>/fablecut/mcp-server.js". Every Claude Code session then has these tools:

  • fablecut_status - auto-starts the editor server, returns URL + project summary. Call first.
  • fablecut_docs - returns this document (section: "…" returns only matching ## sections).
  • fablecut_get_project / fablecut_set_project - read / replace the timeline JSON. fablecut_get_project {compact:true} returns a one-line-per-clip summary instead.
  • fablecut_patch_project - apply targeted ops (add/update/remove clip/media, set project fields, add and open sequences) without round-tripping the document. Prefer this for edits.
  • fablecut_import_media - copy a local file (or download an https:// URL) into ./media/ and register it. The stored src is always /media/….
  • fablecut_files - the real folders in ./media/: list one, make folders, move or rename files and folders, trash and restore (nothing is deleted). See Media management below.
  • fablecut_analyze_reference - turn a reference video into an edit blueprint (shots, beats, BPM, energy, drop) + extract its music. See Remake a reference video.
  • fablecut_frame - look at a moment and get back an actual image. {path, t} returns one frame of a source clip; {path, frames} returns a contact sheet across it; with no path, {time} renders the composed timeline. See Look at the footage below.
  • fablecut_encode_profiles - list the delivery presets (YouTube, Shorts, Reels, TikTok, X, LinkedIn, Master, Broadcast, Web, Archive, saved ones) and the raw ffmpeg encoding profiles from encoding-profiles.json. {preset:"youtube"} returns one preset's spec. See Export below.
  • fablecut_normalize_audio - measure clips (BS.1770 LUFS or sample peak, via ffmpeg) and set their clip gain to a loudness target. See Audio mix below.
  • fablecut_auto_duck - find where the voice tracks speak and write duck keyframes that dip the music under it. See Audio mix below.
  • fablecut_frame - see a moment. {path, t} → one JPEG frame of a source clip; {path, frames:12} → a contact sheet across it; {time} → the composed timeline, graded, as export renders it. Returns a real image, not numbers. See Look at the footage below.
  • fablecut_denoise - reduce background noise on audio clips (renders a cleaned copy of the file and switches the clip's stems to it). See Audio mix below.
  • fablecut_silence - find the pauses in speech and, with cut:true, cut them out (extract on the targeted tracks, stems in step). See Audio mix below.
  • fablecut_beats - find a music clip's tempo, beat and drop; mark the beats, snap the cuts to them, or re-cut a track's clips on the beat. See Audio mix below.
  • fablecut_reframe - reframe for another shape (9:16, 1:1, 4:5): a copy of the sequence on that canvas whose shots follow the subject. See Sequences below.
  • fablecut_highlights - the best moments of long footage cut into a short edit, in a new sequence. See Sequences below.
  • fablecut_transcribe - turn speech into words with times (Whisper, in the browser), read them on the timeline, find a phrase and cut it out. See Transcripts and text-based editing below.
  • fablecut_captions - caption clips from the transcript, timed word by word (subtitle, karaoke, highlight, word pop); export or import SRT / WebVTT. See Captions below.
  • fablecut_export - render the timeline to a file in exports/ with the editor's own Fast export (open tab, or headless Chrome / Edge). See Export below.
  • fablecut_scopes - measure the graded picture at a moment (levels, clipping, colour cast), as the editor's scopes see it; also what a grade layer or a clip's masks select. See Color and Masks below.
  • fablecut_track - motion tracking: follow a region of a video clip, store it as a track, and make a mask or another clip follow it. See Tracking below.
  • fablecut_proxy - make, check or delete proxies: light copies of heavy footage the editor plays while editing (export always reads the originals). See Media management below.
  • fablecut_projects - list, open, create (from a canvas or a saved template), duplicate, rename, annotate, archive and delete projects. ./project.json is always the open one. See Projects below.
  • fablecut_versions - a project's saved versions: save one before big edits, compare a version with now, restore one (never destructive), mark the final cut. See Versions below.
  • fablecut_workflows - saved workflows: recipes of steps (and the tool calls that did them) the user wants repeated on other projects. Save one, list them, show one and follow it. See Workflows below.

Token-efficient editing important for agents#

Editing via full get→modify→set costs thousands of tokens per change. Cheaper:

  1. Plan from fablecut_get_project {compact:true} (≈10× smaller than the JSON) and fablecut_status - fetch the full JSON only to inspect exact keyframes.
  2. Edit with fablecut_patch_project ops - send only what changes, e.g. {ops:[{op:"updateClip", id:"c_v2", set:{props:{filterPreset:"noir"}}}]}. It re-reads the latest document internally, so it is merge-safe by design (no CONFLICT dance) and never destroys concurrent UI tweaks. To also be sure the clips you touch haven't changed since you looked, pass baseRevision (the revision you planned from - fablecut_get_project, fablecut_status or the last "Patched (revision N)" result): if the project has moved past it, the patch is refused with "CONFLICT - not saved" and the current revision. Re-check the clips, then retry with that revision.
  3. Docs: request fablecut_docs {section:"schema"} (or Recipes, "Remake", …) instead of the whole manual; skip it entirely if the schema is already in context.
  4. Media questions (duration, resolution, fps, codec, audio channels, file size, how often it is used): read them from the registered media entries or the compact view's MEDIA lines - don't shell out to ffprobe; the editor probes every file and writes them back (see Media management). For what the footage looks like, use fablecut_frame - it is far cheaper than reading a file, and far more reliable than inferring from a number.
  5. Batch related changes into ONE patch call (ops apply in order, one revision bump).
  6. Cut and trim with the edit ops (next section) rather than recomputing start / in / duration by hand - they keep linked stems in sync.

Timeline edit ops fablecut_patch_project#

The editor's own split / ripple / trim code (edit-ops.js), run on the document - so linked audio stems ride along, edits land on the targeted tracks (untargetedTracks, see Semantics), and locked clips stay put, exactly as with the keyboard shortcuts. Times are seconds.

opdoes
{op:"split", at, ids?}cut at at - the named clips (and their stems), or every targeted track
{op:"rippleDelete", ids}remove clips; later clips on those tracks close the hole
{op:"closeGap", at}close the gap under at on every targeted track
{op:"lift" | "extract", from?, to?}remove a range (default: inPoint→outPoint, which then clear); extract also closes it
{op:"insert" | "overwrite", mediaId, at, in?, duration?}three-point edit: place in→in+duration of the media at at (default: the rest of the media). Insert pushes later clips right; overwrite replaces what is under it. A video brings one linked audio stem per channel.
{op:"rippleTrim", id, side:"in"|"out", delta}move a head / tail; everything after follows
{op:"roll", id, side, delta}move the cut between two clips; nothing else moves
{op:"slip", id, delta} · {op:"slide", id, delta}new source window in place · move a clip between its neighbors
{op:"crossfade", ids? | at, duration?}constant-power audio crossfade at the cuts touching ids, or the cut nearest at (handles borrowed from both sides)

Trims are clamped to the source media, the free room and MIN_DUR; the result note shows the applied delta (… (asked +5, clamped)). Any edit op takes tracks:[…] to target lanes for that op only, and force:true to edit locked material (only when the user asked). A refused op (nothing under at, a locked clip, a media window past the file's end) aborts the whole patch unsaved. setProject also sets inPoint / outPoint (null clears).

Example - cut the 2 s from 10 s to 12 s out of the edit, then crossfade the new cut: {ops:[{op:"extract", from:10, to:12}, {op:"crossfade", at:10, duration:0.5}]}

fablecut_set_project is conflict-checked. The MCP server remembers the revision from the most recent fablecut_get_project call. If project.json has been written by anyone else since that read (e.g. the user dragged a clip in the UI), fablecut_set_project refuses with a "CONFLICT - not saved" error instead of overwriting. Protocol:

  1. fablecut_get_project → read the document and note its revision.
  2. Apply your edits in memory, bump revision.
  3. fablecut_set_project → if it succeeds you're done.
  4. On conflict: call fablecut_get_project again to get the latest document, re-apply your intended changes on top of it, bump revision, and call fablecut_set_project again.

Pass force: true to fablecut_set_project only when the user explicitly asks to overwrite conflicting changes. fablecut_import_media only appends a new media entry and always merges safely - no conflict check needed.

For Claude Desktop, add to its MCP config: {"mcpServers":{"fablecut":{"command":"npx","args":["-y","fablecut","mcp"]}}} (or "command":"node","args":["<path-to>/fablecut/mcp-server.js"] from a clone) Direct file editing of project.json (below) works too and is equivalent.

Installing as a Claude Code plugin (/plugin marketplace add ronak-create/FableCut, then /plugin install fablecut@fablecut) does the registration for you.

Where the files are#

project.json, projects/, media/, exports/, analysis/ and library/ normally sit in the repo next to server.js; installed from npm (npx fablecut) they sit in ~/FableCut. Set FABLECUT_DATA_DIR to move all six somewhere else; the code and the static app files stay in the install directory either way. The plugin sets this so a plugin update can replace the install directory without touching anyone's timeline or footage. Don't assume project.json is beside mcp-server.js - call fablecut_status, which reports the real paths.

Tests (and nothing else) may set FABLECUT_NO_FS_WATCH=1 to skip fs.watch. On Windows, libuv can abort the process when a file is created under a temp data dir. Production leaves watching on so the UI live-reloads. Tests may also set FABLECUT_NO_AUTOSTART=1 so ensureUIServer() reports a missing editor server instead of spawning one - the auto-start is detached, so a test that triggers it would leave a server.js running after it finishes.

+

Register the MCP server once at user scope as fablecut: claude mcp add -s user fablecut -- npx -y fablecut mcp (from npm, no path needed), or from a clone claude mcp add -s user fablecut -- node "<path-to>/fablecut/mcp-server.js". Every Claude Code session then has these tools:

  • fablecut_status - auto-starts the editor server, returns URL + project summary. Call first.
  • fablecut_docs - returns this document (section: "…" returns only matching ## sections).
  • fablecut_get_project / fablecut_set_project - read / replace the timeline JSON. fablecut_get_project {compact:true} returns a one-line-per-clip summary instead.
  • fablecut_patch_project - apply targeted ops (add/update/remove clip/media, set project fields, add and open sequences) without round-tripping the document. Prefer this for edits.
  • fablecut_import_media - copy a local file (or download an https:// URL) into ./media/ and register it. The stored src is always /media/….
  • fablecut_files - the real folders in ./media/: list one, make folders, move or rename files and folders, trash and restore (nothing is deleted). See Media management below.
  • fablecut_analyze_reference - turn a reference video into an edit blueprint (shots, beats, BPM, energy, drop) + extract its music. See Remake a reference video.
  • fablecut_frame - look at a moment and get back an actual image. {path, t} returns one frame of a source clip; {path, frames} returns a contact sheet across it; with no path, {time} renders the composed timeline. See Look at the footage below.
  • fablecut_encode_profiles - list the delivery presets (YouTube, Shorts, Reels, TikTok, X, LinkedIn, Master, Broadcast, Web, Archive, saved ones) and the raw ffmpeg encoding profiles from encoding-profiles.json. {preset:"youtube"} returns one preset's spec. See Export below.
  • fablecut_normalize_audio - measure clips (BS.1770 LUFS or sample peak, via ffmpeg) and set their clip gain to a loudness target. See Audio mix below.
  • fablecut_auto_duck - find where the voice tracks speak and write duck keyframes that dip the music under it. See Audio mix below.
  • fablecut_frame - see a moment. {path, t} → one JPEG frame of a source clip; {path, frames:12} → a contact sheet across it; {time} → the composed timeline, graded, as export renders it. Returns a real image, not numbers. See Look at the footage below.
  • fablecut_denoise - reduce background noise on audio clips (renders a cleaned copy of the file and switches the clip's stems to it). See Audio mix below.
  • fablecut_silence - find the pauses in speech and, with cut:true, cut them out (extract on the targeted tracks, stems in step). See Audio mix below.
  • fablecut_beats - find a music clip's tempo, beat and drop; mark the beats, snap the cuts to them, or re-cut a track's clips on the beat. See Audio mix below.
  • fablecut_reframe - reframe for another shape (9:16, 1:1, 4:5): a copy of the sequence on that canvas whose shots follow the subject. See Sequences below.
  • fablecut_highlights - the best moments of long footage cut into a short edit, in a new sequence. See Sequences below.
  • fablecut_music - find openly licensed music and sound effects (Openverse), each with its licence, import one into the project, and list the credits the edit needs. See Music below.
  • fablecut_transcribe - turn speech into words with times (Whisper, in the browser), read them on the timeline, find a phrase and cut it out. See Transcripts and text-based editing below.
  • fablecut_captions - caption clips from the transcript, timed word by word (subtitle, karaoke, highlight, word pop); export or import SRT / WebVTT. See Captions below.
  • fablecut_export - render the timeline to a file in exports/ with the editor's own Fast export (open tab, or headless Chrome / Edge). See Export below.
  • fablecut_scopes - measure the graded picture at a moment (levels, clipping, colour cast), as the editor's scopes see it; also what a grade layer or a clip's masks select. See Color and Masks below.
  • fablecut_track - motion tracking: follow a region of a video clip, store it as a track, and make a mask or another clip follow it. See Tracking below.
  • fablecut_proxy - make, check or delete proxies: light copies of heavy footage the editor plays while editing (export always reads the originals). See Media management below.
  • fablecut_projects - list, open, create (from a canvas or a saved template), duplicate, rename, annotate, archive and delete projects. ./project.json is always the open one. See Projects below.
  • fablecut_versions - a project's saved versions: save one before big edits, compare a version with now, restore one (never destructive), mark the final cut. See Versions below.
  • fablecut_workflows - saved workflows: recipes of steps (and the tool calls that did them) the user wants repeated on other projects. Save one, list them, show one and follow it. See Workflows below.

Token-efficient editing important for agents#

Editing via full get→modify→set costs thousands of tokens per change. Cheaper:

  1. Plan from fablecut_get_project {compact:true} (≈10× smaller than the JSON) and fablecut_status - fetch the full JSON only to inspect exact keyframes.
  2. Edit with fablecut_patch_project ops - send only what changes, e.g. {ops:[{op:"updateClip", id:"c_v2", set:{props:{filterPreset:"noir"}}}]}. It re-reads the latest document internally, so it is merge-safe by design (no CONFLICT dance) and never destroys concurrent UI tweaks. To also be sure the clips you touch haven't changed since you looked, pass baseRevision (the revision you planned from - fablecut_get_project, fablecut_status or the last "Patched (revision N)" result): if the project has moved past it, the patch is refused with "CONFLICT - not saved" and the current revision. Re-check the clips, then retry with that revision.
  3. Docs: request fablecut_docs {section:"schema"} (or Recipes, "Remake", …) instead of the whole manual; skip it entirely if the schema is already in context.
  4. Media questions (duration, resolution, fps, codec, audio channels, file size, how often it is used): read them from the registered media entries or the compact view's MEDIA lines - don't shell out to ffprobe; the editor probes every file and writes them back (see Media management). For what the footage looks like, use fablecut_frame - it is far cheaper than reading a file, and far more reliable than inferring from a number.
  5. Batch related changes into ONE patch call (ops apply in order, one revision bump).
  6. Cut and trim with the edit ops (next section) rather than recomputing start / in / duration by hand - they keep linked stems in sync.

Timeline edit ops fablecut_patch_project#

The editor's own split / ripple / trim code (edit-ops.js), run on the document - so linked audio stems ride along, edits land on the targeted tracks (untargetedTracks, see Semantics), and locked clips stay put, exactly as with the keyboard shortcuts. Times are seconds.

opdoes
{op:"split", at, ids?}cut at at - the named clips (and their stems), or every targeted track
{op:"rippleDelete", ids}remove clips; later clips on those tracks close the hole
{op:"closeGap", at}close the gap under at on every targeted track
{op:"lift" | "extract", from?, to?}remove a range (default: inPoint→outPoint, which then clear); extract also closes it
{op:"insert" | "overwrite", mediaId, at, in?, duration?}three-point edit: place in→in+duration of the media at at (default: the rest of the media). Insert pushes later clips right; overwrite replaces what is under it. A video brings one linked audio stem per channel.
{op:"rippleTrim", id, side:"in"|"out", delta}move a head / tail; everything after follows
{op:"roll", id, side, delta}move the cut between two clips; nothing else moves
{op:"slip", id, delta} · {op:"slide", id, delta}new source window in place · move a clip between its neighbors
{op:"crossfade", ids? | at, duration?}constant-power audio crossfade at the cuts touching ids, or the cut nearest at (handles borrowed from both sides)

Trims are clamped to the source media, the free room and MIN_DUR; the result note shows the applied delta (… (asked +5, clamped)). Any edit op takes tracks:[…] to target lanes for that op only, and force:true to edit locked material (only when the user asked). A refused op (nothing under at, a locked clip, a media window past the file's end) aborts the whole patch unsaved. setProject also sets inPoint / outPoint (null clears).

Example - cut the 2 s from 10 s to 12 s out of the edit, then crossfade the new cut: {ops:[{op:"extract", from:10, to:12}, {op:"crossfade", at:10, duration:0.5}]}

fablecut_set_project is conflict-checked. The MCP server remembers the revision from the most recent fablecut_get_project call. If project.json has been written by anyone else since that read (e.g. the user dragged a clip in the UI), fablecut_set_project refuses with a "CONFLICT - not saved" error instead of overwriting. Protocol:

  1. fablecut_get_project → read the document and note its revision.
  2. Apply your edits in memory, bump revision.
  3. fablecut_set_project → if it succeeds you're done.
  4. On conflict: call fablecut_get_project again to get the latest document, re-apply your intended changes on top of it, bump revision, and call fablecut_set_project again.

Pass force: true to fablecut_set_project only when the user explicitly asks to overwrite conflicting changes. fablecut_import_media only appends a new media entry and always merges safely - no conflict check needed.

For Claude Desktop, add to its MCP config: {"mcpServers":{"fablecut":{"command":"npx","args":["-y","fablecut","mcp"]}}} (or "command":"node","args":["<path-to>/fablecut/mcp-server.js"] from a clone) Direct file editing of project.json (below) works too and is equivalent.

Installing as a Claude Code plugin (/plugin marketplace add ronak-create/FableCut, then /plugin install fablecut@fablecut) does the registration for you.

Where the files are#

project.json, projects/, media/, exports/, analysis/ and library/ normally sit in the repo next to server.js; installed from npm (npx fablecut) they sit in ~/FableCut. Set FABLECUT_DATA_DIR to move all six somewhere else; the code and the static app files stay in the install directory either way. The plugin sets this so a plugin update can replace the install directory without touching anyone's timeline or footage. Don't assume project.json is beside mcp-server.js - call fablecut_status, which reports the real paths.

Tests (and nothing else) may set FABLECUT_NO_FS_WATCH=1 to skip fs.watch. On Windows, libuv can abort the process when a file is created under a temp data dir. Production leaves watching on so the UI live-reloads. Tests may also set FABLECUT_NO_AUTOSTART=1 so ensureUIServer() reports a missing editor server instead of spawning one - the auto-start is detached, so a test that triggers it would leave a server.js running after it finishes.

Edit this in CLAUDE.md The whole manual as Markdown diff --git a/docs/docs/media/index.html b/docs/docs/media/index.html index 42e21dced..4f7c99ac6 100644 --- a/docs/docs/media/index.html +++ b/docs/docs/media/index.html @@ -75,14 +75,14 @@

Media management

File details, search, filters, sorting, tags and collections, where each file is used, relinking missing files, and proxies for heavy footage.

The Project bin knows each file's details and helps find, group and track footage. The bin's organizing (details, favorites, tags, collections, search) changes nothing that plays or exports; moving and trashing the files themselves ("Files on disk" below) does what it says.

Metadata. The editor reads every file in media/ and library/ with ffprobe (via GET /api/media-info) and writes what it finds onto the media entry. These fields are read-only - they describe the file:

keydoes
fpsvideo frame rate (29.97, 25, 59.94 …); absent for stills and audio
codecvideo codec (h264, hevc, prores, vp9 …), or the image format (png, mjpeg)
audioCodec · audioChannels · sampleRatefirst audio stream: codec, channel count (0 = the file has no audio), Hz
size · bitratefile size in bytes · overall bitrate, bits per second
width · height · durationas before; filled in when missing (phone footage shot rotated reports its upright size)

Without ffprobe on PATH only size is filled in; the browser still probes duration, width and height.

Organizing. favorite: true stars a file; tags is a list of free-form labels (at most 24, each up to 32 characters, matched without regard to case). collections at the top of the document group media across folders - a file can be in any number of them, while it sits in one folder (folderId).

Usage. A file's placements are the clips that show it, on the main timeline and inside every composition. A video and the audio stems linked to it count as one placement, so a shot used twice reads "used 2×".

In the editor, the Project tab has:

  • Search - every word must match the name, kind, extension, codec, resolution (3840x2160, 2160p) or a tag; #word matches tags only. Esc clears it.
  • Show - All media · ★ Favorites · Used in the edit · Unused · a kind · a collection · a tag. While searching or filtering, the bin lists the hits flat (each with its folder), with a count and Clear; a collection's view also has Rename and Delete (its media stay).
  • Sort - name (natural: shot 2 before shot 10), kind, duration, resolution, frame rate, codec, audio channels, file size or times used, with ↑ / ↓. Files missing a value sort last either way. Folders keep their tree; the sort applies inside each.
  • ☰ List view - one row per file with columns: name, duration, resolution, FPS, codec, audio, size and uses; click a column heading to sort by it. On a narrow bin the columns drop out right to left; widen the panel to see them all.
  • On each file: ☆ stars it, the uses badge opens its placements. Right-click a file → Open in Source, Find timeline instances (every placement, main timeline and comps, with track and time - click one to jump there, opening its comp if needed), Media info…, favorites, Tags…, Add to / Remove from a collection, New collection…, Remove from project.
  • Right-click a clip on the timeline → Reveal in project scrolls the bin to its file (or its comp), opening folders and clearing a search that hides it.

Offline media. A file is offline when its src names nothing under media/ or library/ - it was moved, renamed or deleted. The editor checks on load and whenever those folders change. An offline file's clips stay where they are: the timeline hatches them red (⚠ Offline), the monitor and the export draw a Media offline slate in the picture's place, and its audio is silent. The bin marks the file OFFLINE, says how many are missing, and the Show filter gains ⚠ Offline. The Export dialog warns before rendering one. Files under media/ may sit in subfolders (/media/archive/a.mp4).

  • Relink points a media entry at the same footage where it is now; clips keep their In points, edits and everything else. Right-click the file → Relink… (or Relink… on the offline banner for all of them). The dialog looks through media/ and library/ for each file - same name, the same name with another extension, a similar name, the same size - and picks a same-name match for you. Browse… picks one file and Choose folder… matches a whole folder by name; either copies the chosen files into media/. A relinked file whose length differs from the original gets a warning (is it really the same footage?).
  • Replace file… (right-click a file) puts a different file behind the media entry - a new render, a better take. Every clip using it switches; each keeps its In point and timing, trimmed to fit a shorter file. The name and details follow the new file; favorites, tags and collections stay. To swap the file of one clip only, use the Inspector's Source menu instead.
  • Relink and replace are one undo step each.

Proxies. Heavy footage - 4K, HEVC, ProRes, long phone clips - can stutter while you scrub and play. A proxy is a light copy the editor plays instead while you edit: H.264 at 540p (or 720p / 1080p, never larger than the source), a keyframe every 12 frames so seeking is quick, the source's own timestamps (frame for frame - no frames added or dropped) and its first audio stream. The edit always refers to the original: the timeline, project.json and every clip stay the same whether proxies are on or off.

Export always reads the originals, and so do fablecut_frame (timeline mode), fablecut_scopes, tracking and every other measurement - the players switch to the original files for the render and back afterwards. A proxy only changes how smoothly the preview runs, never the result.

  • Right-click a video in the bin → Create proxy (540p) / (720p); right-click the Project tab → Create proxies for N videos. ffmpeg makes them on the server one at a time in the background; the bin shows each file's progress (P 42%), then a green P once it is ready. Delete proxy removes one. The bin's list view has a Proxy column, Show has Has a proxy / Video without a proxy, and Media info says which file is playing.
  • The monitor's Proxy button turns proxy playback on and off (on by default; remembered in this browser). The Source monitor follows it too.
  • Proxies live in analysis/proxies/, a disposable cache: each is named after its source file and that file's size and modification time, so a re-rendered or replaced original simply has no proxy until you make a new one. Deleting the folder loses nothing but time. Proxies need ffmpeg.

Agents:

  • {op:"updateMedia", id | ids, set:{name?, favorite?, tags?, folderId?}, addTags?, removeTags?} - organize files (favorite:false unstars; tags:[] clears). Metadata keys are refused: they come from the file.
  • {op:"setCollection", id?, name?, media?, add?, remove?} creates a collection (a new id, or a name no collection has) or changes one: media replaces its list, add / remove edit it. {op:"removeCollection", id} deletes it; its media stay. removeMedia takes a file out of every collection.
  • The compact view lists each file with its metadata, ★, tags, folder and uses:N, and the collections on one line: m_abc video "intro.mp4" 12.4s 1920×1080 29.97 fps h264 stereo 48 kHz 45 MB ★ #interview uses:2.
  • fablecut_import_media probes the file as it imports it, so the entry it returns already has these fields.
  • fablecut_status lists offline media, and the compact view marks each OFFLINE (file missing — relinkMedia) and each video with a proxy proxy:540p.
  • fablecut_proxy {} reports every video's proxy; {create:true, mediaIds?, height?} makes them (waits until done unless wait:false); {delete:true, mediaIds?} removes them. Proxies never change what you measure or export, so an agent only needs them when the user asks for smoother playback.
  • {op:"relinkMedia", id, src:"/media/…", name?} - the same footage found elsewhere: put the file in media/ (copy it, or fablecut_import_media and removeMedia the extra entry it registers), then relink. The note warns when the new file's length differs.
  • {op:"replaceMedia", id, src, name?} - a different file behind the entry; clips keep their timing, trimmed to fit (the note says how many). src must be an existing file under /media/ or /library/ of the same kind (an audio entry may use a video container).

Files on disk. The bin's folders (folders, folderId) only organize entries in project.json; the files themselves sit in media/ and may live in subfolders. fablecut_files works on those (or POST /api/files):

  • {action:"list", dir?} (an empty call to the MCP tool lists too) lists one folder: its subfolders and files with sizes and srcs. Dot-folders (media/.trash/) are left out.
  • {action:"mkdir", dir:"b-roll/day 1"} makes a folder (and its parents).
  • {action:"move", from, to} moves a file or folder into an existing folder, or to a new path (a rename); to is required ("/media/" is the top of media/). Every project's media entries that point at a moved file are repointed (the open project gets a new revision, so the editor reloads), a media name that was the old file name follows it, and the file's transcript goes with it (a warning says when one couldn't be). The move is refused while a project can't be read (force:true moves anyway, and the file goes offline there), and a project edited meanwhile stops it (CONFLICT, try again). If a project can't be written, the move is undone; if undoing fails too, the error says where the files are and which project couldn't be put back: check them there and relink. A name that is taken (also one taken while the move runs), and links inside media/, are refused, never replaced.
  • {action:"trash", paths:[…]} moves files or folders into media/.trash/<id>/files/ with a note of where they were; nothing is deleted. A file a project still uses is refused (the reply names the project and how many clips place it): removeMedia it first, or force:true to trash it anyway, and it shows as offline there until it is restored. A project whose project.json can't be read counts as possibly using it, so the same applies. One call can't list a folder and something inside it. When one of several fails, the reply lists the ones already trashed, with their ids, and the path it stopped at. {action:"trash-list"} lists the trash, {action:"restore", id} puts one back where it was (refused while something else has that name; a warning says when its trash entry couldn't be cleaned up).
  • Move, rename and trash only when the user asked: they change the user's folder. Versions keep the paths they were saved with, so restoring an old version after a move may need Relink.
diff --git a/docs/docs/motion-paths/index.html b/docs/docs/motion-paths/index.html index 35d1028f0..eac382361 100644 --- a/docs/docs/motion-paths/index.html +++ b/docs/docs/motion-paths/index.html @@ -75,7 +75,7 @@

In the editor: when the selected clip has two or more position keys, its path shows on the monitor: the curve, a dot per frame (their spacing is the speed), a square per key and the keys' handles. Drag a key to move it, drag a handle to bend the path (Alt breaks the pair), Alt-drag a key to pull new handles, and double-click a key to make it a corner again. Moving the clip on the monitor or typing X / Y keys both channels together. The Inspector's Motion section has Smooth (handles through every position key), Straight, Auto-orient, Motion blur and Blur samples. A title's Text path section sets it on a Line, Arc, Circle, Wave or a Pen path (click points, drag to curve, Enter to finish, click the first point to close it). Edit path shows the path's points on the monitor, and Offset and Align place the text along it.

Agents:

  • Write pin / pout on x / y keys directly, or {op:"setMotionPath", id | ids, path:"smooth" | "straight", autoOrient?: true}. "smooth" needs the position keys first (x and y keyed together at two or more times).
  • Motion blur: updateClip with props:{motionBlur:180, motionBlurSamples:12}.
  • {op:"setTextPath", id | ids, path:"line" | "arc" | "circle" | "wave" | {type:"path", points:[…], closed:false, …} | null, offset?, align?} sets, replaces or removes (null) a title's path; animate pathOffset with keyframes.
  • These are validated on addClip / updateClip too. The compact view shows path:curved after a clip's keyframes, and a title's "textPath":"ellipse 300×300".

Recipes: fly-in on a curve - two position keys, setMotionPath smooth, autoOrient:true, motionBlur:180; orbiting label - circle textPath, pathOffset keyed 0 → 100 linear; stamp along a road - an open path textPath that follows the shape in the footage, pathAlign:"center", textAnim:"letter-pop"; whip without the transition - a fast x move over 4–6 frames with motionBlur:360.

diff --git a/docs/docs/motion/index.html b/docs/docs/motion/index.html index 34ec077cb..b4e46608a 100644 --- a/docs/docs/motion/index.html +++ b/docs/docs/motion/index.html @@ -75,7 +75,7 @@
keydefaultdoes
typerectrect · ellipse · polygon · star · line · path · group
x · y0position in layer px, from the layer's origin (the clip's x/y, y down)
rotation · scale · opacity0 · 1 · 1about the item's own x, y
w · h200size, px (rect, ellipse, polygon, star)
radius0rect corner radius, px
sides · inner6 / 5 · 0.5polygon / star point count (3–64); a star's inner radius as a fraction of the outer
points-line: exactly 2 · path: 2–128 points [x, y] or [x, y, inX, inY, outX, outY] (curve handles relative to the point), px around the item's x, y
closedtruepath only; false leaves it open (lines are always open)
fill · stroke#ffffff · none"#rrggbb", "#rrggbbaa" or "none"; lines and open paths default to a white stroke and no fill
strokeWidth6 (8 open)px; set with stroke
lineCap · lineJoinround · roundbutt · round · square / miter · round · bevel
dash-[on, off, …] px, e.g. [24, 12]
trimStart · trimEnd0 · 100the part of the outline drawn, % - key trimEnd 0→100 to draw a path on
trimOffset0% of the outline the drawn part is shifted round by (key it to make a dash run round a loop)
items-group only: its items. A group moves, turns, scales, fades and trims them together (groups nest 4 deep)
name · on-a label (agents address items by it); on:false hides it
keys-[{t, ease?, …}], t in seconds from the clip's start. Keyable: x y rotation scale opacity w h radius inner strokeWidth trimStart trimEnd trimOffset fill stroke points. Each value eases between the keys that set it (ease on the arriving key); colours blend; points keys morph the path and need its point count

At most 64 items per layer (group children included). The layer itself is a normal visual clip: its x, y, scale, rotation, opacity, blend, masks, transitions and keyframes all work, as do blur and shake. Its own trimStart / trimEnd / trimOffset (clip props, keyframable) trim every path in it at once. A trimmed shape fills the part that is drawn.

Null objects. kind:"null" (no mediaId) is a clip that never renders. Give it x, y, rotation, scale (and keyframes), and parent clips to it to move them as one. The monitor shows it as a red square while it is on screen.

Parenting. "parent": "<clip id>" (top-level, next to track) makes a clip move, turn and scale with that clip. Its own x/y are then measured in the parent's space: from the parent's centre, turned and scaled with it. Parents chain (a parent can have a parent), and loops are refused. Only the transform follows: the parent's opacity, transitions, shake and effects do not, and the parent's keyframes are read even outside its time range (held at its first or last value). Splitting a parent leaves the children on the left half.

Anchor point. anchorX / anchorY (px from the picture's centre, for any visual clip) pick the point that x/y place and that rotation and scale turn around: anchorY: 200 on a 400 px tall shape spins it about its bottom edge. Moving the anchor without moving the picture means changing x/y with it (the editor's anchor tool does that).

In the editor: the bin's Shapes tab adds a rectangle, ellipse, polygon, star, line or pen-path layer, or a null object, at the playhead. The Shape layer section lists the items; pick one to edit it - the sliders, Fill / Stroke (colour or None), ends and joins, trim, Group / Ungroup / Out, ↑ ↓, Copy, Delete - and on the monitor drag it to move, the knob to turn it (Shift: 15°) and the corners to resize it. On a line or path, drag points and their handles (Alt breaks the pair, Alt-drag pulls new handles); on a path, Ctrl-click the outline to add a point and double-click one to remove it. Pen draws a new path: click points (drag to curve), click the first point to close it or press Enter to keep it open. Each value has its own ◆: key it at the playhead, and from then on changing it keys it. Every visual clip's Transform section has Anchor (✥ Move: drag on the monitor to move the anchor point while the picture stays put, Shift snaps to the centre; Centre puts it back) and Parent. Right-click clips → Parent to a new null groups them under a fresh null at their centre.

Agents:

  • Add a layer with addClip {kind:"shape", track, start, duration, props:{shapes:[…]}}, a null with addClip {kind:"null", track, start, duration, props:{x, y}}.
  • {op:"setShape", id, set:{type:"rect", w:400, h:80, fill:"#ffd166"}} adds an item (no shape, an index one past the end or a new name adds one; a new item needs type). {op:"setShape", id, shape:"Bar", set:{fill:"#22d3ee"}} edits one - by index (0 = first), name, or a path into groups like "2.0" (item 0 of group 2; "2.3" with 3 items adds one there) - merging key by key (null resets a key; a new type keeps the position and paint). replace:true starts it over. keys in set replaces its keys. {op:"removeShape", id, shape} deletes one. ids:[…] edits several clips.
  • {op:"setParent", id | ids, parent:"c_null"} parents clips and keeps them where they are on screen (at time at, default each clip's start; keyed channels are left as they are). keep:false keeps the numbers instead. parent:null unparents. Removing a parent clip unparents its children where they stand.
  • props.shapes and parent written through addClip / updateClip are validated the same way; bad input refuses the whole patch. The compact view lists a layer as [3 shapes: rect #ffd166 2 keys, line stroke #ffffff/6, group(star(5) #ff7ac8)] and a child as parent:c_null.

Recipes: draw-on logo - the logo as path items with a stroke and no fill, trimEnd keyed 0→100 (stagger the items' keys), then fill keyed from "#ffffff00" to "#ffffff"; lower third - a rect bar whose w keys from 0, a line drawn on under it, a title on the track above parented to the shape layer so they slide out together; loading ring - an ellipse with a stroke, trimEnd: 25, trimOffset keyed 0→100 with ease:"linear"; orbit - a null at the centre with rotation keyed 0→360, a shape parented to it with x: 300; swing from the top - anchorY at the top edge (minus half the height) and rotation keyed −10↔10; burst - a group of lines at different rotations with scale keyed 0→1 and opacity 1→0.

diff --git a/docs/docs/music/index.html b/docs/docs/music/index.html new file mode 100644 index 000000000..bdf4a70a6 --- /dev/null +++ b/docs/docs/music/index.html @@ -0,0 +1,120 @@ + + + + + +Music - FableCut docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

Music

+

Openly licensed music and sound effects from Openverse, each with its licence spelled out; import a track and FableCut keeps its credit for the video's description.

+

The bin's Music tab and fablecut_music find music and sound effects that may be used in a video: openly licensed tracks from Openverse (openverse.org), which indexes Jamendo, Freesound, ccMixter, Wikimedia Commons and more. Results show every licence, not only the free ones, and each result says what its licence allows. FableCut is made with Openverse but isn't endorsed or certified by it. The licence is the artist's, and Openverse doesn't check it, so the person publishing the video is the one who must respect it.

licencelabelmay it go in a video?
cc0 · pdmfree to useyes, any use; no credit needed
bycredityes, any use; credit the artist
by-sacredit · share alikeyes; credit, and the video is shared under CC BY-SA too
by-nc · by-nc-sacredit · non-commercialnot in ads, sponsored or monetized videos; credit (NC-SA: share alike too)
by-nd · by-nc-ndno editsno: Creative Commons counts music set to video as a derivative
sampling+ · nc-sampling+credit · non-commercialparts may be sampled and remixed; the whole track only non-commercially

Search with words about the music (mood, genre, instrument: "chill lo-fi piano"); leave the words out to see the newest tracks. Music comes from the music category, sound effects from Freesound. Lengths are Openverse's: under 30 s, 30 s – 2 min, 2 – 10 min, over 10 min. Without an account Openverse answers 20 results a page, 240 per search and about 20 searches a minute and 200 a day per address. The search runs from the editor tab (or the MCP server) straight to Openverse, and the file goes through the editor server's URL import into media/.

An imported track keeps its licence on its media entry, so the credits can be listed later:

{ "id": "m_x", "name": "Cinematic — Jahzzar", "kind": "audio", "src": "/media/Cinematic%20-%20Jahzzar.mp3",
+  "license": { "code": "by-sa", "label": "CC BY-SA 3.0", "url": "https://creativecommons.org/licenses/by-sa/3.0/",
+    "title": "Cinematic", "creator": "Jahzzar", "page": "https://www.jamendo.com/track/918921",
+    "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } }

The credits are every licensed file the edit uses (main timeline, comps and other sequences; a denoised copy counts as its original), one line each: "Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921, with a warning for a licence that limits the video (non-commercial, share alike, no derivatives). They go in the video's description.

In the editor: the bin's Music tab has the search box, Music / Sound effects, a length, OK to monetize (only licences that allow commercial use and edits), and mood chips to start from. Each result shows its artist, length, genres, source, a licence badge (green: free to use, blue: credit, amber: non-commercial, red: no edits; hover for what it allows, click for the licence) and a link to its page. ▶ previews it, ⬇ imports it into the Project bin, + (or a double-click) imports it and adds it at the playhead. More results loads the next page. A file's Media info shows its licence and credit with Copy credit, and the Export dialog lists the edit's music credits with Copy. Importing needs the editor server (or Studio).

Agents use fablecut_music:

  • {query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?} searches: 20 tracks a page, each id "title" — artist · m:ss · licence [flags] · genres · source. commercial:true keeps licences that allow commercial use, edits:true leaves out ND; pass both when the video will be monetized.
  • {import:"<track id>"} downloads it into media/ (named "Title - Artist") and registers it with its license; the reply gives the licence, the credit and an addClip to place it. Then fablecut_beats {clipId} finds its tempo, retime cuts to it, and fablecut_auto_duck dips it under speech.
  • {credits:true} lists the edit's credits and licence warnings. fablecut_export adds them to its reply when the edit uses licensed music.
  • Say which licence a track has before the user publishes, and search with commercial:true, edits:true when they plan to monetize. Import what the user picked, or the best fit when they asked you to choose. The compact view shows an imported file's licence:"CC BY 3.0".

Recipes: music under a reel - search the mood with length:"short", import one, place it on A1, fablecut_beats {clipId, retime:{every:2}}; a whoosh on every cut - kind:"sfx", query:"whoosh", import a CC0 one, place it just before each cut; music for a sponsored video - commercial:true, edits:true, and give the user the credits from the reply.

+ + +
+ +
+ + + + + + diff --git a/docs/docs/presets-templates/index.html b/docs/docs/presets-templates/index.html index f28d86375..2141e5953 100644 --- a/docs/docs/presets-templates/index.html +++ b/docs/docs/presets-templates/index.html @@ -75,7 +75,7 @@

Animation presets and templates

@@ -88,7 +88,7 @@

Animation presets and templates

{ "key": "name", "label": "Name", "type": "text", "targets": [ "name:props.text" ], "value": "Ava Moreno" }, { "key": "accent", "label": "Accent", "type": "color", "targets": [ "bar:props.shapes.1.fill" ], "value": "#ffd166" } ] } }
templatenamesizelengthfields
lower-third-barLower third - Bar1920×10805 sname title accent panel
lower-third-underlineLower third - Underline1920×10805 sname title accent
lower-third-boxesLower third - Boxes1920×10805 sname title accent box
logo-ringLogo - Ring reveal1920×10804 slogo brand accent
logo-slamLogo - Slam1920×10803.5 slogo accent
logo-linesLogo - Lines1920×10804 slogo tagline lines
social-storyStory - Headline (9:16)1080×19206 sheadline subline button accent background
social-quotePost - Quote (1:1)1080×10806 squote author accent background
social-end-cardEnd card - Follow (16:9)1920×10806 sheading button accent background

Field types: text (a string), color (#rgb, #rrggbb or #rrggbbaa) and media (a media id of a picture: image, svg or video; the clip's kind follows it). A target is "<clip id>:<path>" inside the comp (props.text, props.shapes.1.fill, mediaId, …) or "comp:background"; one field can set several. The logo templates start with a placeholder, /library/elements/logo-placeholder.svg, until the logo field gets a picture. hold is when the exit starts: changing a template's length keeps everything after it at the same distance from the end, so a longer lower third just holds longer (it can't get shorter than its entrance needs).

A saved template (library/templates/<id>.json) is a template object: {id, name, group, width, height, duration, hold, background?, tracks?, clips, media?, fields}; media lists the {id, name, kind, src} entries its clips use (/library/… or /media/…), matched by src when it is placed. A saved preset or template whose name a built-in already has is saved as "<name> (saved)".

In the editor: the bin's Templates tab lists them by group (Lower thirds, Logo animations, Social, then Saved); drag one onto the timeline or click +. The Inspector's Template section on its clip edits the fields, its Length, and offers Use W×H canvas when the template was made for another shape. Right-click a comp in the Project tab → Save as template keeps it (every title's text and every picture become fields). The Motion section's Presets menus (In, Out, At playhead, Loop) put a preset on the selected clips, and Save as preset keeps this clip's keyframes (In: from its start to its last key; Out: from its first key to its end; Loop: the whole clip).

Agents:

  • {op:"applyPreset", id | ids, preset, length?, at?} - preset is a name, a saved one's id, or an inline preset object; at is timeline seconds (for an At preset; default the clip's start). Visual clips only.
  • {op:"addTemplate", template, start?, track?, duration?, fields?:{key: value}, id?, compId?, name?} places one (default track V2, at 0, its own length).
  • {op:"setTemplate", id, fields?:{key: value}, duration?} - id is its comp clip or its comp; a new duration retimes it, and clips that showed it to its end keep doing so.
  • {op:"savePreset", id, name, anchor?, from?, to?} (from/to in clip seconds) or {op:"savePreset", preset:{…}}; {op:"saveTemplate", comp, name?, fields?, hold?} or {op:"saveTemplate", template:{…}}. Files are written once the patch is saved, and later ops in the same patch can use them.
  • applyPreset, addTemplate and setTemplate also run inside inComp.
  • The compact view prints a placed template's fields under its comp: template lower-third-bar — fields (setTemplate): name="Ava Moreno" ….

Recipes: name every speaker - addTemplate lower-third-bar once per speaker with fields:{name, title}; branded intro - addTemplate logo-ring with fields:{logo:"<your logo's media id>", brand, accent} at 0; vertical teaser - set the canvas to 1080×1920, addTemplate social-story; house style - build a comp the way you like it, saveTemplate, then place it in every project; titles that arrive and leave the same way - applyPreset an In and an Out on every title in one patch.

diff --git a/docs/docs/project-json/index.html b/docs/docs/project-json/index.html index e718d61b0..67ae12342 100644 --- a/docs/docs/project-json/index.html +++ b/docs/docs/project-json/index.html @@ -75,7 +75,7 @@ diff --git a/docs/docs/projects/index.html b/docs/docs/projects/index.html index 48be9083a..8fa2701fc 100644 --- a/docs/docs/projects/index.html +++ b/docs/docs/projects/index.html @@ -75,14 +75,14 @@

Projects

Keep many projects in one FableCut: a dashboard to open, create from a canvas or template, duplicate, rename, take notes on, tag, archive and delete them, and fablecut_projects for agents.

One FableCut keeps any number of projects. ./project.json is always the open project: the editor, every MCP tool, the REST API and scripts read and edit that file as before. The others wait in projects/, and opening one swaps it in:

pathholds
projects/index.json{active} - the open project's id
projects/<id>/meta.json{id, created, opened, archived, notes, tags, template?}
projects/<id>/project.jsonthe document (while that project is open, ./project.json is the live copy)
projects/<id>/thumb.jpgthe editor's last picture of it
library/project-templates/<id>.jsona saved project template {name, created, project}

media/, exports/, analysis/ and library/ are shared by every project, so a duplicate or a project made from a template copies no footage. The first time projects are used, the existing ./project.json becomes the first project, unchanged. Ids look like p_3f9a01c2de.

Opening a project saves the open one into its folder, then copies the chosen one to ./project.json with a revision above both. A save based on the project that was open before (an editor tab, an agent's fablecut_set_project, a baseRevision patch) is therefore refused as a CONFLICT instead of landing in the wrong project. Editor tabs reload, clear their undo history and close an open composition. GET /api/project names the open project in the X-FableCut-Project header, and the editor sends it back on every save, so an edit made for one project can never be written into another.

In the editor: Projects in the top bar (Ctrl/Cmd+O, or a click on the project name) opens the dashboard: cards with a picture, size, frame rate and length; search by name, notes or #tag; sort by last opened, last modified, created or name. Pick one to rename it, write notes, tag it, Open (or double-click / Enter on its card), Duplicate, Save as template or Archive it. Archived lists archived projects, where Unarchive brings one back and Delete… (click twice) removes it; only archived projects can be deleted, and the open one can be neither archived nor deleted. + New project starts one from a canvas (Landscape 16:9 1080p, Vertical 9:16, Square 1:1, Portrait 4:5, 4K UHD, Landscape 720p) or a saved template, with its own frame rate. Import… adds a project file from elsewhere (an old backup, another machine); its media must be in media/, and Relink finds files that moved.

Agents use fablecut_projects (or GET /api/projects, POST /api/projects):

  • {} or {action:"list", archived?:"only"|"all"} lists them: id, name, size, length, clips, tags, notes, and which is (OPEN).
  • {action:"open", id} switches the editor to that project; re-read it with fablecut_get_project {compact:true} before editing.
  • {action:"new", name, template?, fps?, width?, height?, notes?, tags?, open?} - template is landscape-1080 (default), vertical-1080, square-1080, portrait-1350, uhd-4k, landscape-720 or a saved template's id; it opens unless open:false.
  • {action:"duplicate", id, name?, open?} · {action:"update", id, name?, notes?, tags?} · {action:"archive" | "unarchive" | "delete", id}.
  • fablecut_status also counts the open project's versions; see Versions for them.
  • {action:"templates"} · {action:"save_template", id, name} (the project's canvas, tracks, clips and media references) · {action:"delete_template", template}.
  • Opening, archiving or deleting changes what the user sees: do it only when they asked. fablecut_status says how many projects there are.

Recipes: one edit, three versions - duplicate the project per client cut, put the brief in notes; house canvas - build an empty project with your tracks, intro and outro, save_template, then new from it for every episode; park finished work - archive delivered projects to keep the list short without deleting anything.

diff --git a/docs/docs/props/index.html b/docs/docs/props/index.html index d82dc167b..17b074d77 100644 --- a/docs/docs/props/index.html +++ b/docs/docs/props/index.html @@ -75,14 +75,14 @@

Clip props

Every property a clip can carry and its default. A key a clip leaves out falls back to these.

Transform & compositing all visual kinds#

propdefaultnotes
x, y0px offset from canvas center
scale1
rotation0degrees
opacity10–1
anchorX, anchorY0anchor point, px from the picture's centre: the point x/y place and rotation/scale turn around
autoOrientfalseturn the clip with its direction of travel along its motion path (rotation adds on top)
motionBlur · motionBlurSamples0 · 8motion blur: shutter angle in degrees (0 = off, 180 = film look, up to 720) · sub-frame samples 2–32
blend"normal"how the clip lays over what is under it (see Track mattes and blending)
matte · matteTrack-a track matte (see Track mattes and blending)

Layout video/image/svg#

propdefaultnotes
fit"contain"contain · cover (fill canvas, crop overflow) · stretch · none (native px)
cropL cropR cropT cropB0% of the source trimmed off each edge
cornerRadius0px, rounded corners - the PiP look
reframe-set by Reframe ("follow" or "centre"): the clip's fit and position are Reframe's own, so running it again replaces them (see Sequences)
flipH, flipVfalsemirror

Filter / color video/image/svg#

propdefaultnotes
filterPreset"none"one of: cinematic · teal-orange · noir · vintage · faded · warm · cold · pop · dreamy · retro · bw-soft · cyberpunk · sunset · midnight. Combines non-destructively with the sliders below.
brightness contrast saturation100% (100 = neutral)
hue0degrees
temperature0−100 (cool blue) … +100 (warm orange)
tint0−100 (magenta) … +100 (green)
blur0px
grayscale sepia invert vignette0%

These are quick looks. For real grading use props.grade (see Color below).

Motion FX video/image/svg/adjust - all animatable#

propdefaultnotes
shake0camera-shake amplitude in px (deterministic - identical in export)
shakeSpeed8shake frequency
rgbSplit0chromatic aberration / RGB channel split, px
grain0animated film grain, %

Keying / cut-out video/image#

propdefaultnotes
chromaKey""hex key color, e.g. "#00ff00" for green screen ("" = off)
chromaTolerance260–100, how much color distance is keyed out
chromaSoftness120–100, edge feather + spill suppression
bgRemovefalseAI person cut-out (MediaPipe, loads from CDN on first use; needs internet once)

Audio / time video/audio#

propdefaultnotes
volume10–2 (linear; animatable - fades, ducking)
gain0clip gain in dB (−60…+24), applied before volume, so keyframes and fades ride on top. Set by Normalize.
channelMode"stereo"stereo · mono (L+R folded to one channel) · left · right (use one side) · swap (exchange L/R). Ignored on linked stems - audioChannel already picks their channel.
duck0ducking in dB (≤ 0), multiplied into volume. Normally keyframed by Auto-duck (keyframes.duck), so the clip's own volume, keyframes and fades are untouched.
pan0−1 (full left) … 0 (center) … +1 (full right). Linked stems default L −1 / R +1 / other 0. Projects saved before pan migrate once on load (panSchema); keep panSchema: 1 (and explicit pan on stems) when rewriting the document so a centered stem is not re-hard-panned.
speed10.25–4× playback rate. Keyframable → speed ramps: with keyframes.speed the engine time-remaps (media time = in + ∫speed dt), in preview and in the export audio mix. Static case: source window consumed = duration × speed, so in + duration×speed ≤ media.duration.

Text clips only#

propdefaultnotes
text"Title"\n for multi-line
fontSize72px
color"#ffffff"fill
color2""if set: vertical gradient fill color→color2
font"Segoe UI"system font, a library/fonts family, or ANY Google Font name - unknown names are fetched from Google Fonts automatically
bold / weighttrue / 0weight (300–900) overrides bold when non-zero
italic uppercasefalse
align"center"left · center · right · justify (inserts spaces between words to fill the text box width, or ~85% of the canvas when no box)
boxW boxH0px text box; 0 = hug content. When both > 0, corner handles resize the box (not scale). Default: fixed fontSize, word-wrap inside the box.
boxFitfalsewhen a box is set: false = wrap at fixed font size; true = scale font down (up to fontSize) so the whole text fits
vAlign"middle"top · middle · bottom - vertical alignment of the text block inside the box
direction"auto"auto · ltr · rtl - auto detects per line (Hebrew/Arabic → RTL); all textAnim modes honor reading direction (wipe, typewriter reveal, word/letter layout)
letterSpacing0px
lineHeight1.2multiplier
textShadow12soft drop shadow amount, 0 = off
glow0neon glow strength (0–100); replaces the drop shadow
glowColor""glow color ("" = use the text color)
strokeWidth strokeColor0, "#000"text outline
bgColor bgOpacity"#000", 0rounded pill behind each line
textAnim"none"typewriter · word-pop · word-slide · karaoke · highlight (every word shown; the one being said in highlightColor) · letter-pop (per-character entrance; Arabic/Indic auto-fallback to per-word clusters so joined letters shape correctly) · wave (looping per-character ride; same shaping fallback) · bounce (looping per-word hop) · shake (looping jitter) · clip-reveal (wipe-mask sweep, per line) · zoom-in (scale + opacity settle) · font-cut (rhythmically swaps typeface, then settles - see fontCutSet) · rise-mask (line rises from behind its baseline, lower-third reveal)
wordRate0.15seconds per word (typewriter: /4, letter-pop: /3 per character); also staggers clip-reveal/zoom-in/rise-mask per line
wordTimes-[[start, end], …], one pair per word (seconds from the clip's start): word-pop, word-slide, karaoke and highlight follow these instead of wordRate - a caption timed to speech. If the text is edited to another number of words they are spread over the clip. See Captions
highlightColor"#ffd166"the colour of the word being said in highlight
caption · captionStyle-set on caption clips (see Captions): how they are found, replaced and exported
textPath-set the title along a path: one shape item (path, line, ellipse, rect, polygon, star) whose outline is the baseline; more lines follow on parallel curves below it. See Motion paths, motion blur and text on a path
pathOffset · pathAlign0 · "start"where along the path the text sits (% of its length, keyframable, wraps on closed paths) · which end of the text sits there: start · center · end
fontCutSet(curated)array of font family names cycled by font-cut, e.g. ["Anton","Bebas Neue","Archivo Black","Oswald"]; each is auto-loaded

Title styles one-tap cohesive looks#

Text clips created in the UI now rotate through curated styles so titles vary instead of all looking basic (the old flat Segoe UI / no-animation default). Each style bundles a different font, placement and animation. Apply one in the inspector (Title style dropdown + Shuffle), or reproduce it from an agent by writing the same props:

StyleFontLook
impactAntonuppercase, lower third, word-pop, big shadow
elegantPlayfair Displaywhite→gold gradient, centered, clip-reveal
kineticBebas Neuegold, font-cut cycling Anton/Bebas/Archivo/Oswald
neonBebas Neuecyan glow, wave
handwrittenCaveatrotated −4°, lower-left, word-slide
serifDropAbril Fatfacecentered, zoom-in
subtitleRobotosmall, bottom, bg pill, karaoke
boldRiseArchivo Blackuppercase, lower third, rise-mask
luxuryCinzeluppercase, cream→gold gradient, wide letterSpacing, clip-reveal
popOutlineMontserrat 900uppercase, gold with a dark outline, letter-pop
boxedInter 800dark text on a white box, lower third, word-slide
headlineMontserrat 900uppercase, outlined, the word being said in pink (highlight)
comicBangersyellow with a thick outline, tilted −3°, bounce
typewriterSpecial Elitecream, lower-left, typewriter
minimalInter 300uppercase, very wide letterSpacing, no shadow, rise-mask
scriptGreat Vibeswhite→blush gradient, clip-reveal
retroMonotonuppercase, pink glow, letter-pop
stickerFredoka 700white on a violet box, tilted −2°, lower third, word-pop
glitchRusso Oneuppercase, red glow, shake
cinematicCormorant Garamond 500uppercase, wide letterSpacing, rise-mask

Rule for agents: vary the font per title - never reuse one font across a whole edit. Any Google Font name auto-loads; some display faces ship in library/fonts/. The font picker lists about sixty Google fonts by look (Display, Sans, Serif, Script & hand, Retro & mono) and loads one on first use. Placement props (x/y) are canvas-aware in the styles (lower third ≈ y: height*0.30).

Switching the style on an existing title (inspector dropdown/Shuffle) only restyles the look (font, size, colors, shadow/glow, animation) - the clip's x/y/scale/rotation/align and its text are preserved. The style's canvas-aware placement is applied only when a title is first created.

Adjustment layers kind:"adjust", mediaId:null#

A clip that re-renders everything drawn below it (lower tracks + earlier clips) through its own filter stack - Premiere-style. Supports all Filter/Color props, vignette, grain, rgbSplit, temperature/tint, whole-frame shake, and opacity as the intensity. Keyframe/transition it like any clip. Put it on V2/V3 above the footage. Example: 0.3 s impact shake over everything = {kind:"adjust", track:"V3", duration:0.3, props:{shake:18}}.

Masks masks, video/image/svg/text/adjust#

Shapes that cut what the clip shows - rect, ellipse, bezier, free-hand; feather, expand, invert, add / subtract / intersect, keyframes. See Masks below.

Shape layers kind:"shape"#

props.shapes (rectangles, ellipses, polygons, stars, lines, bezier paths, groups) and trimStart / trimEnd / trimOffset (%, a draw-on of every path). Null objects (kind:"null") never render; other clips are parented to them. See Shapes, nulls and parenting.

Comp clips kind:"comp", compId#

A composition placed as one clip - it draws like a picture of the comp's size (fit defaults to none) and its media plays and exports. See "Compositions (nested sequences)".

Animatable props usable in keyframes#

X, y, scale, rotation, opacity, anchorX, anchorY, trimStart, trimEnd, trimOffset, pathOffset, volume, pan, duck, speed, brightness, contrast, saturation, hue, blur, grayscale, sepia, invert, temperature, tint, vignette, cornerRadius, shake, rgbSplit, grain, fontSize, letterSpacing, glow.

Transition types#

Fade · slide-left/right/up/down · zoom · wipe (=wipe-left) · wipe-right/up/down · iris (circular) · spin · blur · whip (whip-pan) · glitch (RGB split + jitter) · pop (overshoot scale - stickers/captions).

diff --git a/docs/docs/recipes/index.html b/docs/docs/recipes/index.html index 7abec1dfa..806c25f35 100644 --- a/docs/docs/recipes/index.html +++ b/docs/docs/recipes/index.html @@ -75,14 +75,14 @@

Recipes

Short answers for common edits: grades, captions, speed ramps, transitions and more, each one a few props away.

Assemble a rough cut#

Clips back-to-back on V1; each start = running sum of previous durations.

Insert / replace at playhead 3-point editing#

Load media into the Source monitor (double-click a bin item or timeline clip), mark the window with I/O, then , (insert icon) splits straddling clips on targeted tracks at the playhead, ripples everything later to the right by the window length, and drops the Source window in - video brings its linked audio stems. . (replace icon) overwrites instead: punches the placement tracks (V1 + linked stems) over [playhead, +window) with no ripple. Placement lanes are resolved against the live track list and follow targeting - if V1 / A1 / A2 were removed or untargeted, the lowest remaining targeted lanes of the right kind are used instead. Locked clips are never punched or split. A locked clip loaded into Source can't be retargeted with . (toast) until it is unlocked. When Source was loaded from a timeline clip, . instead retargets that clip's In/Out (and its linked stems) and ripples later clips on its tracks if the duration changed.

Ripple delete#

Select clip(s), then ⇧Del or the timeline-toolbar Ripple delete - removes the selection (linked partners included) and pulls later clips left on each targeted track to close the gap. Plain Del lifts (leaves a gap). Sync lock applies: linked partners on untargeted tracks move with the ripple, and locked clips are neither deleted nor moved. An unselected clip that merely overlaps the deleted range stays put - its overlap ends up bridging the shifted-in clip, so a crossfade across the cut survives.

Tighten a cut without breaking the rest#

Ripple edit (B) on the tail of the shot that runs long - the rest of the edit follows. To change where a cut falls between two shots without shifting anything else, Rolling edit (R) the cut. To keep a shot's timing but use a better take of the same moment, Slip (Y) it. To pull a whole segment out of the middle: set IN / OUT around it and Extract (').

Jump to cut#

Select a clip, then ↑ / ↓ - playhead snaps to its In, then Out (further taps walk neighboring cuts). No selection → previous / next cut on targeted tracks. Source monitor: same keys jump among 0 / In / Out / duration.

Protect finished work#

Lock the lanes you are done with (lockedTracks, or the padlock), e.g. setProject {lockedTracks:["A3"]} for a music bed. Now insert, ripple delete and close gap re-time the picture without touching it. To try an alternative without deleting a clip, disable it (⇧E / disabled:true).

Title card#

{kind:"text", mediaId:null, track:"V2", props:{text,fontSize,color}}.

Music bed#

Audio file on A1, props.volume: 0.3, trim with in/duration.

Level a voice-over edit#

fablecut_normalize_audio {clipIds:[…every VO clip…], target:-16} so all takes sit at one loudness, then keep the music on its own lane and pull that lane down: {op:"setTrack", id:"A3", set:{gain:-14}}. Then dip it under the voice: fablecut_auto_duck {clipIds:[<music clip>], under:["A1"], amount:-10}.

Cut a montage to the music#

Put the shots on V1 in the order you want (rough lengths are fine) and the music on an audio lane, then fablecut_beats {clipId:<the music>, retime:{every:2}} - each shot gets two beats where its footage allows (fewer when it runs out; clips past the music keep their length; one with less than a beat of footage refuses the re-cut), the cuts land on the beat. every:1 for a fast reel, 4 for a calm one; re-cut the part after the drop separately with retime:{from:<the drop>, every:1}. For an edit whose cuts are already chosen, snap:true just nudges each one onto the nearest beat (cuts on untargeted tracks, beside locked clips, or without spare footage to reach it stay where they are; the reply counts them). Check a cut with fablecut_frame before exporting.

Tighten a talking-head take#

Lock the music lane (setProject {lockedTracks:["A3"]}), then fablecut_silence {clipIds:[<the take>]} to see the pauses (it does the listening; fablecut_frame only shows the picture, handy to check a cut won't land mid-gesture), and fablecut_silence {clipIds:[<the take>], cut:true}. Add {op:"crossfade", ids:[…]} on the new audio cuts if a breath clicks.

Cut an interview down by text#

Lock the music lane, fablecut_transcribe {clipIds:[<the interview>]} to read what was said (name the speech clips, or the music bed is transcribed too), decide what stays, then fablecut_transcribe {clipIds:[<the interview>], find:["the sentence to drop", "and this one"], cut:true}. Then fablecut_silence {clipIds:[…], cut:true} for the pauses that are left.

Caption a talking-head reel#

Finish the cut first, then fablecut_captions {style:"highlight", clipIds:[<the talking-head clips>]} (name the speech clips, or a music bed with vocals gets captioned too), fablecut_frame {time:<mid-sentence>} to check the size and placement, and fablecut_captions {export:"srt"} for the platform's own subtitle upload.

Center a mono stem#

Linked or standalone audio clip with props.pan: 0 (inspector Pan slider, −1…+1). Stereo video stems default to L −1 / R +1; set A1 to 0 to center that channel in the mix.

Cinematic grade#

props.filterPreset: "teal-orange" (tweak with temperature/vignette on top).

Balanced, contrasty base grade then measure with fablecut_scopes#

{op:"setGrade", id, grade:{contrast:1.15, pivot:0.42, shadows:-10, highlights:-20, highSoft:30, saturation:108}}. Teal shadows / warm highlights: add lift:[-0.034, 0.008, 0.012, 0] and gain:[0.04, 0, -0.06, 0]. Film-style S-curve, muted greens, yellows pushed toward orange: grade:{curves:{y:[[0.25, 0.2], [0.75, 0.82]]}, hueSat:[[115, 0.7]], hueHue:[[60, -12]]} - then fablecut_scopes to check the blacks didn't crush. A grade on an adjustment layer over the whole edit = one look for every shot.

Green-screen composite#

Subject clip on V2 with props: {chromaKey:"#00ff00", chromaTolerance:30, chromaSoftness:15}, background footage on V1.

Remove background without a green screen people#

props: {bgRemove:true} - then put anything behind it on V1.

Picture-in-picture#

Clip on V3 with props: {scale:0.35, x:380, y:-200, cornerRadius:24} - add transitionIn: {type:"slide-right", duration:0.5} to fly it in.

Slow motion / timelapse#

props.speed: 0.5 (half speed) or 4 (4×). Remember the source window is duration × speed.

Speed ramp the reel move - fast into slow on the beat#

keyframes: { speed: [ {t:0, v:3}, {t:1.1, v:3}, {t:1.3, v:0.4, "ease":"ease-out"} ] } - sync the drop (t:1.3) to a marker; add transitionIn:{type:"whip",duration:0.2} before it.

Impact hit#

Adjustment layer, 0.25–0.4 s at the hit: {kind:"adjust", track:"V3", props:{shake:20, rgbSplit:8}} + impact-hit.mp3 from library/sfx on A2.

VHS / glitch look#

props: {rgbSplit:4, grain:35, saturation:120} + library/elements/vhs-scanlines.svg on V3 with blend:"soft-light", fit:"stretch". Cut between shots with transitionIn:{type:"glitch",duration:0.3}.

Film look#

Adjustment layer across the whole edit: props: {filterPreset:"cinematic", grain:18} - one clip grades every shot.

Neon caption#

props: {glow:60, glowColor:"#22d3ee", color:"#ffffff", font:"Bebas Neue", textAnim:"wave"} on a dark shot.

Light leak accent#

library/elements/light-leak-warm.svg on V3, props:{blend:"screen", fit:"cover", opacity:0.7}, 1–2 s at scene changes, transitionIn/Out: fade.

Light-leak / dust overlay#

Element from library/elements on V3 with props: {blend:"screen", opacity:0.6, fit:"cover"}.

Reel caption#

Text clip with props: {textAnim:"word-pop", wordRate:0.15, strokeWidth:6, bgColor:"#000000", bgOpacity:0.45, fontSize:88}. karaoke dims words until "spoken"; typewriter for terminal vibes.

RTL / Hebrew / Arabic caption#

Omit direction (defaults to "auto") or set direction:"rtl" explicitly; pick a font with the script's glyphs (Google Fonts work). Animations wipe and stagger in reading order automatically. letter-pop / wave animate whole words on Arabic/Indic lines (not isolated letters) so cursive joining stays correct.

Branded title#

props: {font:"Bebas Neue", weight:700, letterSpacing:6, uppercase:true, color:"#ffffff", color2:"#7b6cff", textShadow:20} - any Google Font name just works.

Kinetic font-cut title rhythmic typeface cuts on the beat, then settle#

props: {font:"Bebas Neue", fontSize:120, uppercase:true, color:"#ffd166", textAnim:"font-cut", fontCutSet:["Anton","Bebas Neue","Archivo Black","Oswald"]}.

Elegant clip-on title letters wipe in#

props: {font:"Playfair Display", fontSize:88, color:"#ffffff", color2:"#ffd166", letterSpacing:2, textAnim:"clip-reveal"} - centered, one clean sweep.

Lower-third reveal#

props: {font:"Archivo Black", fontSize:92, uppercase:true, textAnim:"rise-mask", y:<height*0.30>} - the line rises from behind its baseline. Pair with a serifDrop/zoom-in kicker above it.

Custom font#

Drop MyBrand.ttf into library/fonts/, then props.font: "MyBrand".

Animated sticker#

Author an SVG (convention above) into library/svg/, register {kind:"svg", src:"/library/svg/foo.svg"}, clip on V2/V3. Scale/move/ rotate with normal props & keyframes; the SVG's own CSS animation plays on top, frame-accurately.

Whoosh on a cut#

0.4 s sfx clip from library/sfx on A2 aligned to the cut.

Ken Burns slow push on a photo#

keyframes: { scale:[{t:0,v:1},{t:D,v:1.2,ease:"linear"}], x:[{t:0,v:0},{t:D,v:-40,ease:"linear"}] }.

Crossfade#

Overlap two clips on the same track by ~1 s; later clip gets transitionIn: {type:"fade", duration:1}. For audio give the earlier clip the matching transitionOut and both curve:"power" (or select a clip and press Shift+D in the editor).

Whip-pan cut#

A gets transitionOut:{type:"whip",duration:0.25}, B gets transitionIn:{type:"whip",duration:0.25}.

Beat-synced cut#

Write beat times into markers, then align clip starts to them (the UI also snaps drags to markers).

Label the structure#

Write named, coloured markers for sections the user can jump between (⇧M / Alt+⇧M, or the Markers list): setProject {markers:[{t:0,label:"intro",color:"blue"},{t:8.5,label:"drop",color:"red"},{t:24,label:"outro",color:"purple"}]}. setProject replaces the whole list - include the existing markers you want to keep.

Music fade-out#

Audio clip keyframes: { volume:[{t:D-3,v:0.8},{t:D,v:0}] } or simply transitionOut: {type:"fade", duration:3, curve:"exp"}.

Pulse / emphasis#

keyframes: { scale:[{t:0,v:1},{t:0.3,v:1.12},{t:0.6,v:1}] }.

Reframe horizontal → vertical#

Keep a wide composition canvas and crop for delivery - e.g. width:1920, height:1080 with exportFrame:{x:656,y:0,w:608,h:1080} (9:16 fitted to canvas height). Position footage with clip x/y/scale; the export frame can be dragged in the UI. Omit exportFrame to export the full canvas.

Vertical reel#

Set project width:1080, height:1920; use the UI's safe-area guides (▦) to keep captions out of platform UI zones.

Project frame rate#

Set fps in project.json (or the Program Monitor FPS dropdown - 24 / 25 / 30 / 50 / 60). Preview stepping, timecode frames, Fast / WebCodecs / Realtime export, and /api/export/begin all use this value; pass the same fps when starting an export via the API.

diff --git a/docs/docs/remake/index.html b/docs/docs/remake/index.html index d624200e9..d75048015 100644 --- a/docs/docs/remake/index.html +++ b/docs/docs/remake/index.html @@ -75,7 +75,7 @@

threshold tunes cut sensitivity (default adapts 0.30→0.20→0.12): lower it if obvious cuts were missed, raise it if motion is being misread as cuts.

Rebuild recipe - the analysis is deterministic; the creative mapping is yours:

  1. setProject: copy the reference's width/height/fps; write beats (or the cuts) into markers so the user sees the grid.
  2. Music: the extracted track on A1, in:0, duration:<ref duration>.
  3. Structure: one clip per shots[] entry on V1 at the same start/duration (hard cuts by default - that's what shot detection saw). Pick source footage whose motion matches each shot's energy (calm ≤40, action ≥70), and choose each clip's in so something interesting happens inside the window. Then look: fablecut_frame {path, frames:12} to survey a candidate clip, {path, t} at the exact moment you want, before committing to an in.
  4. The drop: put the hero shot there; classic garnish = a speed ramp landing on it, an impact adjust layer (shake+rgbSplit), or a whip transition.
  5. Pacing garnish to taste: shots shorter than ~0.6 s read as beat-flashes; avgShotLen tells you the reference's overall pace. Captions/grade/SFX per the Recipes section - the blueprint gives structure, not style.
diff --git a/docs/docs/rest-api/index.html b/docs/docs/rest-api/index.html index 075722108..7169aa6fe 100644 --- a/docs/docs/rest-api/index.html +++ b/docs/docs/rest-api/index.html @@ -75,14 +75,14 @@

REST API

The HTTP endpoints behind the editor, for scripts and tools that don't speak MCP.

-
  • GET /api/project - current project JSON
  • PUT /api/project - replace project JSON (body = full document). Conflict-safe: if the body's revision ≤ the revision currently on disk, the server rejects with 409 and returns {"error":"…","revision":<current>}. Append ?force=1 to overwrite unconditionally. A request with an X-FableCut-Project header (the editor sends the id of the project it loaded) is also refused with 409 when another project is open (see Projects). Writes are atomic (tmp file + rename), so a crashed write never corrupts the file.
  • GET /api/media - list files in ./media (name, src, size)
  • GET /api/media-info?src=/media/x.mp4 → {src, info} · POST /api/media-info {srcs:[…], stat?} → {info:{src: info}} (up to 2000; stat:true answers only {size, mtimeMs}, no ffprobe - how the editor checks for offline files) - a file's metadata from ffprobe: size, fps, codec, audioCodec, audioChannels, sampleRate, bitrate, duration, width, height and probe ("ffprobe", or "stat" when only the size could be read). info is null when the src names no file under /media/ or /library/. Cached per file version.
  • POST /api/proxy {srcs:[…], height?:540|720|1080} → {status:{src: status}} queues proxies (ffmpeg, one at a time); POST /api/proxy/status {srcs} → {status:{src: status | null}}; POST /api/proxy/delete {srcs} → {deleted:{src: n}}. A status is {state:"ready", src:"/proxies/…", width, height, size}, {state:"queued"|"running", progress, height}, {state:"failed", error} or {state:"none"} (null = no such source file). Progress and results are also pushed as SSE event proxy ({src, status}). GET /proxies/<name> serves a proxy file from analysis/proxies/. /api/proxy answers 503 without ffmpeg.
  • POST /api/relink/candidates {media:[{id, name, src?, size?, kind?}]} → {candidates:{id:[{src, name, size, score, why}]}} - where a missing file might be now: files under media/ and library/ (subfolders included) of the same kind, ranked by name (same name, same name with another extension, similar name) and size, best 5 each.
  • GET /api/projects[?archived=only|all] → {active, projects:[{id, name, active, archived, notes, tags, created, opened, modified, width, height, fps, duration, clips, media, thumb}], templates:[…]} · POST /api/projects {action, …} - the actions of fablecut_projects (plus import {project, name?}). The answer depends on the action: {id, project} for open / new / duplicate / update / archive / unarchive / import (plus from when the open project changed, already when it was open), {id, deleted} for delete, {templates} for templates, {template} for save_template (the saved one) and {template, deleted} for delete_template · GET / PUT /api/projects/thumb?id= - a project's JPEG thumbnail (1 MB max). SSE event projects ({action, id, active}) after each change. See Projects.
  • GET /api/versions[?project=] → {project, versions:[{v, name, note, kind, created, revision, clips, duration, final}]} (newest first; default the open project) · POST /api/versions {action, project?, version?, …} - save {name?, note?, final?} → {project, version} · diff {version, to?} → {same, lines, added, removed, changed, mediaAdded, mediaRemoved, settings} · restore {version} → {restored, saved} · update {version, name?, note?, final?} → {version} · delete {version} → {deleted}. GET /api/versions/file?project=&version= is that version's document; GET /api/projects/backup?id= a project with all its versions (import it with POST /api/projects {action:"import", project:<the backup>}). SSE event versions ({project, action}). See Versions.
  • POST /api/files {action, …} - the files in media/: list {dir?} → {dir, folders, files:[{name, src, size}]} · mkdir {dir} · move {from, to, force?} → {from, to, moved:[{from, to}], repointed:[{project, open, media}], warning?} (from / to are the item itself; moved lists each file in it, so it is empty for an empty folder or a no-op; 409 while a project can't be read, unless force:true) · trash {paths, force?} → {trashed:[{id, src}], offline} (409 while a project uses one or can't be read, unless force:true; a batch that stops part-way answers 400 with trashed and failed; stillThere lists uses whose file is still in place) · trash-list → {items} · restore {id}. See Media management.
  • GET /api/library?dir=sfx|elements|svg|fonts|presets|templates - list library assets
  • GET /api/presets · GET /api/templates - the saved presets / templates, validated (bad files skipped); POST /api/presets {preset} · POST /api/templates {template} - validate one and save it as library/presets/<id>.json / library/templates/<id>.json, returning {id, name, file}
  • GET /api/workflows[?id=] - the saved workflows, validated (bad files skipped), or one by id or name (404 if none) · POST /api/workflows {workflow} - validate and save it as library/workflows/<id>.json, returning it with created / updated · POST /api/workflows/delete {id} → {deleted}. See Workflows.
  • POST /api/upload?name=foo.mp4 - raw body saved into ./media, returns {src}. MP4/MOV/M4V uploads are auto-remuxed with +faststart (needs ffmpeg on PATH). Files copied straight into ./media by external tools skip this - remux big ones yourself (ffmpeg -i in.mp4 -c copy -movflags +faststart out.mp4) or playback stalls.
  • POST /api/import-url - body {url:"https://…"} downloads the file into ./media/ and returns {src,name} (same-origin /media/…, like upload). HTTPS only; rejects localhost, private/link-local/CGNAT addresses, and redirects to those. Remote SVG is refused (/media/*.svg is served same-origin as image/svg+xml - a scripted SVG opened as a document would run on the editor origin). Does not write project.json - register the media afterwards (UI and fablecut_import_media do this). Do not put a raw https:// URL (or another origin, including localhost on a different port) in media.src: canvas CORS would taint the compositor and Fast / WebCodecs export cannot JPEG-encode. Import into ./media so src is /media/…, or serve the remote with Access-Control-Allow-Origin.
  • GET /api/transcript?src=/media/x.mp4 → {transcript} (null when the file has none yet; 404 when the file is missing) · POST /api/transcript?src= (a transcript document) → {src, words} · POST /api/transcript/status {srcs} → {status:{src: {words, language, model, duration, created} | false | null}} · POST /api/transcript/delete {src} → {deleted}. SSE event transcript ({src}) after each save or delete. POST /api/transcribe/request {transcribe:{srcs, model?, language?, again?}, where?} queues a transcription on the export-job queue (poll GET /api/export/job?id=); the tab saves each transcript, and the job's result lists done, skipped and failed. See Transcripts and text-based editing.
  • POST /api/denoise - body {src:"/media/…", amount:"light"|"medium"|"strong"}: writes a noise-reduced FLAC of the whole file into ./media/ (reused if it exists) and returns {src, name, duration, channels}. Does not touch project.json (see Audio mix).
  • POST /api/analyze - body {src:"/media/ref.mp4", threshold?, music?}: analyze a reference video into an edit blueprint (see Remake a reference video); extracts its music into ./media. GET /api/analyze?src=… returns the cached blueprint.
  • GET /api/frame?src=/media/x.mp4&t=3.2 - one JPEG still of a source clip, the "eyes" to go with /api/analyze's ears (see Look at the footage). Optional w (pixel width, default 768) and q (ffmpeg -q:v 1–31, default 4). &frames=N[&cols=][&from=][&to=][&w=320] instead returns one N-up contact sheet across the clip (N 2–60; cols omitted → the squarest layout, so 6 frames give 3×2 rather than 4×2 with two black cells). src must name an existing file under /media/ or /library/ (404 otherwise). ?path= reads any file on the machine but only with the X-FableCut-Client: mcp request header, which only the local MCP client sends - without it the request is refused (403) before the path is even resolved. Results are cached in analysis/frames/ keyed by source path, size and mtime; the cache is capped (500 files / 128 MB, oldest first). The response carries X-FableCut-Frame-Times (comma-separated sample times, so a sheet's cells can be mapped back to timestamps) and X-FableCut-Frame-Source.
  • POST /api/scopes/request also takes {"image":true}, which makes the editor return the measured still as a JPEG data URL in result.image - how fablecut_frame {time} shows an agent the composed program picture.
  • GET /api/events - SSE: named event change when project.json, ./media or ./library changes; named event profiles when encoding-profiles.json changes (UI refreshes the export-profile list only - no project reload); named event proxy as a proxy is queued, makes progress, finishes or is deleted
  • Fast / WebCodecs export (browser compositor → server ffmpeg): GET /api/export/ffmpeg → {available} · GET /api/export/profiles[?detail=1] → {default, profiles, issues} · POST /api/export/begin {fps,name,mode?,profile?,hasAudio?,pixelFormat?,width?,height?} → {id,mode,profile?,label,summary} (fps is required - pass project.fps, no server-side default; mode is "jpeg" (default, Fast) or "annexb" (WebCodecs H.264 elementary stream); jpeg 400 if profile is not a defined id, or if ffmpeg rejects its args in the dry run; optional pixelFormat:"rgba" plus width/height pipes raw canvas frames instead of JPEG) · POST /api/export/frame?id= (JPEG body for jpeg mode; raw RGBA if begin used pixelFormat:"rgba"; Annex-B for annexb - one POST may concatenate frames or AUs. Must be after audio; ffmpeg is spawned on the first frame in both modes) · POST /api/export/audio?id= (WAV body - must be sent before the first frame) · POST /api/export/end?id=[&discard=1] → {src} under /exports/
  • Export jobs (what fablecut_export drives): POST /api/export/request {range?, profile?, where?:"auto"|"tab"|"headless"} → {id, status, via, …} (409 if one is already running, or nothing can render it) · GET /api/export/job?id= → {status: pending|running|done|failed|cancelled, progress 0–1, src, error} · POST /api/export/job/cancel?id=. The editor tab side: SSE event export (a ticket), GET /api/export/job/ticket?id=, POST /api/export/job/claim?id= (first tab wins, else 409), POST /api/export/job/report?id= {progress} | {status:"done", src} | {status:"failed", error} → {cancel}.
+
  • GET /api/project - current project JSON
  • PUT /api/project - replace project JSON (body = full document). Conflict-safe: if the body's revision ≤ the revision currently on disk, the server rejects with 409 and returns {"error":"…","revision":<current>}. Append ?force=1 to overwrite unconditionally. A request with an X-FableCut-Project header (the editor sends the id of the project it loaded) is also refused with 409 when another project is open (see Projects). Writes are atomic (tmp file + rename), so a crashed write never corrupts the file.
  • GET /api/media - list files in ./media (name, src, size)
  • GET /api/media-info?src=/media/x.mp4 → {src, info} · POST /api/media-info {srcs:[…], stat?} → {info:{src: info}} (up to 2000; stat:true answers only {size, mtimeMs}, no ffprobe - how the editor checks for offline files) - a file's metadata from ffprobe: size, fps, codec, audioCodec, audioChannels, sampleRate, bitrate, duration, width, height and probe ("ffprobe", or "stat" when only the size could be read). info is null when the src names no file under /media/ or /library/. Cached per file version.
  • POST /api/proxy {srcs:[…], height?:540|720|1080} → {status:{src: status}} queues proxies (ffmpeg, one at a time); POST /api/proxy/status {srcs} → {status:{src: status | null}}; POST /api/proxy/delete {srcs} → {deleted:{src: n}}. A status is {state:"ready", src:"/proxies/…", width, height, size}, {state:"queued"|"running", progress, height}, {state:"failed", error} or {state:"none"} (null = no such source file). Progress and results are also pushed as SSE event proxy ({src, status}). GET /proxies/<name> serves a proxy file from analysis/proxies/. /api/proxy answers 503 without ffmpeg.
  • POST /api/relink/candidates {media:[{id, name, src?, size?, kind?}]} → {candidates:{id:[{src, name, size, score, why}]}} - where a missing file might be now: files under media/ and library/ (subfolders included) of the same kind, ranked by name (same name, same name with another extension, similar name) and size, best 5 each.
  • GET /api/projects[?archived=only|all] → {active, projects:[{id, name, active, archived, notes, tags, created, opened, modified, width, height, fps, duration, clips, media, thumb}], templates:[…]} · POST /api/projects {action, …} - the actions of fablecut_projects (plus import {project, name?}). The answer depends on the action: {id, project} for open / new / duplicate / update / archive / unarchive / import (plus from when the open project changed, already when it was open), {id, deleted} for delete, {templates} for templates, {template} for save_template (the saved one) and {template, deleted} for delete_template · GET / PUT /api/projects/thumb?id= - a project's JPEG thumbnail (1 MB max). SSE event projects ({action, id, active}) after each change. See Projects.
  • GET /api/versions[?project=] → {project, versions:[{v, name, note, kind, created, revision, clips, duration, final}]} (newest first; default the open project) · POST /api/versions {action, project?, version?, …} - save {name?, note?, final?} → {project, version} · diff {version, to?} → {same, lines, added, removed, changed, mediaAdded, mediaRemoved, settings} · restore {version} → {restored, saved} · update {version, name?, note?, final?} → {version} · delete {version} → {deleted}. GET /api/versions/file?project=&version= is that version's document; GET /api/projects/backup?id= a project with all its versions (import it with POST /api/projects {action:"import", project:<the backup>}). SSE event versions ({project, action}). See Versions.
  • POST /api/files {action, …} - the files in media/: list {dir?} → {dir, folders, files:[{name, src, size}]} · mkdir {dir} · move {from, to, force?} → {from, to, moved:[{from, to}], repointed:[{project, open, media}], warning?} (from / to are the item itself; moved lists each file in it, so it is empty for an empty folder or a no-op; 409 while a project can't be read, unless force:true) · trash {paths, force?} → {trashed:[{id, src}], offline} (409 while a project uses one or can't be read, unless force:true; a batch that stops part-way answers 400 with trashed and failed; stillThere lists uses whose file is still in place) · trash-list → {items} · restore {id}. See Media management.
  • GET /api/library?dir=sfx|elements|svg|fonts|presets|templates - list library assets
  • GET /api/presets · GET /api/templates - the saved presets / templates, validated (bad files skipped); POST /api/presets {preset} · POST /api/templates {template} - validate one and save it as library/presets/<id>.json / library/templates/<id>.json, returning {id, name, file}
  • GET /api/workflows[?id=] - the saved workflows, validated (bad files skipped), or one by id or name (404 if none) · POST /api/workflows {workflow} - validate and save it as library/workflows/<id>.json, returning it with created / updated · POST /api/workflows/delete {id} → {deleted}. See Workflows.
  • POST /api/upload?name=foo.mp4 - raw body saved into ./media, returns {src}. MP4/MOV/M4V uploads are auto-remuxed with +faststart (needs ffmpeg on PATH). Files copied straight into ./media by external tools skip this - remux big ones yourself (ffmpeg -i in.mp4 -c copy -movflags +faststart out.mp4) or playback stalls.
  • POST /api/import-url - body {url:"https://…", name?} downloads the file into ./media/ and returns {src,name} (same-origin /media/…, like upload). name is the file name to save as (its extension follows the download). HTTPS only; rejects localhost, private/link-local/CGNAT addresses, and redirects to those. Remote SVG is refused (/media/*.svg is served same-origin as image/svg+xml - a scripted SVG opened as a document would run on the editor origin). Does not write project.json - register the media afterwards (UI and fablecut_import_media do this). Do not put a raw https:// URL (or another origin, including localhost on a different port) in media.src: canvas CORS would taint the compositor and Fast / WebCodecs export cannot JPEG-encode. Import into ./media so src is /media/…, or serve the remote with Access-Control-Allow-Origin.
  • GET /api/transcript?src=/media/x.mp4 → {transcript} (null when the file has none yet; 404 when the file is missing) · POST /api/transcript?src= (a transcript document) → {src, words} · POST /api/transcript/status {srcs} → {status:{src: {words, language, model, duration, created} | false | null}} · POST /api/transcript/delete {src} → {deleted}. SSE event transcript ({src}) after each save or delete. POST /api/transcribe/request {transcribe:{srcs, model?, language?, again?}, where?} queues a transcription on the export-job queue (poll GET /api/export/job?id=); the tab saves each transcript, and the job's result lists done, skipped and failed. See Transcripts and text-based editing.
  • POST /api/denoise - body {src:"/media/…", amount:"light"|"medium"|"strong"}: writes a noise-reduced FLAC of the whole file into ./media/ (reused if it exists) and returns {src, name, duration, channels}. Does not touch project.json (see Audio mix).
  • POST /api/analyze - body {src:"/media/ref.mp4", threshold?, music?}: analyze a reference video into an edit blueprint (see Remake a reference video); extracts its music into ./media. GET /api/analyze?src=… returns the cached blueprint.
  • GET /api/frame?src=/media/x.mp4&t=3.2 - one JPEG still of a source clip, the "eyes" to go with /api/analyze's ears (see Look at the footage). Optional w (pixel width, default 768) and q (ffmpeg -q:v 1–31, default 4). &frames=N[&cols=][&from=][&to=][&w=320] instead returns one N-up contact sheet across the clip (N 2–60; cols omitted → the squarest layout, so 6 frames give 3×2 rather than 4×2 with two black cells). src must name an existing file under /media/ or /library/ (404 otherwise). ?path= reads any file on the machine but only with the X-FableCut-Client: mcp request header, which only the local MCP client sends - without it the request is refused (403) before the path is even resolved. Results are cached in analysis/frames/ keyed by source path, size and mtime; the cache is capped (500 files / 128 MB, oldest first). The response carries X-FableCut-Frame-Times (comma-separated sample times, so a sheet's cells can be mapped back to timestamps) and X-FableCut-Frame-Source.
  • POST /api/scopes/request also takes {"image":true}, which makes the editor return the measured still as a JPEG data URL in result.image - how fablecut_frame {time} shows an agent the composed program picture.
  • GET /api/events - SSE: named event change when project.json, ./media or ./library changes; named event profiles when encoding-profiles.json changes (UI refreshes the export-profile list only - no project reload); named event proxy as a proxy is queued, makes progress, finishes or is deleted
  • Fast / WebCodecs export (browser compositor → server ffmpeg): GET /api/export/ffmpeg → {available} · GET /api/export/profiles[?detail=1] → {default, profiles, issues} · POST /api/export/begin {fps,name,mode?,profile?,hasAudio?,pixelFormat?,width?,height?} → {id,mode,profile?,label,summary} (fps is required - pass project.fps, no server-side default; mode is "jpeg" (default, Fast) or "annexb" (WebCodecs H.264 elementary stream); jpeg 400 if profile is not a defined id, or if ffmpeg rejects its args in the dry run; optional pixelFormat:"rgba" plus width/height pipes raw canvas frames instead of JPEG) · POST /api/export/frame?id= (JPEG body for jpeg mode; raw RGBA if begin used pixelFormat:"rgba"; Annex-B for annexb - one POST may concatenate frames or AUs. Must be after audio; ffmpeg is spawned on the first frame in both modes) · POST /api/export/audio?id= (WAV body - must be sent before the first frame) · POST /api/export/end?id=[&discard=1] → {src} under /exports/
  • Export jobs (what fablecut_export drives): POST /api/export/request {range?, profile?, where?:"auto"|"tab"|"headless"} → {id, status, via, …} (409 if one is already running, or nothing can render it) · GET /api/export/job?id= → {status: pending|running|done|failed|cancelled, progress 0–1, src, error} · POST /api/export/job/cancel?id=. The editor tab side: SSE event export (a ticket), GET /api/export/job/ticket?id=, POST /api/export/job/claim?id= (first tab wins, else 409), POST /api/export/job/report?id= {progress} | {status:"done", src} | {status:"failed", error} → {cancel}.
diff --git a/docs/docs/sequences/index.html b/docs/docs/sequences/index.html index fb9a20bb0..faca64950 100644 --- a/docs/docs/sequences/index.html +++ b/docs/docs/sequences/index.html @@ -75,7 +75,7 @@

Opening another sequence parks the top-level keys in the open one's entry and brings the other's up, with a new revision - like any edit. A clip in a sequence that isn't open still counts: its media shows "used" in the bin, can't be removed while it is there (removeMedia and Remove from project refuse and name the sequence), and Replace file… trims it too; a comp it places can't be removed either. A project with one sequence named Main has neither key.

In the editor: the sequence menu at the left of the timeline toolbar (it shows the open sequence's name, and how many there are) lists them - click one to open it - and has New sequence… (a name, a canvas - the same as the open one, or 16:9, 9:16, 4:5, 1:1 - and, optionally, a copy of the open sequence's timeline to start from), Duplicate, Rename… and Delete… (click twice; the project is first kept as a version, so a deleted sequence can be restored from Projects → Versions). For the session each sequence keeps its own undo history, playhead and selection. The Export dialog, the Mixer, IN / OUT and the canvas settings all belong to the open sequence. Find timeline instances lists placements in other sequences too; clicking one opens its sequence.

Agents (fablecut_patch_project):

  • {op:"addSequence", name?, id?, from?, width?, height?, fps?, open?:true} - from:"empty" (default; the open sequence's canvas and frame rate, no clips), "open" (a copy of the open sequence's timeline) or a sequence id (a copy of that one). width / height / fps change the copy's canvas: the clips keep their positions relative to the centre, and an exportFrame is dropped.
  • {op:"inSequence", sequence, ops:[…]} runs ops on a sequence without opening it: clip and timeline ops, setProject (its canvas, markers, IN / OUT, delivery), setTrack, setBus, setFx on its tracks, and updateSequence (name, index) - not addSequence, openSequence, removeSequence or another inSequence. The user's editor stays where it is.
  • {op:"openSequence", id} changes what the user's editor shows, and what fablecut_export, fablecut_frame {time} and fablecut_scopes render: do it when the user asked, or to export that sequence.
  • {op:"updateSequence", id, set:{name?, index?}} renames or reorders one; {op:"removeSequence", id} deletes one (only when asked; the last one stays, deleting the open one opens its neighbour, and one holding locked clips or tracks needs force:true).
  • The compact view and fablecut_status list every sequence (id, name, canvas, clips, length, which is open). A version's Compare reports each sequence's changes on its own, sequences added and removed, and which one was open.

Reframe - fablecut_reframe {aspect?:"9:16"|"1:1"|"4:5"|"16:9"|"4:3"|"2:3", name?, clipIds?, follow?, smooth?, force?} makes a copy of the open sequence on that canvas shape and opens it (the project's shorter side kept: 1920×1080 → 1080×1920 for 9:16, 1080×1080 for 1:1), so the original cut stays as it was; without aspect it reframes the open sequence on its own canvas. Each full-frame shot - a video or still that isn't moved, scaled, cropped or keyed by hand - gets fit:"cover" and an x (or y) that keeps its subject in view. Frames are sampled 5 times a second at 96 px; the subject is where motion (against the shot's own movement, so a pan or a flicker doesn't count), detail and colour gather, pulled gently toward the centre. A virtual camera operator then holds still while the subject stays inside a dead zone and eases after it no faster than a pan speed, and the path becomes ordinary keyframes (thinned to within ~2 px), or one steady position. Shots with no clear subject are centred. Titles, picture-in-picture, clips placed or animated by hand and locked clips (unless force:true) are left alone and listed in the reply - check them on the new canvas with fablecut_frame {time}. follow:false only fits and centres; smooth 0…1 (default 0.5) holds longer and pans slower as it rises. props.reframe marks what Reframe did, so running it again replaces its own keys. A version is kept first. In the editor: New sequence… with a copy of the open sequence on another shape has Follow the subject in each shot; the Inspector's Reframe section on a video or picture of another shape than the canvas has Follow subject, Centre and Lively / Balanced / Steady (the selected clips, one undo step, with Cancel).

Highlights - fablecut_highlights {duration?, shot?, clipIds?, mediaIds?, name?, aspect?} finds the best moments of long footage and cuts them into a short edit: a new sequence (Highlights 30 s, or name), opened, so the timeline it came from stays as it was. It reads the video clips on the open timeline (clipIds limits them; mediaIds reads whole files instead), up to an hour of footage at a time: frames twice a second at 64 px, and the sound. Every half second is scored for movement, sound louder than the 20 s around it (a cheer, a laugh, a hit), its overall level, and a clear picture; black frames and flat colour count for little. Cuts already in the footage are found, and a moment never crosses one. It then takes the best moments of shot seconds (default duration / 8, kept within 1.5–4 s), apart in the same footage (by half a moment, at least a second) and spread over its shots, until the edit is duration seconds (default 30; 5…600), trims the last ones to fit exactly, and nudges each end up to 0.3 s to the quietest point near it, so no word or hit is cut through. The moments go back to back on V1 in story order, each a clip of its source with its props (a reframed clip's framing isn't carried over) and its linked sound clips beside it (their own tracks, linked again); their keyframes aren't carried over. A moment from a whole file (mediaIds) is one video clip that plays its own sound, with no separate audio clips. A clip played faster or slower counts by its length on the timeline: duration and shot are always seconds of the edit. In the editor (and Studio) the sound of a file longer than 30 minutes isn't read, so as not to decode it whole in the browser; its picture decides. Disabled clips and clips with a speed ramp are not read. aspect makes the new sequence 9:16, 1:1 or 4:5: the shots are then letterboxed, and fablecut_reframe {} fits them and follows the subject. The reply lists each moment (its source, times, length, why it was picked and its score). A version is kept first. In the editor: the sequence menu's Highlights… (15, 30, 60 or 90 s; a canvas, and Follow the subject in each shot on another shape) reads the selected video clips, else every video clip on the timeline, with progress and Cancel.

Recipes: vertical cut of a finished edit - fablecut_reframe {aspect:"9:16"}, then check the titles with fablecut_frame; by hand, addSequence {name:"Reel 9:16", from:"open", width:1080, height:1920}, then inSequence ops to re-position or re-scale the shots and setProject {delivery:"instagram-reels"} in it; reel from a long video - fablecut_highlights {duration:30, aspect:"9:16"}, then fablecut_reframe {}, music on an audio track and fablecut_beats {clipId:<the music>, retime:{every:2}}, then captions; cut-downs - duplicate the edit as "30 s" and "15 s" and tighten each with the trim ops inside inSequence; selects reel - an empty sequence the user drops favourite takes on, cut into the edit from the Source monitor.

diff --git a/docs/docs/studio/index.html b/docs/docs/studio/index.html index a64df1a58..8d048b05d 100644 --- a/docs/docs/studio/index.html +++ b/docs/docs/studio/index.html @@ -75,7 +75,7 @@

FableCut Studio

diff --git a/docs/docs/tracking/index.html b/docs/docs/tracking/index.html index cc2ed94bf..290d69b1f 100644 --- a/docs/docs/tracking/index.html +++ b/docs/docs/tracking/index.html @@ -75,7 +75,7 @@
keydoes
namehow masks, clips and agents refer to it (default Track n, or the mask's name)
kindpoint (position) or box (position, size and rotation were followed)
w · hthe region that was matched, fractions of the clip's picture
samplesone per frame: [t, x, y, s, r, q]. t is seconds from the clip's start, x, y is the centre (fractions of the picture, like masks), s is the scale and r the rotation (°) relative to the first sample, q is the match quality 0…1

The tracker matches a small greyscale template of the region (normalized cross-correlation, sub-pixel, optionally over scale and rotation) and keeps the template fresh while anchoring it to the first frame so it does not drift. It stops where the match quality drops below 0.45 (the region was covered, left the frame or changed too much) and keeps what it tracked up to there. Pick regions with detail: corners, text, edges. Flat sky or a blank wall can't be tracked. A track without scale follows position only: if the thing grows, shrinks or turns noticeably, turn on Scale / Rotate (scale / rotation), or the match fades and the track stops early. Tracks are stored in clip time, so they move with the clip and follow trims and splits (re-track after changing its speed).

In the editor:

  • Mask tracking. Select a mask on a video clip. Under its mode row, ◀ Back and On ▶ follow what the mask covers from the playhead to the clip's start or end, and key the mask's x / y. Turn on Scale and Rotate to key those too. The keys are linear and simplified (a key only where the motion turns, within ~1.5 px). Keys the mask had in that range lose their position and keep everything else.
  • Point tracking. The Inspector's Tracking section (video clips): + Track point, then click the spot on the monitor. It tracks from the playhead to the clip's end. Region sets the matched area (% of the picture's width). Pick a track's chip to see its path and region on the monitor, ◀ Track back / Track on ▶ to extend it from the playhead, and Delete it.
  • Attach a clip. With a track picked, choose a clip in Attach (any visual clip that overlaps it in time) and press Attach to the track. The clip gets x / y keyframes (plus scale / rotation with those toggles on) that ride on the track and keep it where it is at the playhead. Stickers, titles, a blur box or a highlight then stay pinned to the moving thing.
  • Tracking runs from a private copy of the video, so the monitor does not move. Progress shows in the Inspector, and Esc stops it and keeps what it has. Each finished track is one undo step.

Agents: fablecut_track runs the tracker in the editor (an open tab, else headless Chrome / Edge) and saves the result:

  • {clip, point:{x:0.62, y:0.4}, at:12} follows a spot from at to the clip's end. region:{x, y, w, h} gives the area instead, size sets a point's region (default 0.08 of the width), direction:"backward"|"both" and to (timeline seconds) set the range, and scale / rotation follow those too.
  • apply:{mask:"Face"} bakes the result into that mask's keys. Leave out point / region and the mask's own outline is what gets followed.
  • apply:{clip:"c_sticker", scale?, rotation?, at?} pins another clip to the track.
  • name names the track. Passing an existing name with apply and no region re-applies the stored track without tracking again.
  • The reply gives the range, the match quality (min / mean; ≥ 0.8 is solid), where it was lost, and what was keyed.
  • {op:"removeTrack", id, track} deletes a stored track; what followed it keeps its keys. The compact project view lists tracks as [tracks: "Logo" point 0.00–4.20 s (127 samples)], never their samples.

Recipes: a title that follows a car - track a point on the car, attach the title; blur a face or a plate - an ellipse mask on a blurred copy of the shot on the track above, then apply:{mask:"Face"}; a screen replacement - track the screen with Scale and Rotate on and attach the new picture, cropped to fit; a highlight that stays on a UI element in a screen recording - track the button, attach a rect svg.

diff --git a/docs/docs/transcripts/index.html b/docs/docs/transcripts/index.html index a0c19c699..729a615c0 100644 --- a/docs/docs/transcripts/index.html +++ b/docs/docs/transcripts/index.html @@ -75,17 +75,17 @@

Transcripts and text-based editing

Turn speech into words with times, in the browser, then read, search and cut the edit like text: in the Transcript tab, or from an agent with fablecut_transcribe.

FableCut turns the speech in a clip into words with times, so an edit can be read, searched and cut like text. Transcription runs in the browser: Whisper (OpenAI's speech model, through transformers.js) in a background worker of the editor tab. The library and the model are fetched from a CDN the first time and kept by the browser after that; the audio never leaves the machine.

modeldownload
base (default)77 MBquick: about 15 s per minute of speech on a fast desktop
small250 MBoften more accurate (accents, noisy rooms, numbers); about twice as slow

Whisper detects the language by itself; give it one (en, es, hi, ja, … any Whisper code) when a clip is short or mixes languages. Long files are split at their quietest moments into pieces of at most 28 s, and stretches of silence are skipped (Whisper invents words in silence).

One transcript per file, kept by the server in analysis/transcripts/: {v, src, model, language, duration, created, words:[[text, start, end], …]}, times in seconds of the file. Like a proxy it belongs to the file's size and modification time, so a replaced or re-rendered file has none until it is transcribed again. It is not stored in project.json, so it never bloats the timeline, and every clip and sequence that uses the file reads the same one.

On the timeline a clip shows the words its window of the file holds, placed through its in point and speed (a word counts when its middle is inside the clip). A clip with a speed ramp is left out, and so are disabled clips and pictures whose sound is off.

Cutting words extracts on the targeted tracks, from just before the first word to just before the word after the last one: the pause after the cut goes too, the pause before it stays. Cuts land on whole frames, never in a neighbouring word or past the clip. Several cuts go last first, as one undo step (one revision for an agent): later material moves up, linked stems stay in step, and locked clips stay put - lock the music bed first if it should keep running under the tightened edit. Find matches whole words and ignores case, accents, punctuation and spacing: "ai powered" finds "A.I.-powered", and "cat" doesn't find "category".

In the editor, the Transcript tab beside the Inspector:

  • Transcribe works on the selected clips' files (a selection with no speech, such as a title, transcribes nothing), else on every file on the timeline that has no transcript yet; once every file has one (an agent may have made them), it reads Transcribe again and redoes them all. The model and the language are beside it. Progress shows below (the first time, the model download), with Cancel. A line above the words says which model and language made them: when the words look wrong, pick the language spoken and the Small model, then Transcribe again.
  • The timeline's words, in paragraphs with timecodes. Click a word to go there; the word under the playhead is underlined and followed while playing. ⇧-click or drag to select a run of words, then press Delete (or Cut) to extract it.
  • Find words marks every match, Enter steps through them, and Cut N extracts them all. Copy copies the text with its timecodes.

Agents use fablecut_transcribe. It transcribes in an open editor tab, else in headless Chrome / Edge, whose profile is kept in analysis/browser-profile/ so the model downloads once:

  • {} transcribes every clip with sound that has no transcript yet, then returns the timeline's words as timed lines: [0:12.08] Open the demo, nothing to install. clipIds limits it to some clips; from / to limit the time (the reply stops at 300 lines); mediaIds reads whole files in file seconds instead.
  • model:"small", language:"es", and again:true (transcribe again, with another model or language).
  • find:"phrase" (or a list) reports each place it is said, with its span, the words around it and how much cutting them would remove; cut:true extracts them (tracks and force as for fablecut_silence). A version of the project is kept before the cut.

Whisper writes clean text: it often leaves out fillers ("um", "uh") and false starts, so find those by ear (fablecut_silence for the pauses), not by text. Word times are good to about a tenth of a second; listen to a cut that matters, or check it with fablecut_frame.

- +
diff --git a/docs/docs/versions/index.html b/docs/docs/versions/index.html index 1bd2bddcb..dbeeee701 100644 --- a/docs/docs/versions/index.html +++ b/docs/docs/versions/index.html @@ -75,14 +75,14 @@

Versions

Saved copies of a project you can compare and go back to, made by you, every few minutes, and before an agent edits; restoring is never destructive, and a backup carries them all.

Every edit is saved as it happens, and undo covers the session. An edit that reaches the open editor from outside (an agent, another tab) is one undo step of its own there: Ctrl+Z takes it back first, then the user's own edits. Versions are what you come back to later: full copies of a project, kept beside it, that are never overwritten. Restoring one is not destructive either - what is there is saved as a version first, so a restore can be undone by restoring that.

pathholds
projects/<id>/history/v0007.jsonthe project as it was
projects/<id>/history/v0007.meta.json{v, name, note, kind, created, revision, clips, duration, final}

A version's kind says where it came from:

kindmade
manualby you (Save version, Ctrl/Cmd+S) or an agent (fablecut_versions {action:"save"})
autoevery 10 minutes while the open project changes, whoever changes it (FABLECUT_AUTO_VERSION_MIN sets the minutes); the newest 30 are kept
agentbefore an agent's first edit of a session (again after 10 quiet minutes), and before every fablecut_set_project rewrite
restorewhat was there just before a restore

One version per project can be marked final (the cut that went out); a final version can't be deleted until it is unmarked. Manual, agent and restore versions are never pruned.

Compare tells what changed between a version and now (or two versions): clips added, removed and changed (timing, which props, keyframes, effects, transitions, source, track), media added and removed, the length, and project settings (name, canvas, frame rate, IN / OUT, tracks, markers, comps, mix, delivery, …).

Backup and recovery. Download backup saves a project with all its versions as one .fablecut-backup.json file; Import… in the dashboard brings it back, versions included. When project.json can't be read as the server starts (another tool crashed mid-write, a bad hand edit), the server keeps the broken file as project.corrupt-<time>.json and puts back the newest good copy: the latest version, or the project's last parked copy.

In the editor: Ctrl/Cmd+S saves a version of the open project. In the Projects dashboard, a project's Versions… lists its versions, newest first, with Save version (name and note), and per version Compare with now, Restore… (click twice), Mark final, Rename, Download and Delete… (click twice). Esc goes back to the projects.

Agents use fablecut_versions (or GET / POST /api/versions):

  • {} lists the open project's versions (project picks another one).
  • {action:"save", name?, note?, final?} - save one before a big or risky change (a restructure, a remake, a new grade on every shot) and when the user is happy with a cut, so there is a named point to go back to.
  • {action:"diff", version, to?} - what changed since that version (to now, or to version to). Use it to tell the user what an edit session changed.
  • {action:"restore", version} - only when the user asked; then re-read the project. {action:"update", version, name?, note?, final?} · {action:"delete", version}.

Recipes: try a bold alternative - save a version, make the change, compare, and restore if the user prefers the old one; client rounds - save "Round 1", "Round 2", … with the feedback in the note, mark the approved one final; what did the agent do? - diff against the "Before agent edits" version.

diff --git a/docs/docs/workflows/index.html b/docs/docs/workflows/index.html index 74860cbb6..58f5de337 100644 --- a/docs/docs/workflows/index.html +++ b/docs/docs/workflows/index.html @@ -75,7 +75,7 @@
keydoes
name · idup to 80 characters; the id is made from the name, and saving the same name again updates that workflow (it keeps its created)
description · tagswhat it is for (up to 600 characters) · up to 12 labels
steps1–50, each {text, call?} (a plain string is a step with only text); text up to 1000 characters
call{tool, args}: a FableCut tool (not fablecut_workflows) and the arguments it was given, up to 20 000 characters

Following one is a job for judgement, not a replay. The new project has other clips, ids and times, so a step's call is a worked example: read what the step says, look at the project (fablecut_get_project {compact:true}, fablecut_frame), and make the call that does that here. A step with no call is one only the agent's judgement can do ("pick the three strongest shots").

Agents use fablecut_workflows (or the REST endpoints below):

  • {} lists them (id, name, steps, tags, description); {action:"show", id} gives the steps to follow (id or name).
  • {action:"save", workflow:{name, description?, tags?, steps}} keeps one. Save when the user asks to keep or repeat what was just done: write each step the way you would explain it to another editor, and attach the calls that worked. A call to a tool that doesn't exist refuses the save.
  • {action:"delete", id} removes one: only when the user asks.

Recipes: "do what you did last week" - {}, then show the one that matches and do its steps; a house style for every episode - after the first episode is right, save its loudness, captions, grade and export steps as one workflow; hand a routine to another agent - the file in library/workflows/ is plain JSON any agent can read.

diff --git a/docs/index.html b/docs/index.html index 2d87e96cc..1aab6b24c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -69,6 +69,7 @@ "Media management: frame rate, codec, audio and size of every file, search, filters, sorting, favorites, tags, collections, usage counts, find-all-instances, offline detection, relink and replace; agents make folders, move and rename files and trash them into a restorable trash", "Projects dashboard: open, create from canvas presets or saved project templates, duplicate, rename, notes, tags, archive, delete and import projects", "Versions: non-destructive project history with automatic and agent versions, compare, restore, final cut, backups and crash recovery", + "Music search: openly licensed music and sound effects from Openverse, each labelled with its licence, imported with its credit kept for the export", "Workflows: saved routines of steps and the tool calls that did them, which an agent follows again on the next project", "Sequences: several timelines in one project, each with its own canvas, frame rate, mix and delivery, sharing the media and compositions", "Proxy workflow: frame-accurate H.264 proxies of 4K / HEVC / ProRes footage made in the background; edit on proxies, export from the originals", diff --git a/docs/llms.txt b/docs/llms.txt index 3f0c93ce5..7173734cc 100644 --- a/docs/llms.txt +++ b/docs/llms.txt @@ -93,6 +93,10 @@ about 150 ms. A human and an agent can work the same timeline at once. changes, and before an agent edits); compare one with now, restore it (the current state is kept as a version first), mark the final cut; backups carry every version. Agents use `fablecut_versions`. +- Music: search openly licensed music and sound effects (Openverse), every + result labelled with its licence (free to use, credit, non-commercial, share + alike, no edits); an imported track keeps its licence, and the export lists + the credits for the video's description. Agents use `fablecut_music`. - Workflows: save a routine you want repeated (a podcast clean-up, the weekly reel) as steps plus the tool calls that did them; an agent lists them and follows one on the next project. Agents use `fablecut_workflows`. diff --git a/docs/sitemap.xml b/docs/sitemap.xml index b0864c679..95ea2a468 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -54,6 +54,12 @@ monthly 0.6 + + https://fablecut.space/docs/music/ + 2026-11-23 + monthly + 0.6 + https://fablecut.space/docs/transcripts/ 2026-10-26 diff --git a/import-url.js b/import-url.js index 1f0a3b5fa..0664e2989 100644 --- a/import-url.js +++ b/import-url.js @@ -175,13 +175,18 @@ function requestOnce(u, { signal, timeoutMs }) { }); } -function saveResponse(res, u, destDir, { signal, maxBytes }) { +function saveResponse(res, u, destDir, { signal, maxBytes, name: wanted }) { const mime = (res.headers["content-type"] || "").split(";")[0].trim().toLowerCase(); if (mime === "text/html" || mime === "application/json") { res.resume(); return Promise.reject(new Error("URL did not return a media file")); } - const name = filenameFrom(u, res.headers); + let name = filenameFrom(u, res.headers); + // a caller's name (e.g. "Title - Artist.mp3") keeps the served file's extension when it has a known one + if (wanted) { + const ext = kindFromName(name) ? path.extname(name) : path.extname(String(wanted)); + name = safeName(path.basename(String(wanted), path.extname(String(wanted))).trim() + ext); + } const kind = kindFromName(name); // /media/*.svg is served same-origin as image/svg+xml. A remote file with // + diff --git a/manifest.json b/manifest.json index e323200d6..262baa947 100644 --- a/manifest.json +++ b/manifest.json @@ -46,6 +46,7 @@ { "name": "fablecut_transcribe", "description": "Transcribe speech word by word in the browser, read it on the timeline, find a phrase and cut it out (text-based editing)" }, { "name": "fablecut_captions", "description": "Make captions from the transcript (subtitle, karaoke, word highlight, word pop), timed word by word; export or import SRT / WebVTT" }, { "name": "fablecut_proxy", "description": "Make, check or delete proxies: light copies of heavy footage the editor plays while editing (export always uses the originals)" }, + { "name": "fablecut_music", "description": "Find openly licensed music and sound effects (Openverse) with each licence spelled out, import a track, and list the credits the edit needs" }, { "name": "fablecut_workflows", "description": "Save workflows (recipes of steps and the tool calls that did them) and follow them again on other projects" }, { "name": "fablecut_versions", "description": "Save, compare, restore and mark final versions of a project; restoring never loses the current state" }, { "name": "fablecut_projects", "description": "List, open, create, duplicate, rename, annotate, archive and delete projects; start new ones from canvas presets or saved project templates" }, diff --git a/mcp-server.js b/mcp-server.js index d6819c5c4..1f269d7a2 100644 --- a/mcp-server.js +++ b/mcp-server.js @@ -39,6 +39,8 @@ const CompLib = require("./comp"); const SeqLib = require("./sequences"); const Templates = require("./templates"); const Workflows = require("./workflows"); +const Music = require("./music"); +const MediaLib = require("./media-lib"); const Delivery = require("./delivery"); const { probeFile, infoForEntry } = require("./media-probe"); const { findProxies } = require("./proxy"); @@ -471,6 +473,24 @@ const TOOLS = [ }, }, }, + { + name: "fablecut_music", + description: "Find music (or sound effects) the user may use, and import a track: openly licensed audio from Openverse (Jamendo, Freesound, ccMixter, Wikimedia Commons…). Every result carries its licence and what it allows: free to use (CC0, public domain), credit the artist (BY), non-commercial only (NC), share alike (SA), or no edits (ND — music set to video counts as an edit, so it can't go into one). Search: {query:'upbeat acoustic', kind?:'music'|'sfx', length?:'shortest'|'short'|'medium'|'long' (under 30 s · 30 s–2 min · 2–10 min · over 10 min), commercial?:true (only licences that allow commercial use), edits?:true, licenses?:['by','cc0',…], page?} → 20 tracks a page (id, title, artist, length, licence). Import: {import:''} downloads it into media/ and registers it with its licence (m.license); place it with addClip on an audio track, then fablecut_beats {clipId} finds its tempo. Credits: {credits:true} → the credit lines the edit's licensed music needs (for the video's description) and any licence warnings. Tell the user which licence a track has before they publish; when they plan to monetize, search with commercial:true. Search when the user asks for music or a song; import the one they pick (or the best fit, when they asked you to choose). Anonymous Openverse use allows about 20 searches a minute and 200 a day.", + inputSchema: { + type: "object", + properties: { + query: { type: "string", description: "search: words about the music — mood, genre, instrument (e.g. 'chill lo-fi piano'); leave out for the newest tracks" }, + kind: { type: "string", enum: ["music", "sfx"], description: "search: music (default) or sound effects" }, + length: { type: "string", enum: ["shortest", "short", "medium", "long"], description: "search: under 30 s · 30 s–2 min · 2–10 min · over 10 min" }, + commercial: { type: "boolean", description: "search: only licences that allow commercial use" }, + edits: { type: "boolean", description: "search: only licences that allow edits (leaves out ND)" }, + licenses: { type: "array", items: { type: "string", enum: ["cc0", "pdm", "by", "by-sa", "by-nc", "by-nc-sa", "by-nd", "by-nc-nd", "sampling+", "nc-sampling+"] }, description: "search: only these licences" }, + page: { type: "integer", description: "search: page 1–12 of the results" }, + import: { type: "string", description: "a track id from a search: download it into media/ and register it" }, + credits: { type: "boolean", description: "the credit lines for the licensed music the edit uses" }, + }, + }, + }, { name: "fablecut_proxy", description: "Proxies: light H.264 copies (540p by default, 720p or 1080p; never larger than the source) of heavy footage — 4K, HEVC, ProRes, long phone clips — that the editor plays while the user edits, so playback and scrubbing stay smooth. Export, fablecut_frame, fablecut_scopes and every measurement always read the original, so a proxy never changes the result. Without create or delete it reports each video's proxy (ready, being made with its progress, failed, none). create:true makes them (one at a time, in the background on the server) and waits until they are done unless wait:false; delete:true removes them. mediaIds defaults to every video in the project. The user turns proxy playback on or off with the monitor's Proxy button. Needs ffmpeg on PATH.", @@ -1298,6 +1318,80 @@ async function projectsTool(args) { if (out.from) return `Opened ${describeProject(out.project)}\nThe editor switched to it (${out.from} was saved first). Read it with fablecut_get_project {compact:true} before editing.`; return describeProject(out.project); } +/** Register a file already in media/ as project media (probed) → the entry. extra: more keys (license). */ +async function registerFile(target, kind, extra = {}) { + const entry = { + id: "m_" + uid(), + name: extra.name || path.basename(target), + kind, + src: "/media/" + encodeURIComponent(path.basename(target)), + duration: kind === "image" || kind === "svg" ? undefined : ffprobeDuration(target), + }; + Object.assign(entry, infoForEntry(await probeFile(target), entry)); + if (extra.license) entry.license = extra.license; + const proj = readProject(); + // import only appends a media entry (never touches clips), so it merges + // into the live document; keep lastReadRevision in step only if it + // already was — otherwise a later set_project must still re-read + const wasCurrent = lastReadRevision === (proj.revision || 0); + proj.media.push(entry); + proj.revision = (proj.revision || 0) + 1; + writeProject(proj); + if (wasCurrent) lastReadRevision = proj.revision; + return entry; +} + +/* fablecut_music: Openverse search (music.js builds the URLs and reads the licences). */ +async function openverse(url) { + // tests only: a local stand-in for the Openverse API (its files are then on 127.0.0.1 too) + if (process.env.FABLECUT_TEST_OPENVERSE) url = url.replace(Music.API, process.env.FABLECUT_TEST_OPENVERSE); + let r; + try { + r = await fetch(url, { headers: { Accept: "application/json", "User-Agent": "FableCut (+https://fablecut.space)" }, signal: AbortSignal.timeout(20_000) }); + } catch (e) { + throw new Error("couldn't reach Openverse (" + (e && e.name === "TimeoutError" ? "no answer in 20 s" : e.message) + ")"); + } + if (r.status === 429) throw new Error("Openverse's limit for anonymous searches is used up for now (about 20 a minute, 200 a day) — try again later"); + if (r.status === 404) throw new Error("Openverse has no such track"); + const body = await r.json().catch(() => null); + if (!r.ok) throw new Error("Openverse answered " + r.status + (body && body.detail ? ": " + body.detail : "")); + return body; +} +const fmtLen = (s) => s == null ? "?:??" : Music.fmtLen(s); +function creditsText(proj) { + const list = Music.credits(proj, MediaLib.usageCounts(proj)); + if (!list.length) return ""; + return [`CREDITS — licensed music in this edit (put these in the video's description):`, + ...list.map((c) => ` ${c.needsCredit ? c.line : c.line + " (no credit required)"}`), + ...list.flatMap((c) => c.warnings.map((w) => ` ⚠ ${w}`))].join("\n"); +} +async function musicTool(args) { + if (args.credits) { + const text = creditsText(readProject()); + return text || "The edit uses no music imported with its licence (fablecut_music import) — no credits to list."; + } + if (args.import) { + const t = Music.track(await openverse(Music.trackUrl(args.import))); + if (!t.url) throw new Error("Openverse lists no file for this track"); + const got = await downloadImportUrl(t.url, MEDIA_DIR, { name: Music.fileName(t), allowLoopback: !!process.env.FABLECUT_TEST_OPENVERSE }); + const kind = kindFromName(got.name); + if (kind !== "audio" && kind !== "video") throw new Error("the track's file isn't audio: " + got.name); + const entry = await registerFile(got.target, kind, { name: `${t.title} — ${t.creator}`, license: Music.mediaLicense(t) }); + return [`Imported "${t.title}" by ${t.creator} → ${entry.id} (${fmtLen(entry.duration)}, ${entry.src})`, + `Licence: ${t.license.label} — ${t.license.note}.`, + t.license.credit ? `Credit: ${Music.creditLine(entry.license)}` : "", + `Place it: {op:"addClip", clip:{mediaId:"${entry.id}", kind:"audio", track:"A1", start:0, in:0, duration:<≤ ${entry.duration || "its length"}>}} — then fablecut_beats {clipId} for its tempo.`, + ].filter(Boolean).join("\n"); + } + if (args.page != null && !(Number.isInteger(args.page) && args.page >= 1 && args.page <= Music.MAX_PAGE)) throw new Error(`page is 1–${Music.MAX_PAGE}`); + const res = Music.results(await openverse(Music.searchUrl(args)), args.page || 1); + if (!res.tracks.length) return `No ${args.kind === "sfx" ? "sound effects" : "music"} found${args.query ? ` for "${args.query}"` : ""} — try other words, or drop a filter.`; + return [`${res.count >= 240 ? "240+" : res.count} result(s), page ${res.page}/${res.pages || 1}${args.query ? ` for "${args.query}"` : " (newest)"}. {import:""} downloads one.`, + ...res.tracks.map((t, i) => `${i + 1}. ${t.id} "${t.title}" — ${t.creator} · ${fmtLen(t.duration)} · ${t.license.label} [${t.flags.join(", ")}]` + + (t.genres.length ? ` · ${t.genres.join("/")}` : "") + (t.source ? ` · ${t.source}` : "")), + Music.ABOUT].join("\n"); +} + /* fablecut_workflows: saved recipes in library/workflows/, read and written here directly (like saved presets), so it works without the editor server. */ function savedWorkflows() { @@ -1490,7 +1584,9 @@ async function exportTool(args) { if (r.status !== 200) throw new Error(r.body?.error || "lost track of the export job"); job = r.body; } - return startNote + describeExportJob(job); + // licensed music the edit uses: the credits belong in the video's description + const credits = job.status === "done" ? creditsText(readProject()) : ""; + return startNote + describeExportJob(job) + (credits ? "\n" + credits : ""); } /* ── Frames (fablecut_frame) ── @@ -1718,6 +1814,8 @@ async function callTool(name, args, attempt = 0) { return versionsTool(args); case "fablecut_workflows": return workflowsTool(args); + case "fablecut_music": + return musicTool(args); case "fablecut_status": { const up = await ensureUIServer(); const proj = readProject(); @@ -2056,23 +2154,7 @@ async function callTool(name, args, attempt = 0) { fs.copyFileSync(src, target); } if (!kind) throw new Error("Unsupported media type"); - const entry = { - id: "m_" + uid(), - name: path.basename(target), - kind, - src: "/media/" + encodeURIComponent(path.basename(target)), - duration: kind === "image" || kind === "svg" ? undefined : ffprobeDuration(target), - }; - Object.assign(entry, infoForEntry(await probeFile(target), entry)); - const proj = readProject(); - // import only appends a media entry (never touches clips), so it merges - // into the live document; keep lastReadRevision in step only if it - // already was — otherwise a later set_project must still re-read - const wasCurrent = lastReadRevision === (proj.revision || 0); - proj.media.push(entry); - proj.revision = (proj.revision || 0) + 1; - writeProject(proj); - if (wasCurrent) lastReadRevision = proj.revision; + const entry = await registerFile(target, kind); return `Imported → ${JSON.stringify(entry)}\n` + (entry.duration == null && kind !== "image" ? "Note: duration unknown (no ffprobe). The browser UI will probe and fill it in; re-read the project before trimming this media." diff --git a/music.js b/music.js new file mode 100644 index 000000000..495143b1f --- /dev/null +++ b/music.js @@ -0,0 +1,195 @@ +/* FableCut music search — openly licensed music and sound effects from + Openverse (https://openverse.org), with each track's licence spelled out. + Zero dependencies; loaded by the editor as a plain script (global + `FableCutMusic`) and required by the MCP server, so the bin's Music tab and + `fablecut_music` search the same way and label licences the same way. + + Openverse indexes Jamendo, Freesound, ccMixter, Wikimedia Commons and more. + Its API needs no key: anonymous use allows 20 results a page, 240 results + per search (12 pages) and about 200 searches a day per address. Its terms + ask apps to say they are made with Openverse (not endorsed by it) and to + credit the works, which is what `credits` and `creditLine` are for. + + searchUrl(opts) → the API URL · track(result) → a plain track · licence(code, + version) → what it allows · mediaLicense(track) → what a media entry keeps + (m.license) · credits(doc, uses) → the credits the edit needs. */ +(function (root, factory) { + const api = factory(); + if (typeof module === "object" && module.exports) module.exports = api; + else root.FableCutMusic = api; +})(typeof self !== "undefined" ? self : this, function () { + "use strict"; + + const API = "https://api.openverse.org/v1/audio/"; + const PAGE_SIZE = 20; // the most an anonymous request may ask for + const MAX_PAGE = 12; // 240 results deep + const MAX_QUERY = 200; + // Openverse's length buckets, checked against its results + const LENGTHS = { + shortest: "under 30 s", short: "30 s – 2 min", medium: "2 – 10 min", long: "over 10 min", + }; + // sound effects: Freesound's (Openverse leaves their category empty, so a category filter misses them) + const KINDS = { music: { category: "music" }, sfx: { source: "freesound" } }; + const MOODS = ["upbeat", "chill", "cinematic", "epic", "lo-fi", "acoustic", "electronic", + "happy", "sad", "ambient", "piano", "corporate", "hip hop", "rock"]; + + /* What each licence lets a video editor do. edits: may it be cut, looped and + put under picture? Creative Commons counts music synced to moving images as + an adaptation, so ND (no derivatives) music can't go into an edit. */ + const LICENSES = { + cc0: { label: "CC0", commercial: true, edits: true, credit: false, note: "public domain dedication — use it any way you like" }, + pdm: { label: "Public domain", commercial: true, edits: true, credit: false, note: "public domain — use it any way you like" }, + by: { label: "CC BY", commercial: true, edits: true, credit: true, note: "any use, credit the artist" }, + "by-sa": { label: "CC BY-SA", commercial: true, edits: true, credit: true, note: "any use, credit the artist; the video must be shared under CC BY-SA too" }, + "by-nc": { label: "CC BY-NC", commercial: false, edits: true, credit: true, note: "non-commercial only (no ads, sponsored or monetized videos), credit the artist" }, + "by-nc-sa": { label: "CC BY-NC-SA", commercial: false, edits: true, credit: true, note: "non-commercial only, credit the artist; the video must be shared under CC BY-NC-SA too" }, + "by-nd": { label: "CC BY-ND", commercial: true, edits: false, credit: true, note: "no derivatives: music set to video counts as one, so it can't go into an edit" }, + "by-nc-nd": { label: "CC BY-NC-ND", commercial: false, edits: false, credit: true, note: "non-commercial and no derivatives: music set to video counts as one, so it can't go into an edit" }, + "sampling+": { label: "Sampling+", commercial: false, edits: true, credit: true, note: "parts may be sampled and remixed, also commercially (not for ads); the whole track only non-commercially; credit the artist" }, + "nc-sampling+": { label: "NC Sampling+", commercial: false, edits: true, credit: true, note: "parts may be sampled and remixed non-commercially; credit the artist" }, + }; + + /** What a licence allows: {code, label ("CC BY 4.0"), commercial, edits, credit, note, url}. */ + function licence(code, version, url) { + const c = String(code || "").toLowerCase(); + const base = LICENSES[c] || { label: c ? c.toUpperCase() : "Unknown licence", commercial: false, edits: false, credit: true, note: "unknown licence — check the track's page before using it" }; + const v = version && !/^(cc0|pdm)$/.test(c) ? String(version) : ""; + return { code: c, label: base.label + (v ? " " + v : ""), commercial: base.commercial, edits: base.edits, + credit: base.credit, note: base.note, url: url || "" }; + } + + /** The words that sum a licence up for a badge: "free to use", "credit", "non-commercial", "no edits", "share alike". */ + function flags(lic) { + const out = []; + if (!lic.credit && lic.commercial && lic.edits) out.push("free to use"); + if (lic.credit) out.push("credit"); + if (!lic.commercial) out.push("non-commercial"); + if (!lic.edits) out.push("no edits"); + if (/-sa$/.test(lic.code)) out.push("share alike"); + return out; + } + + /** The Openverse search URL. opts: {query, kind:'music'|'sfx', length:'shortest'|'short'|'medium'|'long', + * commercial:true (only licences that allow commercial use), edits:true (only ones that allow + * edits), licenses:[codes], page}. */ + function searchUrl(opts = {}) { + const q = String(opts.query == null ? "" : opts.query).trim().slice(0, MAX_QUERY); + const p = new URLSearchParams(); + if (q) p.set("q", q); + else p.set("unstable__sort_by", "indexed_on"); // nothing typed: the newest + const kind = KINDS[opts.kind] || KINDS.music; + for (const k of Object.keys(kind)) p.set(k, kind[k]); + if (opts.length && LENGTHS[opts.length]) p.set("length", opts.length); + const types = []; + if (opts.commercial) types.push("commercial"); + if (opts.edits) types.push("modification"); + if (types.length) p.set("license_type", types.join(",")); + const lic = (opts.licenses || []).map((l) => String(l).toLowerCase()).filter((l) => LICENSES[l]); + if (lic.length) p.set("license", lic.join(",")); + p.set("mature", "false"); + p.set("page_size", String(PAGE_SIZE)); + const page = Math.max(1, Math.min(MAX_PAGE, Math.floor(+opts.page || 1))); + if (page > 1) p.set("page", String(page)); + return API + "?" + p.toString(); + } + + /** One track's details by its Openverse id. */ + function trackUrl(id) { + if (!/^[0-9a-f-]{36}$/i.test(String(id || ""))) throw new Error("not an Openverse track id: " + id); + return API + String(id).toLowerCase() + "/"; + } + + // titles and names come HTML-escaped from some sources ("Jaief & Asong") + const ENT = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", "#39": "'" }; + const unescape = (s) => String(s).replace(/&(amp|lt|gt|quot|apos|#39);/g, (_, e) => ENT[e]).trim(); + + /** An Openverse result as a plain track. */ + function track(r) { + r = r || {}; + const lic = licence(r.license, r.license_version, r.license_url); + return { + id: r.id, title: unescape(r.title || "Untitled"), creator: unescape(r.creator || "Unknown artist"), + creatorUrl: r.creator_url || "", duration: r.duration ? Math.round(r.duration / 100) / 10 : null, + license: lic, flags: flags(lic), + url: r.url || "", page: r.foreign_landing_url || "", source: r.source || r.provider || "", + genres: (r.genres || []).slice(0, 6), tags: (r.tags || []).map((t) => t && t.name).filter(Boolean).slice(0, 10), + filetype: r.filetype || "", attribution: r.attribution || "", + }; + } + + /** A search answer → {count, pages, page, tracks}. */ + function results(json, page) { + json = json || {}; + return { count: json.result_count || 0, pages: Math.min(json.page_count || 0, MAX_PAGE), page: page || json.page || 1, + tracks: (json.results || []).filter((r) => r && r.url).map(track) }; + } + + /** 125.4 → "2:05". */ + function fmtLen(sec) { + const s = Math.round(+sec || 0); + return Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"); + } + + /** A friendly file name for the download: "Title - Artist.mp3". */ + function fileName(t) { + const ft = String(t.filetype || "mp3").toLowerCase(); + const ext = { mp32: "mp3", mp31: "mp3", oga: "ogg", opus: "ogg", aif: "wav", aiff: "wav" }[ft] || ft; + return (t.title + " - " + t.creator).replace(/[^\w.\- ()\[\]]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 100) + "." + ext; + } + + /** What a media entry keeps about where its file came from (m.license). */ + function mediaLicense(t) { + return { code: t.license.code, label: t.license.label, url: t.license.url, title: t.title, creator: t.creator, + page: t.page, source: t.source, openverse: t.id, attribution: t.attribution }; + } + + /** A media entry's licence as stored: only its text fields, trimmed; null when it isn't one. */ + function cleanLicense(l) { + if (!l || typeof l !== "object" || Array.isArray(l) || !l.code) return null; + const out = {}; + for (const k of ["code", "label", "url", "title", "creator", "page", "source", "openverse", "attribution"]) + if (typeof l[k] === "string" && l[k]) out[k] = l[k].slice(0, k === "attribution" ? 1000 : 300); + if (!out.label) out.label = licence(out.code).label; + return out; + } + + /** The credit to put in a video's description: "Title" by Artist (source) — CC BY 4.0 — page. */ + function creditLine(l) { + if (!l) return ""; + return `"${l.title}" by ${l.creator}` + (l.source ? ` (${l.source})` : "") + ` — ${l.label}` + + (l.url ? ` (${l.url})` : "") + (l.page ? ` — ${l.page}` : ""); + } + + /** The credits an edit needs: every licensed file the edit uses (a denoised + * copy counts as its original). uses: media id → placements (MediaLib.usageCounts). + * → [{mediaId, name, license, line, warnings}] */ + function credits(doc, uses) { + const media = (doc && doc.media) || []; + const byId = new Map(media.map((m) => [m.id, m])); + const origin = (m) => { + for (let i = 0; m && !m.license && m.derivedFrom && i < 8; i++) m = byId.get(m.derivedFrom); + return m && m.license ? m : null; + }; + const out = [], seen = new Set(); + for (const m of media) { + if (!(uses && uses.get ? uses.get(m.id) : 0)) continue; + const o = origin(m); + if (!o) continue; + const key = o.license.openverse || o.id; + if (seen.has(key)) continue; + seen.add(key); + const lic = licence(o.license.code); + const warnings = []; + if (!lic.edits) warnings.push(lic.label + " allows no derivatives — music set to video counts as one"); + if (!lic.commercial) warnings.push(lic.label + " is non-commercial only"); + if (/-sa$/.test(lic.code)) warnings.push(lic.label + ": share the video under the same licence"); + out.push({ mediaId: o.id, name: o.name, license: o.license, needsCredit: lic.credit, line: creditLine(o.license), warnings }); + } + return out; + } + + const ABOUT = "Music from Openverse (openverse.org) — made with Openverse, not endorsed or certified by it. Each track's licence is the artist's: check it before you publish."; + + return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, LICENSES, ABOUT, + licence, flags, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; +}); diff --git a/project-ops.js b/project-ops.js index fff094811..a7c09056f 100644 --- a/project-ops.js +++ b/project-ops.js @@ -1216,6 +1216,7 @@ (opts.proxy && m.kind === "video" && opts.proxy(m) ? ` proxy:${opts.proxy(m)}p` : "") + (m.favorite ? " ★" : "") + (m.tags && m.tags.length ? " " + m.tags.map((t) => "#" + t.replace(/\s+/g, "_")).join(" ") : "") + (m.folderId ? ` folder:${m.folderId}` : "") + ` uses:${uses.get(m.id) || 0}` + + (m.license && m.license.label ? ` licence:"${m.license.label}"` : "") + (m.derivedFrom ? ` (${m.denoise ? "denoised " + m.denoise : "derived"} from ${m.derivedFrom})` : ""); }); })(), diff --git a/server.js b/server.js index c9b540bec..7d87a9eda 100644 --- a/server.js +++ b/server.js @@ -1200,7 +1200,8 @@ const server = http.createServer(async (req, res) => { } /* API: download an HTTPS URL into ./media (same-origin src after import). - Body {url}. Rejects http/file/local/private targets. Does not register + Body {url, name?} (name: the file name to save as; its extension follows + the download). Rejects http/file/local/private targets. Does not register project media — the client / MCP tool does that, matching /api/upload. */ if (p === "/api/import-url" && req.method === "POST") { try { @@ -1212,6 +1213,7 @@ const server = http.createServer(async (req, res) => { res.on("close", () => { if (!res.writableEnded) ac.abort(); }); const { target, name } = await downloadImportUrl(opts.url, MEDIA_DIR, { signal: ac.signal, + name: typeof opts.name === "string" && opts.name.trim() ? opts.name : undefined, // test/rest-api.test.js: HTTP to 127.0.0.1 only (loopback fixture). // Does not disable SSRF for LAN / metadata / other private ranges. allowLoopback: process.env.FABLECUT_TEST_IMPORT_ALLOW_PRIVATE === "1", diff --git a/style.css b/style.css index d38fa0470..f4575e305 100644 --- a/style.css +++ b/style.css @@ -4825,3 +4825,34 @@ input[type=number]:hover::-webkit-inner-spin-button { opacity: .8; } @media (forced-colors: active) { .cmdk-item.active { outline: 2px solid Highlight; background: Highlight; color: HighlightText; } } + +/* Music tab (Openverse search) */ +.music-search { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; } +.music-search input[type="search"] { width: 100%; box-sizing: border-box; background: var(--panel); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font: 12px "Segoe UI", sans-serif; padding: 4px 8px; outline: none; user-select: text; } +.music-search input[type="search"]:focus { border-color: var(--accent); } +.music-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; } +.music-filters select { flex: 1 1 90px; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font: 11px "Segoe UI", sans-serif; padding: 3px 4px; } +.music-commercial { display: flex; align-items: center; gap: 4px; color: var(--dim); white-space: nowrap; cursor: pointer; } +.music-moods { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0 6px; } +.music-moods .bin-tag { font-size: 11px; padding: 2px 8px; } +.music-status { font-size: 11px; color: var(--dim); padding: 2px 2px 4px; } +.music-status.err { color: #f0c14a; } +.music-item { align-items: center; } +.music-item .bin-meta { min-width: 0; } +.music-item .music-play, .music-item .music-get { flex: none; width: 26px; padding: 3px 0; text-align: center; } +.music-lic { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 2px; font-size: 10px; color: var(--dim); } +.music-badge { padding: 0 5px; border-radius: 6px; background: #4f8cff26; color: #b9d0ff; text-decoration: none; white-space: nowrap; line-height: 1.5; } +.music-badge.free { background: #2fbf7126; color: #9be3bc; } +.music-badge.nc { background: #f0c14a24; color: #f0c14a; } +.music-badge.no { background: #e5484d26; color: #ff9c9f; } +.music-page { color: var(--dim); } +.music-page:hover, .music-badge:hover { text-decoration: underline; } +.music-more { align-self: center; margin: 4px 0; } +.music-about { font-size: 10px; line-height: 1.45; color: var(--dim); margin: 8px 2px 2px; } +.music-about a { color: inherit; } +.bin-info .bin-copy-credit { margin: 6px 0 2px; } +.export-credits { margin: 0 0 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-sub); font-size: 12px; line-height: 1.4; } +.export-credits-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; } +.export-credits-head .btn { margin-left: auto; } +.export-credit { color: var(--dim); overflow-wrap: anywhere; } +.export-credit.warn { color: #f0c14a; } diff --git a/test/music.test.js b/test/music.test.js new file mode 100644 index 000000000..931b6337b --- /dev/null +++ b/test/music.test.js @@ -0,0 +1,176 @@ +/* Music search (music.js, the bin's Music tab, fablecut_music): openly licensed + tracks from Openverse, each with its licence spelled out, imported with that + licence kept on the media entry so the edit's credits can be listed. */ +"use strict"; +const test = require("node:test"); +const assert = require("node:assert/strict"); +const fs = require("node:fs"); +const http = require("node:http"); +const path = require("node:path"); +const M = require("../music"); +const ProjectOps = require("../project-ops"); +const MediaLib = require("../media-lib"); +const { makeDataDir, seedProject, readProject, startMcp } = require("./helpers"); + +const result = (over = {}) => ({ + id: "c14c7353-1688-4204-9af0-64c0a5e8ccc3", title: "Night & Day", creator: "Jahzzar", + license: "by-sa", license_version: "3.0", license_url: "https://creativecommons.org/licenses/by-sa/3.0/", + url: "https://prod-1.storage.jamendo.com/?trackid=918921&format=mp32", foreign_landing_url: "https://www.jamendo.com/track/918921", + source: "jamendo", filetype: "mp32", duration: 169480, genres: ["ambient"], tags: [{ name: "calm" }], + ...over, +}); + +test("licences say what a video editor may do with a track", () => { + const by = M.licence("by", "4.0"); + assert.equal(by.label, "CC BY 4.0"); + assert.deepEqual(M.flags(by), ["credit"]); + assert.deepEqual(M.flags(M.licence("cc0", "1.0")), ["free to use"]); + assert.equal(M.licence("cc0", "1.0").label, "CC0", "no version on CC0"); + assert.deepEqual(M.flags(M.licence("by-nc-nd")), ["credit", "non-commercial", "no edits"]); + assert.deepEqual(M.flags(M.licence("by-sa")), ["credit", "share alike"]); + assert.equal(M.licence("by-nd").edits, false, "music set to video is a derivative"); + const odd = M.licence("mystery"); + assert.equal(odd.commercial, false); + assert.match(odd.note, /unknown licence/); +}); + +test("searchUrl builds the Openverse query", () => { + const u = new URL(M.searchUrl({ query: " chill lo-fi ", length: "short", commercial: true, edits: true, page: 3 })); + assert.equal(u.origin + u.pathname, M.API); + assert.equal(u.searchParams.get("q"), "chill lo-fi"); + assert.equal(u.searchParams.get("category"), "music"); + assert.equal(u.searchParams.get("length"), "short"); + assert.equal(u.searchParams.get("license_type"), "commercial,modification"); + assert.equal(u.searchParams.get("page_size"), "20"); + assert.equal(u.searchParams.get("page"), "3"); + assert.equal(u.searchParams.get("mature"), "false"); + const sfx = new URL(M.searchUrl({ query: "whoosh", kind: "sfx", length: "nope", page: 99, licenses: ["cc0", "junk"] })); + assert.equal(sfx.searchParams.get("source"), "freesound", "Freesound sounds have no category in Openverse"); + assert.equal(sfx.searchParams.get("category"), null); + assert.equal(sfx.searchParams.get("length"), null, "an unknown length is left out"); + assert.equal(sfx.searchParams.get("page"), "12", "anonymous search goes 12 pages deep"); + assert.equal(sfx.searchParams.get("license"), "cc0"); + const newest = new URL(M.searchUrl({})); + assert.equal(newest.searchParams.get("q"), null); + assert.equal(newest.searchParams.get("unstable__sort_by"), "indexed_on"); + assert.equal(M.searchUrl({ query: "x".repeat(300) }).match(/q=(x+)/)[1].length, 200); + assert.throws(() => M.trackUrl("../etc"), /not an Openverse track id/); +}); + +test("results become plain tracks", () => { + const t = M.track(result()); + assert.equal(t.title, "Night & Day", "HTML entities are decoded"); + assert.equal(t.duration, 169.5); + assert.equal(t.license.label, "CC BY-SA 3.0"); + assert.deepEqual(t.tags, ["calm"]); + assert.equal(M.fileName(t), "Night Day - Jahzzar.mp3", "mp32 is an mp3"); + assert.equal(M.fileName({ ...t, filetype: "oga" }), "Night Day - Jahzzar.ogg"); + assert.equal(M.fmtLen(59.7), "1:00"); + const r = M.results({ result_count: 999, page_count: 50, results: [result(), result({ url: "" })] }, 2); + assert.equal(r.tracks.length, 1, "a result without a file is dropped"); + assert.equal(r.pages, 12); + assert.equal(r.page, 2); +}); + +test("a media entry keeps its licence, and the edit lists its credits", () => { + const lic = M.mediaLicense(M.track(result())); + const kept = M.cleanLicense({ ...lic, extra: { a: 1 }, title: 5 }); + assert.equal(kept.code, "by-sa"); + assert.equal(kept.title, undefined, "only text fields are kept"); + assert.equal(kept.extra, undefined, "unknown keys are dropped"); + assert.equal(M.cleanLicense({ label: "x" }), null, "no code, no licence"); + assert.equal(M.cleanLicense("CC BY"), null); + const doc = seedProject({ + media: [ + { id: "m_song", name: "song", kind: "audio", src: "/media/s.mp3", license: lic }, + { id: "m_den", name: "song (denoised)", kind: "audio", src: "/media/s.flac", derivedFrom: "m_song" }, + { id: "m_fx", name: "fx", kind: "audio", src: "/media/fx.mp3", license: M.mediaLicense(M.track(result({ id: "eab8a6e2-0ac8-4615-9e0d-ebde30523783", license: "cc0", license_version: "1.0", title: "Whoosh" }))) }, + { id: "m_nd", name: "nd", kind: "audio", src: "/media/nd.mp3", license: M.mediaLicense(M.track(result({ id: "bb6de945-d963-4f8e-9c60-3a786fa9aab2", license: "by-nc-nd" }))) }, + ], + clips: [ + { id: "c1", mediaId: "m_den", kind: "audio", track: "A1", start: 0, in: 0, duration: 5 }, + { id: "c2", mediaId: "m_song", kind: "audio", track: "A2", start: 0, in: 0, duration: 5 }, + { id: "c3", mediaId: "m_fx", kind: "audio", track: "A3", start: 1, in: 0, duration: 1 }, + ], + }); + const list = M.credits(doc, MediaLib.usageCounts(doc)); + assert.equal(list.length, 2, "the denoised copy is the same song; the unused ND track isn't listed"); + assert.equal(list[0].mediaId, "m_song"); + assert.match(list[0].line, /^"Night & Day" by Jahzzar \(jamendo\) — CC BY-SA 3\.0 \(https:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0\/\) — https:\/\/www\.jamendo\.com\/track\/918921$/); + assert.deepEqual(list[0].warnings, ["CC BY-SA: share the video under the same licence"]); + assert.equal(list[1].needsCredit, false, "CC0 needs no credit"); + doc.clips.push({ id: "c4", mediaId: "m_nd", kind: "audio", track: "A4", start: 0, in: 0, duration: 2 }); + const nd = M.credits(doc, MediaLib.usageCounts(doc)).find((c) => c.mediaId === "m_nd"); + assert.deepEqual(nd.warnings, ["CC BY-NC-ND allows no derivatives — music set to video counts as one", "CC BY-NC-ND is non-commercial only"]); + assert.match(ProjectOps.compactView(doc), /m_song audio "song".* licence:"CC BY-SA 3\.0"/); +}); + +/* A stand-in for the Openverse API on 127.0.0.1, serving one track and its file. */ +async function fakeOpenverse(t, { limited = false } = {}) { + const wav = Buffer.alloc(44 + 8000); + wav.write("RIFF", 0); wav.writeUInt32LE(36 + 8000, 4); wav.write("WAVEfmt ", 8); wav.writeUInt32LE(16, 16); + wav.writeUInt16LE(1, 20); wav.writeUInt16LE(1, 22); wav.writeUInt32LE(8000, 24); wav.writeUInt32LE(8000, 28); + wav.writeUInt16LE(1, 32); wav.writeUInt16LE(8, 34); wav.write("data", 36); wav.writeUInt32LE(8000, 40); + const seen = []; + const srv = http.createServer((req, res) => { + seen.push(req.url); + const base = `http://127.0.0.1:${srv.address().port}`; + const track = result({ url: base + "/file.wav", filetype: "wav", duration: 1000 }); + if (limited) { res.writeHead(429, { "Content-Type": "application/json" }); return res.end("{}"); } + if (req.url === "/file.wav") { res.writeHead(200, { "Content-Type": "audio/wav" }); return res.end(wav); } + if (req.url.startsWith("/v1/audio/?")) { res.writeHead(200, { "Content-Type": "application/json" }); return res.end(JSON.stringify({ result_count: 1, page_count: 1, results: [track] })); } + if (req.url === `/v1/audio/${track.id}/`) { res.writeHead(200, { "Content-Type": "application/json" }); return res.end(JSON.stringify(track)); } + res.writeHead(404, { "Content-Type": "application/json" }); res.end("{}"); + }); + await new Promise((r) => srv.listen(0, "127.0.0.1", r)); + t.after(() => srv.close()); + return { url: `http://127.0.0.1:${srv.address().port}/v1/audio/`, seen }; +} + +test("fablecut_music searches, imports a track with its licence, and lists the credits", async (t) => { + const ov = await fakeOpenverse(t); + const dir = makeDataDir(t); + const mcp = startMcp(t, dir, { FABLECUT_NO_AUTOSTART: "1", FABLECUT_TEST_OPENVERSE: ov.url }); + const text = async (args) => { const r = await mcp.callTool("fablecut_music", args); return (r.isError ? "ERROR " : "") + r.content[0].text; }; + + const found = await text({ query: "calm night", commercial: true }); + assert.match(found, /^1 result\(s\), page 1\/1 for "calm night"/); + assert.match(found, /1\. c14c7353-1688-4204-9af0-64c0a5e8ccc3 "Night & Day" — Jahzzar · 0:01 · CC BY-SA 3\.0 \[credit, share alike\] · ambient · jamendo/); + assert.match(found, /made with Openverse, not endorsed/); + assert.match(ov.seen[0], /q=calm\+night&category=music&license_type=commercial/); + assert.match(await text({ page: 0 }), /ERROR .*page is 1–12/); + + const got = await text({ import: "c14c7353-1688-4204-9af0-64c0a5e8ccc3" }); + assert.match(got, /^Imported "Night & Day" by Jahzzar → (m_\w+)/); + assert.match(got, /Licence: CC BY-SA 3\.0 — any use, credit the artist; the video must be shared under CC BY-SA too\./); + const doc = readProject(dir); + const m = doc.media.find((x) => x.license); + assert.equal(m.name, "Night & Day — Jahzzar"); + assert.equal(m.src, "/media/Night%20Day%20-%20Jahzzar.wav", "named after the track, with the served file's extension"); + assert.ok(fs.existsSync(path.join(dir, "media", "Night Day - Jahzzar.wav"))); + assert.equal(m.license.openverse, "c14c7353-1688-4204-9af0-64c0a5e8ccc3"); + + assert.match(await text({ credits: true }), /no credits to list/, "imported but not used yet"); + await mcp.callTool("fablecut_patch_project", { ops: [{ op: "addClip", clip: { mediaId: m.id, kind: "audio", track: "A1", start: 0, in: 0, duration: 1 } }] }); + const credits = await text({ credits: true }); + assert.match(credits, /^CREDITS — licensed music in this edit/); + assert.match(credits, /"Night & Day" by Jahzzar \(jamendo\) — CC BY-SA 3\.0/); + assert.match(credits, /⚠ CC BY-SA: share the video under the same licence/); +}); + +test("fablecut_music explains Openverse's rate limit", async (t) => { + const ov = await fakeOpenverse(t, { limited: true }); + const dir = makeDataDir(t); + const mcp = startMcp(t, dir, { FABLECUT_NO_AUTOSTART: "1", FABLECUT_TEST_OPENVERSE: ov.url }); + const r = await mcp.callTool("fablecut_music", { query: "x" }); + assert.equal(r.isError, true); + assert.match(r.content[0].text, /limit for anonymous searches is used up/); +}); + +test("the editor keeps a media entry's licence when it saves", () => { + const src = fs.readFileSync(path.join(__dirname, "..", "app.js"), "utf8"); + assert.match(src, /const lic = FableCutMusic\.cleanLicense\(m\.license\);\s*if \(lic\) mo\.license = lic;/); + const html = fs.readFileSync(path.join(__dirname, "..", "index.html"), "utf8"); + assert.ok(html.indexOf('src="music.js"') < html.indexOf('src="app.js"'), "music.js loads before app.js"); + assert.match(html, /data-tab="music"/); +}); From 8396363502e70e735ac75d5ef95c69249705b3a1 Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:34:30 +0530 Subject: [PATCH 2/9] Bin: sound effects search in the SFX tab; tabs grouped into Project, Audio and Graphics Online sound effects (Freesound via Openverse) move from the Music tab's dropdown into the SFX tab, above the library/sfx files. The bin's seven tabs become Project, Audio (Music, SFX) and Graphics (Elements, SVG, Shapes, Templates), each group with its own row and remembering its last tab. --- CHANGELOG.md | 13 +- CLAUDE.md | 13 +- README.md | 2 +- app.js | 220 +++++++++++++++---------- docs/demo/app.js | 220 +++++++++++++++---------- docs/demo/index.html | 16 +- docs/demo/music.js | 9 +- docs/demo/style.css | 21 +++ docs/docs/audio/index.html | 2 +- docs/docs/captions/index.html | 2 +- docs/docs/color/index.html | 2 +- docs/docs/compositing/index.html | 2 +- docs/docs/compositions/index.html | 2 +- docs/docs/editing/index.html | 2 +- docs/docs/export/index.html | 2 +- docs/docs/frames/index.html | 2 +- docs/docs/library/index.html | 2 +- docs/docs/masks/index.html | 2 +- docs/docs/media/index.html | 2 +- docs/docs/motion-paths/index.html | 2 +- docs/docs/motion/index.html | 2 +- docs/docs/music/index.html | 4 +- docs/docs/presets-templates/index.html | 2 +- docs/docs/project-json/index.html | 2 +- docs/docs/projects/index.html | 2 +- docs/docs/props/index.html | 2 +- docs/docs/recipes/index.html | 2 +- docs/docs/remake/index.html | 2 +- docs/docs/rest-api/index.html | 2 +- docs/docs/sequences/index.html | 2 +- docs/docs/tracking/index.html | 2 +- docs/docs/transcripts/index.html | 2 +- docs/docs/versions/index.html | 2 +- docs/docs/workflows/index.html | 2 +- index.html | 16 +- music.js | 9 +- style.css | 21 +++ test/music.test.js | 3 +- 38 files changed, 387 insertions(+), 230 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e91cd86da..e2a6bbc53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- **Music.** The bin's new **Music** tab searches openly licensed music and - sound effects from Openverse (Jamendo, Freesound, ccMixter, Wikimedia Commons - and more), by mood, genre or instrument, with a length filter and **OK to - monetize**. Every result shows its licence and what it allows: free to use, +- **Music.** The bin's new **Music** tab searches openly licensed music from + Openverse (Jamendo, ccMixter, Wikimedia Commons and more) by mood, genre or + instrument, with a length filter and **OK to monetize**; the **SFX** tab now + searches sound effects (Freesound) the same way, above your library files. Every result shows its licence and what it allows: free to use, credit the artist, non-commercial, share alike, or no edits. Preview a track, import it, or add it at the playhead. An imported track keeps its licence, its **Media info** has **Copy credit**, and the Export dialog lists the edit's @@ -19,6 +19,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `fablecut_music` tool to search, import a track and list the credits, and `fablecut_export` adds the credits to its reply. +### Changed +- **The bin's tabs are grouped**: Project, Audio (Music, SFX) and Graphics + (Elements, SVG, Shapes, Templates), each group with its own row of tabs, so + the row no longer crowds a narrow panel. + ### Fixed - **Frames and exports from a background tab.** When the editor tab was in the background, every seek waited about 3 s for a frame the browser never shows diff --git a/CLAUDE.md b/CLAUDE.md index 848bcee3f..c475110d6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -215,11 +215,13 @@ Rules: ## The asset library (`./library/`) — default media -Reusable assets, visible in the editor's left-panel tabs and never copied: +Reusable assets, visible in the editor's left-panel tabs and never copied. The +bin's tabs are **Project**, **Audio** (Music, SFX) and **Graphics** (Elements, +SVG, Shapes, Templates); a group remembers the tab last open in it. | Folder | Editor tab | Purpose | | ----------- | ------------ | ------- | -| `library/sfx/` | **Sound FX** | whooshes, impacts, risers, UI clicks | +| `library/sfx/` | **SFX** | whooshes, impacts, risers, UI clicks (the tab also searches sound effects online — see "Music") | | `library/elements/` | **Elements** | overlay art: alpha PNGs, light leaks, textures, stickers | | `library/svg/` | **SVG** | animated vector graphics **you author** (convention below) | | `library/fonts/` | font editor | `.ttf/.otf/.woff/.woff2`, auto-registered, family name = file name; a variable font draws every `weight` | @@ -742,9 +744,10 @@ and other sequences; a denoised copy counts as its original), one line each: with a warning for a licence that limits the video (non-commercial, share alike, no derivatives). They go in the video's description. -In the editor: the bin's **Music** tab has the search box, **Music / Sound -effects**, a length, **OK to monetize** (only licences that allow commercial -use and edits), and mood chips to start from. Each result shows its artist, +In the editor: the bin's **Music** tab has the search box, a length, **OK to +monetize** (only licences that allow commercial use and edits), and mood chips +to start from. The **SFX** tab has the same search for sound effects (with +chips such as whoosh, impact, riser) above the files in `library/sfx/`. Each result shows its artist, length, genres, source, a licence badge (green: free to use, blue: credit, amber: non-commercial, red: no edits; hover for what it allows, click for the licence) and a link to its page. **▶** previews it, **⬇** imports it into the diff --git a/README.md b/README.md index c538d3b3c..72d815426 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ big operation (cutting silences, snapping to the beat, reframing), and every - **Projects** — a dashboard of every project with pictures, notes and tags: open, create from a canvas or a saved project template, duplicate, rename, archive and delete, import an old project file; media is shared, so copies cost no footage - **Sequences** — several timelines in one project (a 16:9 and a 9:16 cut, cut-downs, alternatives) sharing its media and compositions, each with its own canvas, frame rate, mix and delivery settings; switch from the menu at the left of the timeline toolbar - **Versions** — non-destructive history: save a version (Ctrl/Cmd+S), automatic versions every 10 minutes and before an agent edits, compare a version with now, restore (the current state is kept as a version first), mark the final cut; backups carry every version, and an unreadable `project.json` is recovered at startup -- **Music** — the bin's **Music** tab searches openly licensed music and sound effects from Openverse (Jamendo, Freesound, ccMixter…), every result labelled with what its licence allows (free to use, credit, non-commercial, share alike, no edits); preview, import or add at the playhead, and the Export dialog lists the credits for the video's description (`fablecut_music`) +- **Music** — the bin's **Music** tab searches openly licensed music from Openverse (Jamendo, ccMixter…), and the **SFX** tab sound effects (Freesound), every result labelled with what its licence allows (free to use, credit, non-commercial, share alike, no edits); preview, import or add at the playhead, and the Export dialog lists the credits for the video's description (`fablecut_music`) - **Workflows** — save a routine you want repeated (a podcast clean-up, the weekly reel) as plain-language steps plus the tool calls that did them, in `library/workflows/`; an agent lists them and follows one on the next project, fitting each step to the new footage (`fablecut_workflows`) - **Proxies** — light, frame-accurate H.264 copies of 4K / HEVC / ProRes footage made in the background (ffmpeg); edit on the proxy with the monitor's **Proxy** button, export always renders the originals - **Import from URL** — **+ URL** downloads an HTTPS video/audio/image into diff --git a/app.js b/app.js index 7aea26f95..bce772c9a 100644 --- a/app.js +++ b/app.js @@ -795,7 +795,7 @@ const runtime = { const $ = (id) => document.getElementById(id); const els = { binList: $("binList"), binEmpty: $("binEmpty"), fileInput: $("fileInput"), - binTabs: $("binTabs"), libList: $("libList"), toast: $("toast"), + binTabs: $("binTabs"), binSubTabs: $("binSubTabs"), libList: $("libList"), toast: $("toast"), binTools: $("binTools"), binSearch: $("binSearch"), binFilter: $("binFilter"), binSort: $("binSort"), binSortDir: $("binSortDir"), binViewBtn: $("binViewBtn"), btnProxy: $("btnProxy"), preview: $("preview"), tcCurrent: $("tcCurrent"), tcTotal: $("tcTotal"), @@ -3184,6 +3184,8 @@ function toggleSfxPreview(f, btn) { return; } if (cur) { cur.pause(); } + musicPreviewStop(); + els.libList.querySelectorAll(".music-play").forEach((b) => (b.textContent = "▶")); els.libList.querySelectorAll(".lib-play").forEach((b) => (b.textContent = "▶")); const a = new Audio(f.src); a.dataset.src = f.src; @@ -3197,7 +3199,14 @@ function renderLibrary() { if (dir === "project") return; const files = runtime.library[dir] || []; els.libList.innerHTML = ""; - if (!files.length) { + if (dir === "sfx") { + // online sound effects (Openverse) first, then the library's own files + appendOnlineSearch("sfx"); + const head = document.createElement("div"); + head.className = "music-status lib-head"; + head.textContent = files.length ? `Your library — library/sfx (${files.length})` : "Your library — drop files into library/sfx/ to keep them here."; + els.libList.appendChild(head); + } else if (!files.length) { els.libList.innerHTML = `
${dir === "sfx" ? "🔊" : dir === "svg" ? "✨" : "🧩"}

No assets yet.

@@ -3238,11 +3247,25 @@ function renderLibrary() { els.libList.appendChild(item); } } +/* The bin's tabs: Project, Audio (Music, SFX) and Graphics (Elements, SVG, + Shapes, Templates); a group shows its own row of tabs and reopens the one + last used in it. */ +const binGroupTab = { audio: "music", graphics: "elements" }; function setBinTab(tab) { - if (tab !== "music") musicPreviewStop(); + if (tab !== state.binTab) musicPreviewStop(); state.binTab = tab; - for (const b of els.binTabs.querySelectorAll("[data-tab]")) - b.classList.toggle("on", b.dataset.tab === tab); + const sub = els.binSubTabs && els.binSubTabs.querySelector(`[data-tab="${tab}"]`); + const group = sub ? sub.dataset.group : null; + if (group) binGroupTab[group] = tab; + for (const b of els.binTabs.querySelectorAll("[data-tab], [data-group]")) + b.classList.toggle("on", b.dataset.tab ? b.dataset.tab === tab : b.dataset.group === group); + if (els.binSubTabs) { + els.binSubTabs.classList.toggle("hidden", !group); + for (const b of els.binSubTabs.querySelectorAll("[data-tab]")) { + b.classList.toggle("hidden", b.dataset.group !== group); + b.classList.toggle("on", b.dataset.tab === tab); + } + } const isProj = tab === "project"; els.binList.classList.toggle("hidden", !isProj); els.libList.classList.toggle("hidden", isProj); @@ -3254,62 +3277,75 @@ function setBinTab(tab) { } /* ═══════════════════════════ MUSIC (Openverse) ═══════════════════════════ */ -/* The bin's Music tab: openly licensed music and sound effects from Openverse - (music.js builds the search and reads the licences). The browser asks - Openverse directly; importing downloads the file through /api/import-url, - and the media entry keeps the track's licence (m.license) for the credits. */ -const music = { query: "", kind: "music", length: "", commercial: false, tracks: [], page: 0, pages: 0, count: 0, - busy: false, error: "", seq: 0, preview: null, importing: new Set() }; +/* Online search in two bin tabs: Music (openly licensed music) and SFX (sound + effects from Freesound, above the library/sfx files). Both come from + Openverse (music.js builds the search and reads the licences). The browser + asks Openverse directly; importing downloads the file through + /api/import-url, and the media entry keeps the track's licence (m.license) + for the credits. */ +const onlineSearch = { + music: { query: "", length: "", commercial: false, tracks: [], page: 0, pages: 0, count: 0, busy: false, error: "", seq: 0 }, + sfx: { query: "", length: "", commercial: false, tracks: [], page: 0, pages: 0, count: 0, busy: false, error: "", seq: 0 }, +}; +const musicImporting = new Set(); +let musicPreview = null; // {id, audio} function musicPreviewStop() { - if (music.preview) { music.preview.audio.pause(); music.preview = null; } -} -async function musicSearch(more) { - const seq = ++music.seq; - const page = more ? music.page + 1 : 1; - music.busy = true; music.error = ""; - if (!more) { music.tracks = []; music.page = 0; musicPreviewStop(); } - renderMusicTab(); + if (musicPreview) { musicPreview.audio.pause(); musicPreview = null; } +} +/** Redraw whichever tab shows that search (the SFX tab also lists the library). */ +function renderOnlineTab(kind) { + if (state.binTab !== kind) return; + if (kind === "sfx") renderLibrary(); else renderMusicTab(); +} +async function musicSearch(kind, more) { + const s = onlineSearch[kind]; + const seq = ++s.seq; + const page = more ? s.page + 1 : 1; + s.busy = true; s.error = ""; + if (!more) { s.tracks = []; s.page = 0; musicPreviewStop(); } + renderOnlineTab(kind); try { - const res = await fetch(FableCutMusic.searchUrl({ query: music.query, kind: music.kind, length: music.length, commercial: music.commercial, edits: music.commercial, page }), + const res = await fetch(FableCutMusic.searchUrl({ query: s.query, kind, length: s.length, commercial: s.commercial, edits: s.commercial, page }), { headers: { Accept: "application/json" } }); const body = await res.json().catch(() => null); - if (seq !== music.seq) return; + if (seq !== s.seq) return; if (res.status === 429) throw new Error("Openverse's limit for searches is used up for now — try again in a while"); if (!res.ok) throw new Error("Openverse answered " + res.status + (body && body.detail ? ": " + body.detail : "")); const r = FableCutMusic.results(body, page); - music.tracks = more ? music.tracks.concat(r.tracks) : r.tracks; - music.page = page; music.pages = r.pages; music.count = r.count; + s.tracks = more ? s.tracks.concat(r.tracks) : r.tracks; + s.page = page; s.pages = r.pages; s.count = r.count; } catch (e) { - if (seq !== music.seq) return; - music.error = e instanceof TypeError ? "Couldn't reach Openverse — are you online?" : e.message; + if (seq !== s.seq) return; + s.error = e instanceof TypeError ? "Couldn't reach Openverse — are you online?" : e.message; } - music.busy = false; - if (state.binTab === "music") renderMusicTab(); + s.busy = false; + renderOnlineTab(kind); } function musicTogglePreview(t, btn) { - if (music.preview && music.preview.id === t.id) { + if (musicPreview && musicPreview.id === t.id) { musicPreviewStop(); btn.textContent = "▶"; return; } musicPreviewStop(); - els.libList.querySelectorAll(".music-play").forEach((b) => (b.textContent = "▶")); + if (runtime.sfxPreview) runtime.sfxPreview.pause(); + els.libList.querySelectorAll(".music-play, .lib-play").forEach((b) => (b.textContent = "▶")); const a = new Audio(t.url); - a.onended = () => { if (music.preview && music.preview.audio === a) { music.preview = null; btn.textContent = "▶"; } }; + a.onended = () => { if (musicPreview && musicPreview.audio === a) { musicPreview = null; btn.textContent = "▶"; } }; a.play().catch(() => { toast("Couldn't play " + t.title); btn.textContent = "▶"; }); btn.textContent = "⏸"; - music.preview = { id: t.id, audio: a }; + musicPreview = { id: t.id, audio: a }; } /** Download a track into media/ and register it with its licence; place = add at the playhead too. */ -async function musicImport(t, place) { - if (!state.connected) { toast("Importing music needs the editor server"); return; } - if (music.importing.has(t.id)) return; +async function musicImport(t, place, kind) { + if (!state.connected) { toast("Importing needs the editor server"); return; } + if (musicImporting.has(t.id)) return; const have = project.media.find((m) => m.license && m.license.openverse === t.id); if (have) { if (place) addClipFromMedia(have, null, state.time); else toast(`“${have.name}” is already in the project`); return; } - music.importing.add(t.id); - renderMusicTab(); + musicImporting.add(t.id); + renderOnlineTab(kind); const gen = runtime.projectGen; try { const res = await fetch("/api/import-url", { @@ -3318,9 +3354,9 @@ async function musicImport(t, place) { }); const body = await res.json().catch(() => ({})); if (!res.ok) throw new Error(body.error || "import failed (" + res.status + ")"); - const kind = libKind(body.name); - if (kind !== "audio" && kind !== "video") throw new Error("the track's file isn't audio: " + (body.name || "")); - const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind, src: body.src, folderId: null, + const fileKind = libKind(body.name); + if (fileKind !== "audio" && fileKind !== "video") throw new Error("the file isn't audio: " + (body.name || "")); + const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind: fileKind, src: body.src, folderId: null, license: FableCutMusic.mediaLicense(t) }; try { await loadMediaMetadata(m); ensureWave(m); } catch { /* probeMissingMeta retries */ } if (gen !== runtime.projectGen) throw new Error("another project was opened — the file is in media/"); @@ -3329,10 +3365,10 @@ async function musicImport(t, place) { if (place) addClipFromMedia(m, null, state.time); toast(`Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`); } catch (e) { - toast(e && e.message ? e.message : "Couldn't import the track"); + toast(e && e.message ? e.message : "Couldn't import it"); } finally { - music.importing.delete(t.id); - if (state.binTab === "music") renderMusicTab(); + musicImporting.delete(t.id); + renderOnlineTab(kind); } } function copyCredits(lines) { @@ -3364,44 +3400,43 @@ function syncExportCredits() { } } } -function renderMusicTab() { - if (state.binTab !== "music") return; - const list = els.libList; - const focused = document.activeElement && document.activeElement.id === "musicQuery"; - list.innerHTML = ""; +/** The online search (box, filters, chips, results) for one kind, appended to the bin's list. */ +function appendOnlineSearch(kind) { + const s = onlineSearch[kind], list = els.libList, sfx = kind === "sfx"; + const qid = sfx ? "sfxQuery" : "musicQuery"; + const focused = document.activeElement && document.activeElement.id === qid; const form = document.createElement("form"); form.className = "music-search"; form.innerHTML = ` - +
- - - + ${sfx ? "" : ``} +
`; - const q = form.querySelector("#musicQuery"); - q.value = music.query; - form.querySelector("#musicKind").value = music.kind; - form.querySelector("#musicLength").value = music.length; - form.querySelector("#musicCommercial").checked = music.commercial; - form.addEventListener("submit", (e) => { e.preventDefault(); music.query = q.value.trim(); musicSearch(false); }); + const q = form.querySelector("input[type=search]"); + q.value = s.query; + const len = form.querySelector('[data-f="length"]'); + if (len) len.value = s.length; + form.querySelector('[data-f="commercial"]').checked = s.commercial; + form.addEventListener("submit", (e) => { e.preventDefault(); s.query = q.value.trim(); musicSearch(kind, false); }); form.addEventListener("change", (e) => { - if (e.target.id === "musicKind") music.kind = e.target.value; - else if (e.target.id === "musicLength") music.length = e.target.value; - else if (e.target.id === "musicCommercial") music.commercial = e.target.checked; + const f = e.target.dataset.f; + if (f === "length") s.length = e.target.value; + else if (f === "commercial") s.commercial = e.target.checked; else return; - music.query = q.value.trim(); - musicSearch(false); + s.query = q.value.trim(); + musicSearch(kind, false); }); list.appendChild(form); if (focused) { q.focus(); q.setSelectionRange(q.value.length, q.value.length); } - if (!music.tracks.length && !music.busy) { + if (!s.tracks.length && !s.busy) { const moods = document.createElement("div"); moods.className = "music-moods"; - for (const w of FableCutMusic.MOODS) { + for (const w of sfx ? FableCutMusic.SFX_WORDS : FableCutMusic.MOODS) { const b = document.createElement("button"); b.type = "button"; b.className = "bin-tag chip"; b.textContent = w; - b.addEventListener("click", () => { music.query = w; musicSearch(false); }); + b.addEventListener("click", () => { s.query = w; musicSearch(kind, false); }); moods.appendChild(b); } list.appendChild(moods); @@ -3412,17 +3447,17 @@ function renderMusicTab() { p.textContent = text; list.appendChild(p); }; - if (music.error) status(music.error, "err"); - else if (!music.busy && music.page && !music.tracks.length) status("Nothing found — try other words or another length."); - else if (music.page) status(`${music.count >= 240 ? "240+" : music.count} result${music.count === 1 ? "" : "s"}${music.query ? ` for “${music.query}”` : " — newest first"}`); - else if (!music.busy) status("Search openly licensed music, or pick a mood. Every track shows its licence."); + if (s.error) status(s.error, "err"); + else if (!s.busy && s.page && !s.tracks.length) status("Nothing found — try other words" + (sfx ? "." : " or another length.")); + else if (s.page) status(`${s.count >= 240 ? "240+" : s.count} result${s.count === 1 ? "" : "s"}${s.query ? ` for “${s.query}”` : " — newest first"}`); + else if (!s.busy && !sfx) status("Search openly licensed music, or pick a mood. Every track shows its licence."); - for (const t of music.tracks) { + for (const t of s.tracks) { const item = document.createElement("div"); item.className = "bin-item lib-item music-item"; - const busy = music.importing.has(t.id); + const busy = musicImporting.has(t.id); item.innerHTML = ` - +
@@ -3448,27 +3483,34 @@ function renderMusicTab() { if (t.page) { const a = document.createElement("a"); a.className = "music-page"; a.href = t.page; a.target = "_blank"; a.rel = "noopener"; a.textContent = "page ↗"; - a.title = "The track's page at " + (t.source || "its source"); + a.title = "Its page at " + (t.source || "its source"); lic.appendChild(a); } const play = item.querySelector(".music-play"); play.addEventListener("click", () => musicTogglePreview(t, play)); - item.querySelector(".music-get").addEventListener("click", () => musicImport(t, false)); - item.querySelector(".lib-add").addEventListener("click", () => musicImport(t, true)); - item.addEventListener("dblclick", (e) => { if (!e.target.closest("button, a")) musicImport(t, true); }); + item.querySelector(".music-get").addEventListener("click", () => musicImport(t, false, kind)); + item.querySelector(".lib-add").addEventListener("click", () => musicImport(t, true, kind)); + item.addEventListener("dblclick", (e) => { if (!e.target.closest("button, a")) musicImport(t, true, kind); }); list.appendChild(item); } - if (music.busy) status("Searching…"); - else if (music.page && music.page < music.pages) { + if (s.busy) status("Searching…"); + else if (s.page && s.page < s.pages) { const more = document.createElement("button"); more.type = "button"; more.className = "btn tiny music-more"; more.textContent = "More results"; - more.addEventListener("click", () => musicSearch(true)); + more.addEventListener("click", () => musicSearch(kind, true)); list.appendChild(more); } - const about = document.createElement("p"); - about.className = "music-about"; - about.innerHTML = `Made with Openverse, not endorsed or certified by it. Licences are the artists' — check one before you publish, and credit where it says so (the Export dialog lists the credits).`; - list.appendChild(about); + if (s.page || !sfx) { + const about = document.createElement("p"); + about.className = "music-about"; + about.innerHTML = `Made with Openverse, not endorsed or certified by it. Licences are the artists' — check one before you publish, and credit where it says so (the Export dialog lists the credits).`; + list.appendChild(about); + } +} +function renderMusicTab() { + if (state.binTab !== "music") return; + els.libList.innerHTML = ""; + appendOnlineSearch("music"); } /* ═══════════════════════════ PROJECTS (dashboard) ═══════════════════════════ */ @@ -19147,16 +19189,16 @@ function cmdkCollect() { }; // panels and tabs // (the Color workspace and the Color side tab share a name: where each lives tells them apart) - const panelWhere = { sideTabs: "Side panel", binTabs: "Bin", wsSwitch: "Workspace" }; - for (const b of document.querySelectorAll("#sideTabs [data-side], #binTabs [data-tab], #wsSwitch [data-ws]")) { + const panelWhere = { sideTabs: "Side panel", binTabs: "Bin", binSubTabs: "Bin", wsSwitch: "Workspace" }; + for (const b of document.querySelectorAll("#sideTabs [data-side], #binTabs [data-tab], #binSubTabs [data-tab], #wsSwitch [data-ws]")) { const where = panelWhere[b.parentElement.id] || "", title = (b.title || "").split(/ — |: /)[0] === cmdkName(b) ? "" : b.title; add({ key: "Panel|" + b.parentElement.id + "|" + cmdkName(b), label: cmdkName(b), group: "Panel", hint: [where, title].filter(Boolean).join(" · "), - keywords: ["tab", "show", "open", where], run: () => { if (b.closest("#binTabs")) cmdkShowBin(); b.click(); } }); + keywords: ["tab", "show", "open", where], run: () => { if (b.closest("#binTabs, #binSubTabs")) cmdkShowBin(); b.click(); } }); } // toolbar actions: every named button outside dialogs, menus and the Inspector (and the timeline's edit tools) const actions = []; for (const b of document.querySelectorAll("button[id], button[data-edit-tool]")) { - if (b.closest(".overlay, .ctx-menu, .style-menu, #inspector, #sideTabs, #binTabs, #wsSwitch") || b.id === "btnSearch") continue; + if (b.closest(".overlay, .ctx-menu, .style-menu, #inspector, #sideTabs, #binTabs, #binSubTabs, #wsSwitch") || b.id === "btnSearch") continue; if (!cmdkShown(b)) continue; actions.push(b); } @@ -19400,6 +19442,10 @@ $("trackSizeGroup").addEventListener("click", (e) => { if (b) setTrackSize(b.dataset.trackSize); }); els.binTabs.addEventListener("click", (e) => { + const b = e.target.closest("[data-tab], [data-group]"); + if (b) setBinTab(b.dataset.tab || binGroupTab[b.dataset.group]); +}); +els.binSubTabs?.addEventListener("click", (e) => { const b = e.target.closest("[data-tab]"); if (b) setBinTab(b.dataset.tab); }); diff --git a/docs/demo/app.js b/docs/demo/app.js index 7aea26f95..bce772c9a 100644 --- a/docs/demo/app.js +++ b/docs/demo/app.js @@ -795,7 +795,7 @@ const runtime = { const $ = (id) => document.getElementById(id); const els = { binList: $("binList"), binEmpty: $("binEmpty"), fileInput: $("fileInput"), - binTabs: $("binTabs"), libList: $("libList"), toast: $("toast"), + binTabs: $("binTabs"), binSubTabs: $("binSubTabs"), libList: $("libList"), toast: $("toast"), binTools: $("binTools"), binSearch: $("binSearch"), binFilter: $("binFilter"), binSort: $("binSort"), binSortDir: $("binSortDir"), binViewBtn: $("binViewBtn"), btnProxy: $("btnProxy"), preview: $("preview"), tcCurrent: $("tcCurrent"), tcTotal: $("tcTotal"), @@ -3184,6 +3184,8 @@ function toggleSfxPreview(f, btn) { return; } if (cur) { cur.pause(); } + musicPreviewStop(); + els.libList.querySelectorAll(".music-play").forEach((b) => (b.textContent = "▶")); els.libList.querySelectorAll(".lib-play").forEach((b) => (b.textContent = "▶")); const a = new Audio(f.src); a.dataset.src = f.src; @@ -3197,7 +3199,14 @@ function renderLibrary() { if (dir === "project") return; const files = runtime.library[dir] || []; els.libList.innerHTML = ""; - if (!files.length) { + if (dir === "sfx") { + // online sound effects (Openverse) first, then the library's own files + appendOnlineSearch("sfx"); + const head = document.createElement("div"); + head.className = "music-status lib-head"; + head.textContent = files.length ? `Your library — library/sfx (${files.length})` : "Your library — drop files into library/sfx/ to keep them here."; + els.libList.appendChild(head); + } else if (!files.length) { els.libList.innerHTML = `
${dir === "sfx" ? "🔊" : dir === "svg" ? "✨" : "🧩"}

No assets yet.

@@ -3238,11 +3247,25 @@ function renderLibrary() { els.libList.appendChild(item); } } +/* The bin's tabs: Project, Audio (Music, SFX) and Graphics (Elements, SVG, + Shapes, Templates); a group shows its own row of tabs and reopens the one + last used in it. */ +const binGroupTab = { audio: "music", graphics: "elements" }; function setBinTab(tab) { - if (tab !== "music") musicPreviewStop(); + if (tab !== state.binTab) musicPreviewStop(); state.binTab = tab; - for (const b of els.binTabs.querySelectorAll("[data-tab]")) - b.classList.toggle("on", b.dataset.tab === tab); + const sub = els.binSubTabs && els.binSubTabs.querySelector(`[data-tab="${tab}"]`); + const group = sub ? sub.dataset.group : null; + if (group) binGroupTab[group] = tab; + for (const b of els.binTabs.querySelectorAll("[data-tab], [data-group]")) + b.classList.toggle("on", b.dataset.tab ? b.dataset.tab === tab : b.dataset.group === group); + if (els.binSubTabs) { + els.binSubTabs.classList.toggle("hidden", !group); + for (const b of els.binSubTabs.querySelectorAll("[data-tab]")) { + b.classList.toggle("hidden", b.dataset.group !== group); + b.classList.toggle("on", b.dataset.tab === tab); + } + } const isProj = tab === "project"; els.binList.classList.toggle("hidden", !isProj); els.libList.classList.toggle("hidden", isProj); @@ -3254,62 +3277,75 @@ function setBinTab(tab) { } /* ═══════════════════════════ MUSIC (Openverse) ═══════════════════════════ */ -/* The bin's Music tab: openly licensed music and sound effects from Openverse - (music.js builds the search and reads the licences). The browser asks - Openverse directly; importing downloads the file through /api/import-url, - and the media entry keeps the track's licence (m.license) for the credits. */ -const music = { query: "", kind: "music", length: "", commercial: false, tracks: [], page: 0, pages: 0, count: 0, - busy: false, error: "", seq: 0, preview: null, importing: new Set() }; +/* Online search in two bin tabs: Music (openly licensed music) and SFX (sound + effects from Freesound, above the library/sfx files). Both come from + Openverse (music.js builds the search and reads the licences). The browser + asks Openverse directly; importing downloads the file through + /api/import-url, and the media entry keeps the track's licence (m.license) + for the credits. */ +const onlineSearch = { + music: { query: "", length: "", commercial: false, tracks: [], page: 0, pages: 0, count: 0, busy: false, error: "", seq: 0 }, + sfx: { query: "", length: "", commercial: false, tracks: [], page: 0, pages: 0, count: 0, busy: false, error: "", seq: 0 }, +}; +const musicImporting = new Set(); +let musicPreview = null; // {id, audio} function musicPreviewStop() { - if (music.preview) { music.preview.audio.pause(); music.preview = null; } -} -async function musicSearch(more) { - const seq = ++music.seq; - const page = more ? music.page + 1 : 1; - music.busy = true; music.error = ""; - if (!more) { music.tracks = []; music.page = 0; musicPreviewStop(); } - renderMusicTab(); + if (musicPreview) { musicPreview.audio.pause(); musicPreview = null; } +} +/** Redraw whichever tab shows that search (the SFX tab also lists the library). */ +function renderOnlineTab(kind) { + if (state.binTab !== kind) return; + if (kind === "sfx") renderLibrary(); else renderMusicTab(); +} +async function musicSearch(kind, more) { + const s = onlineSearch[kind]; + const seq = ++s.seq; + const page = more ? s.page + 1 : 1; + s.busy = true; s.error = ""; + if (!more) { s.tracks = []; s.page = 0; musicPreviewStop(); } + renderOnlineTab(kind); try { - const res = await fetch(FableCutMusic.searchUrl({ query: music.query, kind: music.kind, length: music.length, commercial: music.commercial, edits: music.commercial, page }), + const res = await fetch(FableCutMusic.searchUrl({ query: s.query, kind, length: s.length, commercial: s.commercial, edits: s.commercial, page }), { headers: { Accept: "application/json" } }); const body = await res.json().catch(() => null); - if (seq !== music.seq) return; + if (seq !== s.seq) return; if (res.status === 429) throw new Error("Openverse's limit for searches is used up for now — try again in a while"); if (!res.ok) throw new Error("Openverse answered " + res.status + (body && body.detail ? ": " + body.detail : "")); const r = FableCutMusic.results(body, page); - music.tracks = more ? music.tracks.concat(r.tracks) : r.tracks; - music.page = page; music.pages = r.pages; music.count = r.count; + s.tracks = more ? s.tracks.concat(r.tracks) : r.tracks; + s.page = page; s.pages = r.pages; s.count = r.count; } catch (e) { - if (seq !== music.seq) return; - music.error = e instanceof TypeError ? "Couldn't reach Openverse — are you online?" : e.message; + if (seq !== s.seq) return; + s.error = e instanceof TypeError ? "Couldn't reach Openverse — are you online?" : e.message; } - music.busy = false; - if (state.binTab === "music") renderMusicTab(); + s.busy = false; + renderOnlineTab(kind); } function musicTogglePreview(t, btn) { - if (music.preview && music.preview.id === t.id) { + if (musicPreview && musicPreview.id === t.id) { musicPreviewStop(); btn.textContent = "▶"; return; } musicPreviewStop(); - els.libList.querySelectorAll(".music-play").forEach((b) => (b.textContent = "▶")); + if (runtime.sfxPreview) runtime.sfxPreview.pause(); + els.libList.querySelectorAll(".music-play, .lib-play").forEach((b) => (b.textContent = "▶")); const a = new Audio(t.url); - a.onended = () => { if (music.preview && music.preview.audio === a) { music.preview = null; btn.textContent = "▶"; } }; + a.onended = () => { if (musicPreview && musicPreview.audio === a) { musicPreview = null; btn.textContent = "▶"; } }; a.play().catch(() => { toast("Couldn't play " + t.title); btn.textContent = "▶"; }); btn.textContent = "⏸"; - music.preview = { id: t.id, audio: a }; + musicPreview = { id: t.id, audio: a }; } /** Download a track into media/ and register it with its licence; place = add at the playhead too. */ -async function musicImport(t, place) { - if (!state.connected) { toast("Importing music needs the editor server"); return; } - if (music.importing.has(t.id)) return; +async function musicImport(t, place, kind) { + if (!state.connected) { toast("Importing needs the editor server"); return; } + if (musicImporting.has(t.id)) return; const have = project.media.find((m) => m.license && m.license.openverse === t.id); if (have) { if (place) addClipFromMedia(have, null, state.time); else toast(`“${have.name}” is already in the project`); return; } - music.importing.add(t.id); - renderMusicTab(); + musicImporting.add(t.id); + renderOnlineTab(kind); const gen = runtime.projectGen; try { const res = await fetch("/api/import-url", { @@ -3318,9 +3354,9 @@ async function musicImport(t, place) { }); const body = await res.json().catch(() => ({})); if (!res.ok) throw new Error(body.error || "import failed (" + res.status + ")"); - const kind = libKind(body.name); - if (kind !== "audio" && kind !== "video") throw new Error("the track's file isn't audio: " + (body.name || "")); - const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind, src: body.src, folderId: null, + const fileKind = libKind(body.name); + if (fileKind !== "audio" && fileKind !== "video") throw new Error("the file isn't audio: " + (body.name || "")); + const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind: fileKind, src: body.src, folderId: null, license: FableCutMusic.mediaLicense(t) }; try { await loadMediaMetadata(m); ensureWave(m); } catch { /* probeMissingMeta retries */ } if (gen !== runtime.projectGen) throw new Error("another project was opened — the file is in media/"); @@ -3329,10 +3365,10 @@ async function musicImport(t, place) { if (place) addClipFromMedia(m, null, state.time); toast(`Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`); } catch (e) { - toast(e && e.message ? e.message : "Couldn't import the track"); + toast(e && e.message ? e.message : "Couldn't import it"); } finally { - music.importing.delete(t.id); - if (state.binTab === "music") renderMusicTab(); + musicImporting.delete(t.id); + renderOnlineTab(kind); } } function copyCredits(lines) { @@ -3364,44 +3400,43 @@ function syncExportCredits() { } } } -function renderMusicTab() { - if (state.binTab !== "music") return; - const list = els.libList; - const focused = document.activeElement && document.activeElement.id === "musicQuery"; - list.innerHTML = ""; +/** The online search (box, filters, chips, results) for one kind, appended to the bin's list. */ +function appendOnlineSearch(kind) { + const s = onlineSearch[kind], list = els.libList, sfx = kind === "sfx"; + const qid = sfx ? "sfxQuery" : "musicQuery"; + const focused = document.activeElement && document.activeElement.id === qid; const form = document.createElement("form"); form.className = "music-search"; form.innerHTML = ` - +
- - - + ${sfx ? "" : ``} +
`; - const q = form.querySelector("#musicQuery"); - q.value = music.query; - form.querySelector("#musicKind").value = music.kind; - form.querySelector("#musicLength").value = music.length; - form.querySelector("#musicCommercial").checked = music.commercial; - form.addEventListener("submit", (e) => { e.preventDefault(); music.query = q.value.trim(); musicSearch(false); }); + const q = form.querySelector("input[type=search]"); + q.value = s.query; + const len = form.querySelector('[data-f="length"]'); + if (len) len.value = s.length; + form.querySelector('[data-f="commercial"]').checked = s.commercial; + form.addEventListener("submit", (e) => { e.preventDefault(); s.query = q.value.trim(); musicSearch(kind, false); }); form.addEventListener("change", (e) => { - if (e.target.id === "musicKind") music.kind = e.target.value; - else if (e.target.id === "musicLength") music.length = e.target.value; - else if (e.target.id === "musicCommercial") music.commercial = e.target.checked; + const f = e.target.dataset.f; + if (f === "length") s.length = e.target.value; + else if (f === "commercial") s.commercial = e.target.checked; else return; - music.query = q.value.trim(); - musicSearch(false); + s.query = q.value.trim(); + musicSearch(kind, false); }); list.appendChild(form); if (focused) { q.focus(); q.setSelectionRange(q.value.length, q.value.length); } - if (!music.tracks.length && !music.busy) { + if (!s.tracks.length && !s.busy) { const moods = document.createElement("div"); moods.className = "music-moods"; - for (const w of FableCutMusic.MOODS) { + for (const w of sfx ? FableCutMusic.SFX_WORDS : FableCutMusic.MOODS) { const b = document.createElement("button"); b.type = "button"; b.className = "bin-tag chip"; b.textContent = w; - b.addEventListener("click", () => { music.query = w; musicSearch(false); }); + b.addEventListener("click", () => { s.query = w; musicSearch(kind, false); }); moods.appendChild(b); } list.appendChild(moods); @@ -3412,17 +3447,17 @@ function renderMusicTab() { p.textContent = text; list.appendChild(p); }; - if (music.error) status(music.error, "err"); - else if (!music.busy && music.page && !music.tracks.length) status("Nothing found — try other words or another length."); - else if (music.page) status(`${music.count >= 240 ? "240+" : music.count} result${music.count === 1 ? "" : "s"}${music.query ? ` for “${music.query}”` : " — newest first"}`); - else if (!music.busy) status("Search openly licensed music, or pick a mood. Every track shows its licence."); + if (s.error) status(s.error, "err"); + else if (!s.busy && s.page && !s.tracks.length) status("Nothing found — try other words" + (sfx ? "." : " or another length.")); + else if (s.page) status(`${s.count >= 240 ? "240+" : s.count} result${s.count === 1 ? "" : "s"}${s.query ? ` for “${s.query}”` : " — newest first"}`); + else if (!s.busy && !sfx) status("Search openly licensed music, or pick a mood. Every track shows its licence."); - for (const t of music.tracks) { + for (const t of s.tracks) { const item = document.createElement("div"); item.className = "bin-item lib-item music-item"; - const busy = music.importing.has(t.id); + const busy = musicImporting.has(t.id); item.innerHTML = ` - +
@@ -3448,27 +3483,34 @@ function renderMusicTab() { if (t.page) { const a = document.createElement("a"); a.className = "music-page"; a.href = t.page; a.target = "_blank"; a.rel = "noopener"; a.textContent = "page ↗"; - a.title = "The track's page at " + (t.source || "its source"); + a.title = "Its page at " + (t.source || "its source"); lic.appendChild(a); } const play = item.querySelector(".music-play"); play.addEventListener("click", () => musicTogglePreview(t, play)); - item.querySelector(".music-get").addEventListener("click", () => musicImport(t, false)); - item.querySelector(".lib-add").addEventListener("click", () => musicImport(t, true)); - item.addEventListener("dblclick", (e) => { if (!e.target.closest("button, a")) musicImport(t, true); }); + item.querySelector(".music-get").addEventListener("click", () => musicImport(t, false, kind)); + item.querySelector(".lib-add").addEventListener("click", () => musicImport(t, true, kind)); + item.addEventListener("dblclick", (e) => { if (!e.target.closest("button, a")) musicImport(t, true, kind); }); list.appendChild(item); } - if (music.busy) status("Searching…"); - else if (music.page && music.page < music.pages) { + if (s.busy) status("Searching…"); + else if (s.page && s.page < s.pages) { const more = document.createElement("button"); more.type = "button"; more.className = "btn tiny music-more"; more.textContent = "More results"; - more.addEventListener("click", () => musicSearch(true)); + more.addEventListener("click", () => musicSearch(kind, true)); list.appendChild(more); } - const about = document.createElement("p"); - about.className = "music-about"; - about.innerHTML = `Made with Openverse, not endorsed or certified by it. Licences are the artists' — check one before you publish, and credit where it says so (the Export dialog lists the credits).`; - list.appendChild(about); + if (s.page || !sfx) { + const about = document.createElement("p"); + about.className = "music-about"; + about.innerHTML = `Made with Openverse, not endorsed or certified by it. Licences are the artists' — check one before you publish, and credit where it says so (the Export dialog lists the credits).`; + list.appendChild(about); + } +} +function renderMusicTab() { + if (state.binTab !== "music") return; + els.libList.innerHTML = ""; + appendOnlineSearch("music"); } /* ═══════════════════════════ PROJECTS (dashboard) ═══════════════════════════ */ @@ -19147,16 +19189,16 @@ function cmdkCollect() { }; // panels and tabs // (the Color workspace and the Color side tab share a name: where each lives tells them apart) - const panelWhere = { sideTabs: "Side panel", binTabs: "Bin", wsSwitch: "Workspace" }; - for (const b of document.querySelectorAll("#sideTabs [data-side], #binTabs [data-tab], #wsSwitch [data-ws]")) { + const panelWhere = { sideTabs: "Side panel", binTabs: "Bin", binSubTabs: "Bin", wsSwitch: "Workspace" }; + for (const b of document.querySelectorAll("#sideTabs [data-side], #binTabs [data-tab], #binSubTabs [data-tab], #wsSwitch [data-ws]")) { const where = panelWhere[b.parentElement.id] || "", title = (b.title || "").split(/ — |: /)[0] === cmdkName(b) ? "" : b.title; add({ key: "Panel|" + b.parentElement.id + "|" + cmdkName(b), label: cmdkName(b), group: "Panel", hint: [where, title].filter(Boolean).join(" · "), - keywords: ["tab", "show", "open", where], run: () => { if (b.closest("#binTabs")) cmdkShowBin(); b.click(); } }); + keywords: ["tab", "show", "open", where], run: () => { if (b.closest("#binTabs, #binSubTabs")) cmdkShowBin(); b.click(); } }); } // toolbar actions: every named button outside dialogs, menus and the Inspector (and the timeline's edit tools) const actions = []; for (const b of document.querySelectorAll("button[id], button[data-edit-tool]")) { - if (b.closest(".overlay, .ctx-menu, .style-menu, #inspector, #sideTabs, #binTabs, #wsSwitch") || b.id === "btnSearch") continue; + if (b.closest(".overlay, .ctx-menu, .style-menu, #inspector, #sideTabs, #binTabs, #binSubTabs, #wsSwitch") || b.id === "btnSearch") continue; if (!cmdkShown(b)) continue; actions.push(b); } @@ -19400,6 +19442,10 @@ $("trackSizeGroup").addEventListener("click", (e) => { if (b) setTrackSize(b.dataset.trackSize); }); els.binTabs.addEventListener("click", (e) => { + const b = e.target.closest("[data-tab], [data-group]"); + if (b) setBinTab(b.dataset.tab || binGroupTab[b.dataset.group]); +}); +els.binSubTabs?.addEventListener("click", (e) => { const b = e.target.closest("[data-tab]"); if (b) setBinTab(b.dataset.tab); }); diff --git a/docs/demo/index.html b/docs/demo/index.html index 54647035c..762ed8afe 100644 --- a/docs/demo/index.html +++ b/docs/demo/index.html @@ -58,12 +58,16 @@
- - - - - - + + +
+
diff --git a/docs/demo/music.js b/docs/demo/music.js index 495143b1f..46bcc6d33 100644 --- a/docs/demo/music.js +++ b/docs/demo/music.js @@ -32,6 +32,8 @@ const KINDS = { music: { category: "music" }, sfx: { source: "freesound" } }; const MOODS = ["upbeat", "chill", "cinematic", "epic", "lo-fi", "acoustic", "electronic", "happy", "sad", "ambient", "piano", "corporate", "hip hop", "rock"]; + const SFX_WORDS = ["whoosh", "impact", "riser", "swoosh", "pop", "click", "ding", "glitch", + "boom", "camera shutter", "typing", "applause", "footsteps", "crowd"]; /* What each licence lets a video editor do. edits: may it be cut, looped and put under picture? Creative Commons counts music synced to moving images as @@ -124,9 +126,10 @@ tracks: (json.results || []).filter((r) => r && r.url).map(track) }; } - /** 125.4 → "2:05". */ + /** 125.4 → "2:05"; under 10 s with a tenth (a 0.4 s swipe reads "0.4 s", not "0:00"). */ function fmtLen(sec) { - const s = Math.round(+sec || 0); + if (+sec < 10) return (Math.round((+sec || 0) * 10) / 10) + " s"; + const s = Math.round(+sec); return Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"); } @@ -190,6 +193,6 @@ const ABOUT = "Music from Openverse (openverse.org) — made with Openverse, not endorsed or certified by it. Each track's licence is the artist's: check it before you publish."; - return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, LICENSES, ABOUT, + return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, SFX_WORDS, LICENSES, ABOUT, licence, flags, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; }); diff --git a/docs/demo/style.css b/docs/demo/style.css index f4575e305..1dcee36ff 100644 --- a/docs/demo/style.css +++ b/docs/demo/style.css @@ -486,6 +486,26 @@ body.track-size-s .clip.selected { border-bottom-color: var(--accent); } +/* the open group's own tabs (Audio: Music, SFX · Graphics: Elements…Templates) */ +.bin-subtabs { + display: flex; + gap: 4px; + padding: 6px 8px 0; +} +.bin-subtabs.hidden, .bin-subtabs button.hidden { display: none; } +.bin-subtabs button { + background: none; + border: 1px solid transparent; + border-radius: 6px; + color: var(--dim); + font: 600 11px/1.2 "Segoe UI", sans-serif; + padding: 4px 10px; + cursor: pointer; + white-space: nowrap; +} +.bin-subtabs button:hover { color: var(--text); } +.bin-subtabs button.on { color: #cfc8ff; background: #7b6cff22; border-color: #7b6cff55; } + .bin-list { flex: 1; overflow-y: auto; @@ -4850,6 +4870,7 @@ input[type=number]:hover::-webkit-inner-spin-button { opacity: .8; } .music-more { align-self: center; margin: 4px 0; } .music-about { font-size: 10px; line-height: 1.45; color: var(--dim); margin: 8px 2px 2px; } .music-about a { color: inherit; } +.music-status.lib-head { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); } .bin-info .bin-copy-credit { margin: 6px 0 2px; } .export-credits { margin: 0 0 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-sub); font-size: 12px; line-height: 1.4; } .export-credits-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; } diff --git a/docs/docs/audio/index.html b/docs/docs/audio/index.html index 15c4e2876..086264c61 100644 --- a/docs/docs/audio/index.html +++ b/docs/docs/audio/index.html @@ -82,7 +82,7 @@

Audio mix

How clips reach the speakers and the export: clip gain, channels, track faders, the master, and loudness normalize.

Every clip runs through the same chain in preview and export: source → channels (audioChannel / channelMode) → gain (dB) → clip fx → volume (keyframes, fades, duck) → pan → its A-track, then track fx → track fader → track pan → (submix bus fx → fader → pan) → master sum → master fx → master fader. A track has a fader (tracks[].gain, dB), a pan (tracks[].pan) and effects (tracks[].fx); the master has a fader (master.gain) and effects (master.fx). Submix buses (buses[], B1…B8) group tracks: a track with out:"B1" feeds that bus instead of the master, and the bus has its own effects, fader, pan and mute - e.g. every dialogue lane into one bus with one compressor and one fader. Audio on a video lane (a clip with volume > 0 on V1…) goes straight to the master. In the UI these are the strips in the Mixer tab beside the Inspector (its FX button edits that track's or the master's effects); mute / solo are the existing track switches (disabledTracks).

Effects (fx - an array processed in order; every parameter optional, out-of-range values are clamped; on:false bypasses one without losing its settings):

typeparameters (default)
eqlowFreq 120 Hz, lowGain 0 dB (low shelf) · midFreq 1000, midGain 0, midQ 1 (peak) · highFreq 8000, highGain 0 (high shelf); gains −18…+18
highpass / lowpassfreq (80 / 8000 Hz), q 0.71
compressorthreshold −20 dB, ratio 4, attack 10 ms, release 200 ms, knee 6 dB, makeup 0 dB
limiterceiling −1 dB, release 80 ms - brickwall, 5 ms lookahead; nothing passes the ceiling
gatethreshold −50 dB, range −40 dB (how far it closes), attack 2, hold 80, release 150 ms
delaytime 0.3 s, feedback 0.35, mix 0.25
reverbdecay 2 s, predelay 20 ms, mix 0.25
distortiondrive 0.3, mix 1
widenerwidth 1.5 (0 = mono, 1 = as is, 2 = extra wide)
pitchsemitones 0 (−12…+12; changes pitch, not speed - about 30 ms of delay), mix 1

Presets fill the chain with tweakable effects: Voice - clean-voice, podcast, radio, deep-voice (pitch down 4 semitones + a warmer EQ), telephone; Music - cinematic, wide, muffled (next room). Agents apply them (or any chain) with the patch op setFx: {op:"setFx", target:"clip", id:"c_vo", preset:"podcast"} · {op:"setFx", target:"track", id:"A3", fx:[{type:"eq", highGain:-3}]} · {op:"setFx", target:"master", fx:[{type:"limiter", ceiling:-1}], append:true} · {op:"setFx", target:"bus", id:"B1", preset:"podcast"} · fx:null clears. On a clip it applies to its linked stems too; chains are validated (unknown effect or preset → the whole patch is refused). The compact project view shows chains as fx:highpass·eq·… (lowpass~freq = automated).

Effect automation - any effect parameter except reverb decay can follow keyframes: keys on the effect, {param: [{t, v, ease?}]}. t is seconds from the clip's start for a clip's effects, and timeline seconds for a track's, a bus's or the master's; ease (linear · ease-in · ease-out · ease-in-out, default ease-in-out) shapes the segment arriving at that key, as with clip keyframes. While a parameter has keys they set it. Preview and export follow them the same way (export steps every 20 ms with a short glide). In the effects panel each parameter has a ◆: set or remove a key at the playhead; with keys, the slider edits the key under the playhead. Agents: {op:"setFxKeys", target:"bus", id:"B1", type:"lowpass", param:"freq", keys:[{t:0, v:18000}, {t:8, v:500, ease:"ease-in"}]} (index picks the effect when the type repeats; keys:null clears) - or write keys inside a setFx chain. Example - a filter sweep into the drop: a lowpass on the music clip keyed from 400 Hz up to 20000 Hz over the build.

  • Set a track fader / pan: {op:"setTrack", id:"A2", set:{gain:-8, pan:0}} (null or 0 resets). Master: {op:"setProject", set:{master:{gain:-1}}}.
  • Buses: {op:"setBus", id:"B1", set:{name:"Dialogue", gain:-2, pan?, mute?}} creates or updates one; route a track in with {op:"setTrack", id:"A1", set:{out:"B1"}} (out:"master" or null routes it back); {op:"removeBus", id:"B1"} sends its tracks back to the master. In the Mixer: + Bus, the → menu under a track's name, double-click a bus name to rename it.
  • Noise reduction - fablecut_denoise {clipIds, amount?:"light"|"medium"|"strong"|"off"} (default medium; the inspector's Noise control does the same). The file's noise floor is measured (its quietest 50 ms windows), then ffmpeg's FFT denoiser pulls everything near it down (10 / 18 / 30 dB) into a FLAC copy of the whole source file in media/, registered with derivedFrom (the original) and denoise (the amount). The clip and its linked audio stems switch to that copy; the picture keeps its own file, so links, in points and timing stay as they were. off switches back; a level already rendered is reused. Works on audio clips (a video's sound is on its linked stems). Needs ffmpeg. Use it before normalizing - the measured loudness changes.
  • Normalize - fablecut_normalize_audio {clipIds, mode?:"lufs"|"peak", target?} measures each clip's source window after its channel routing (ITU-R BS.1770 integrated loudness with EBU R128 gating, or sample peak) and sets props.gain to hit the target. Linked stems are measured together and share one gain; passing a video clip normalizes its stems. Targets: −14 LUFS streaming / social, −16 LUFS podcast / dialogue, −23 LUFS broadcast, or mode:"peak", target:-1. Locked clips are skipped unless force:true. The inspector's Normalize in the editor does the same measurement.
  • Fade curves - a fade transition on an audio clip may carry curve: "power" (constant power - the crossfade default, no dip in the middle), "linear" (constant gain - for crossfading the same material, e.g. a split of one take) or "exp" (slow start, natural fade to silence). No curve keeps the original eased shape. Only the volume follows the curve; picture fades are unchanged. {transitionOut:{type:"fade", duration:3, curve:"exp"}}.
  • Crossfades - overlap A and B on one track and give A transitionOut:{type:"fade", duration:d, curve:"power"} and B transitionIn the same, with d = the overlap. Shift+D in the editor does it for you: it borrows the overlap from spare media on both sides of the cut (half each, or more from the side that has it), so nothing after the cut moves; for a linked shot the stems crossfade and B's picture dissolves in.
  • Auto-duck - fablecut_auto_duck {clipIds:[music…], under?:["A1"], amount?:-12, threshold?:-40, attack?:0.3, release?:0.6} finds where the voice tracks (default: every other audio track) are above threshold dBFS - short gaps are bridged so the music doesn't pump between words - and writes keyframes.duck on the music: ramp down attack s before speech, hold, back up over release s. It replaces earlier ducking; amount:0 clears it. Same as the inspector's Auto-duck section or the clip menu's Auto-duck under other tracks.
  • Silence - fablecut_silence {clipIds, threshold?:-40, minSilence?:0.5, padding?:0.15, cut?, tracks?, force?} listens to the speech clips (a video brings its linked stems; each measured after its channel routing, gain and volume) and finds every stretch where none of them is above threshold dBFS for at least minSilence seconds. It keeps padding seconds of quiet after the phrase before and before the phrase after, so words aren't clipped; a clip's own start and end are cut to the first and last word. Cuts land on whole frames, and the gaps between clips are left alone. Without cut it only reports the spans (timeline seconds). With cut:true each one is removed with an extract on the targeted tracks (tracks picks others), last first, in one revision: later material moves up, linked stems stay in step, and locked tracks and clips stay where they are - lock the music bed first if it should keep running under the tightened edit. force:true cuts through locked material too, so pass it only when the user asked. Only time that was actually heard is cut: a clip with no audio stream (or disabled) is left alone, and so is one with a speed ramp (keyframes.speed) - its sound doesn't sit on the timeline at one speed. A version of the project as it was is kept before the cut; if that fails the reply says so in a warning, and then there is no version to go back to. Raise threshold toward −30 in a noisy room; lower minSilence for a tighter, jump-cut feel. In the editor: the Inspector's Silence section on an audio or video clip (or right-click → Find silences) - Find marks the silences on the timeline as amber bands, Cut N extracts them (one undo step), Clear removes the marks. The marks drop when the timeline, a clip's file, speed or level, or the frame rate changes.
  • Beats - fablecut_beats {clipId, markers?, snap?, retime?, every?, force?} listens to a music clip (an audio clip, or a video's sound) and finds its tempo (BPM), a steady beat grid - the tempo's period, phased and fitted to the hits, so it doesn't drift over a song - and the drop, all in timeline seconds through the clip's in point and speed. On its own it only reports. Then, in one revision: markers:true puts a cyan marker on every beat (other markers stay, and a beat that already has one keeps it); snap:true (or {tracks, maxShift}) rolls each cut on the targeted video tracks to the nearest beat within half a beat - a roll, so nothing else moves and linked stems follow; a cut whose clips have no spare footage to reach the beat stays where it is, and the reply says how many; retime:{track?, every?, from?} lays a track's clips (default the lowest video track with clips) back to back on the beat, every beats each (1, 2, 4, 8 or 16; default 2), from the first beat at or after from (default the music's start), in their order - a clip whose footage runs out gets fewer beats, clips past the music keep their length, and one with less than a beat of footage refuses the whole re-cut. Locked clips are left alone by snap and refuse retime, unless force:true (only when the user asked). A version is kept before snap or retime; if saving it fails, the edit still goes ahead and the reply says so in a warning. A re-cut clip that gets shorter loses the keyframes past its new end, and its transitions are kept no longer than the clip, as with a trim. The music clip itself (and its linked stems) is never re-cut, even when it sits on the track being re-cut. Cuts land on whole frames. A clip with a speed ramp is refused: its music doesn't keep time on the timeline. In the editor: the Inspector's Beats section on an audio or video clip - Find beats shows the beat as ticks across the timeline and the BPM and drop below; then Mark, Snap cuts, and Re-cut a track every N beats (each one undo step).
  • In the editor, each audio clip shows its volume line (yellow; dashed = after ducking): drag it to change the level, Ctrl/Cmd-click to add a keyframe, drag a point to move it, Alt-click or double-click to remove one. The corner fade grips drag a constant-power fade in or out. Both edit linked stems together.
  • Use gain for "this clip is too quiet / loud", volume keyframes for shaping, duck for dipping under dialogue, the track fader to balance whole lanes (dialogue against the music bed), and a bus when several lanes need the same processing or one fader.
diff --git a/docs/docs/captions/index.html b/docs/docs/captions/index.html index ad7963d29..8852b00a4 100644 --- a/docs/docs/captions/index.html +++ b/docs/docs/captions/index.html @@ -82,7 +82,7 @@

Captions

Captions timed word by word from the transcript, in four styles, burned into the picture; SRT and WebVTT out and in.

Captions are made from a transcript (see Transcripts and text-based editing): the timeline's words are grouped into captions, and each caption is an ordinary text clip with wordTimes (each word's start and end), so its animation follows the speech word by word, and caption: true, so captions can be found, replaced and exported as a group. Because they are text clips they render the same way in preview and export (burned into the picture), and the Inspector restyles them like any title.

stylelook
subtitle (default)plain text on a dark bar, low on the frame, up to two lines
karaokebold outlined text; each word lights up as it is said
highlightbig uppercase outlined words, the one being said in a colour (highlightColor) - the short-video look; up to five words
popone to three big words at a time, each popping in as it is said

A new caption starts at a pause of 0.6 s or more, after a sentence, after a comma once it has three words, or when it would run too long (lines, words or seconds). Lines are as long as fit the canvas at the style's size: sizes follow the canvas's shorter side, so a 9:16 reel gets narrower captions than a 16:9 video. Each caption stays about a quarter of a second after its last word, never into the next one, and starts and ends on whole frames.

They go on the video lane captions are already on; otherwise on the top video lane when nothing is there while they run, else on a new lane above it. Making captions again replaces the ones there. Make them after the cutting is done: a cut through a caption shortens it but doesn't re-time its words, so make them again after you change the edit. The editor says so for a moment whenever an edit shortens a caption.

In the editor, the Captions row of the Transcript tab: pick a style, then Add captions (one undo step). SRT and VTT download the timeline's captions as a subtitle file; Import… places the captions of an SRT or WebVTT file instead, re-broken to the style's line length, with their words spread over each caption. Select a caption to restyle it in the Inspector: the Highlight colour sits under Animation, and a note says its words follow the speech.

Agents use fablecut_captions:

  • {} or {style:"highlight"} makes captions from every clip with sound (transcribing what has no transcript yet, as fablecut_transcribe does), and answers with where they went and the first few. clipIds, from / to limit it; lines, words and size (a scale on the style's size) adjust it; track picks the lane; replace:false keeps the captions already there.
  • {export:"srt"} or {export:"vtt"} writes the captions that show (not disabled, not on a disabled track) to exports/<project name>.srt or .vtt, adding a number when that name is taken (<project name> 2.srt), and returns the path: use that one.
  • {import:"<path to .srt or .vtt>"} places a file's captions (the file's text works too).
  • {remove:true} deletes every caption clip. Locked captions are left alone and refuse the call unless force:true.
  • Check one with fablecut_frame {time} while a word is being said. Restyle them all with updateClip (e.g. props:{highlightColor:"#22d3ee", y:500}) on each caption id from the compact view, which lists a caption as [5 words timed to speech] instead of its times.
diff --git a/docs/docs/color/index.html b/docs/docs/color/index.html index 5c02d034d..d3aa14f5d 100644 --- a/docs/docs/color/index.html +++ b/docs/docs/color/index.html @@ -87,7 +87,7 @@

Color

"exposure": -0.6 } ]
keydoes
name · ona label; on:false turns the layer off
qualifier.hue[centre°, width°, soft°] - hues within ±width/2 of the centre, easing out over soft; wraps through red. Greys carry no hue, so a hue range leaves them out
qualifier.sat · qualifier.luma[low, high, soft] on 0…1 - saturation (HSV) / Rec.709 luma between low and high
qualifier.invertselect everything else
mask.shapeellipse · rect · poly · bezier (or freehand with a stroke, fitted into a bezier - see Masks)
mask.x · mask.ycentre, as fractions of the clip's picture (0…1, y down)
mask.w · mask.hsize, fractions of the picture's width / height (ellipse, rect)
mask.rotationdegrees, clockwise
mask.feathersoft edge, a fraction of the picture's height (0…0.5), centred on the outline
mask.pointspoly: 3–16 [dx, dy] corners around x, y (fractions of width / height); bezier: 3–24 anchors [dx, dy] or [dx, dy, inX, inY, outX, outY] with curve handles
mask.invertgrade outside the shape
mask.keysanimate it: [{t, x?, y?, w?, h?, rotation?, feather?, ease?}], t in seconds from the clip's start; each param eases between the keys that set it (ease on the arriving key, as for clip keyframes)

Masks live in the clip's own picture, so they follow the clip when it is moved, scaled, rotated, cropped or flipped. On an adjustment layer they are fractions of the canvas.

In the editor the strip under Copy / Paste lists Primary and the layers; + Layer adds one. With a layer picked, the wheels, sliders and curves edit that layer, and three more sections appear: the layer's name, On, Matte (the monitor shows what it selects, white = graded), ↑ ↓ to reorder, Delete; Qualifier - Pick then click a colour in the monitor to select its hue, saturation and luma, then tune the ranges; and Mask - pick a shape and drag it on the monitor (inside moves it, the handles resize it, the knob rotates it, Shift snaps to 15°; on a poly or bezier, Ctrl-click adds a point and double-click removes one), or Draw a free-hand outline on the monitor (it becomes a bezier). ◆ Key keys the shape at the playhead; once it has keys, every change to the shape keys.

Wheel colours. A wheel's r, g, b normally carry no brightness: they are a point on the vectorscope's Cb / Cr plane, so pushing a wheel toward a colour moves the picture's trace toward that colour's target. To tint shadows teal by about 0.03: lift: [-0.034, 0.008, 0.012, 0] (r = 1.5748·Cr, g = −0.1873·Cb − 0.4681·Cr, b = 1.8556·Cb, with Cb = 0.0065, Cr = −0.0216 here). Small values go a long way - ±0.02…0.05 on lift and offset, ±0.05…0.15 on gamma and gain.

Agents set a grade with the patch op setGrade and check it with fablecut_scopes:

  • {op:"setGrade", id:"c_a", grade:{exposure:0.3, temp:-15, contrast:1.15}} - merges into the clip's grade key by key; null on a key resets it; replace:true starts from neutral; grade:null clears it; ids:[…] grades several clips at once. curves merges per channel: grade:{curves:{r:[[0.5, 0.55]]}} keeps the other channels, curves:{y:null} removes the luma curve. layers replaces the whole layer list. Unknown keys or bad values refuse the whole patch. Locks apply (force:true as elsewhere).
  • {op:"setGradeLayer", id, layer, set:{…}} edits one layer: layer is an index (0 = first) or a name. A name that isn't there yet - or the index one past the end - adds a layer. set takes any layer key and merges like setGrade; qualifier and mask also merge key by key (mask:{x:0.6} moves it, qualifier:{luma:null} drops the luma range). replace:true starts the layer from scratch (keeping its name), remove:true deletes it. ids:[…] works too.
  • fablecut_scopes {time} renders the graded frame at time (default: the playhead) exactly as export would - an open editor tab, else headless - and returns numbers: luma min / 1st percentile / median / mean / 99th percentile / max (0–1), the % of pixels at pure black and pure white, mean R/G/B, average saturation, and the midtones' colour cast (hue name, hue angle, strength; "neutral" below 0.01), plus the clips on screen and their grades. With an exportFrame it measures the delivered crop.
  • fablecut_scopes {time, matte:{clip, layer}} also measures what one layer selects: the matte's coverage (% of that clip's own picture, measured alone - other clips and adjustment layers don't count) and the levels, mean RGB, saturation and cast of the selected pixels after grading. A coverage near 0 means the qualifier or mask misses; check it before trusting a secondary.

Reading the numbers: a normally exposed shot has its median near 0.35–0.5; whitePct above ~1 means clipped highlights (lower highlights / whites, or add highSoft); blackPct above ~2 means crushed shadows. A cast strength above ~0.03 on a scene that should be neutral wants white balance: move temp against the cast (orange / yellow → lower temp; blue / cyan → raise it) and tint against green / magenta, then measure again.

Secondary workflow: grade the whole shot first (primary), then add a layer for the one thing that needs its own correction - e.g. skin: {op:"setGradeLayer", id, layer:"Skin", set:{qualifier:{hue:[25, 40, 20], sat:[0.12, 0.7, 0.1]}, saturation:92}}, then fablecut_scopes {matte:{clip:id, layer:0}} - expect a coverage that matches how much of the frame is skin and a cast near orange (hue ~25–35°). A sky: qualifier:{hue:[210, 50, 25], luma:[0.45, 1, 0.1]} with hueSat:[[210, 1.25]]. A vignette or a relight: a feathered ellipse mask with invert:true and exposure:-0.5, or without invert and exposure:+0.3 on a face; give it keys to follow a move.

Workflow for matching shots: grade the hero shot, measure it, then grade every other shot of the scene until its median and cast land near the hero's. In the editor, Copy / Paste on the Color tab pastes one clip's grade onto every selected clip.

diff --git a/docs/docs/compositing/index.html b/docs/docs/compositing/index.html index 6e1ceedcc..695e436e7 100644 --- a/docs/docs/compositing/index.html +++ b/docs/docs/compositing/index.html @@ -82,7 +82,7 @@

Track mattes and blending

Cut a clip with the picture on another track by its alpha or its brightness, and lay clips over each other with blend modes, from the Inspector or from an agent with setMatte.

A track matte cuts a clip with the picture on another track: where that picture is opaque (alpha) or bright (luma), the clip shows. Set it on the clip being cut, the fill:

propdoes
mattealpha · alpha-inverted · luma · luma-inverted. Alpha keeps the clip where the matte's pixels are opaque, luma where they are bright (white = shows, black = gone, Rec. 709 weights). The inverted modes keep the opposite
matteTrackthe video track the matte comes from. Default: the video track directly above the clip (V2 for a clip on V1)

The matte track does not draw into the frame while a clip on screen uses it; it only cuts. Its clips keep their own transform, keyframes, opacity, masks and effects, so the matte can move, scale and animate on its own. When the matte track has nothing at that moment, alpha / luma show nothing of the clip and the inverted modes show all of it. Track mattes and masks combine: the matte cuts the clip, then its masks cut what is left, then opacity and blend composite it. A clip used as a matte is drawn without its own track matte. Audio clips take neither.

blend is how a clip lays over what is under it: normal · multiply · screen · overlay · darken · lighten · color-dodge · color-burn · hard-light · soft-light · difference · exclusion · hue · saturation · color · luminosity · lighter (add). Blending happens after masks and mattes, so a masked clip only blends where it is kept.

In the editor, Track matte and Matte track sit under Blend in the Inspector's Transform section (the Adjustment layer section for an adjustment layer). The timeline marks a clip with a track matte ◐ and shows the clips that serve as its matte hatched, labelled Matte.

Agents: {op:"setMatte", id, matte:"luma"} (or ids:[…]; track:"V3" picks the matte track, track:null goes back to the one above; matte:null removes it). blend, matte and matteTrack written through addClip / updateClip are validated too. fablecut_scopes lists each clip on screen with its matte (e.g. luma from V2), blend, and whether it is a matte itself.

Recipes: text filled with video - the text on V2, the video on V1 with matte:"alpha"; a shape reveal - an svg or a masked solid on V2 whose scale keys up, the shot on V1 with matte:"alpha"; light leaks / film burn on V2 with blend:"screen"; a grade only in the bright areas - an adjustment layer with matte:"luma" over a copy of the shot; a cut-out through a texture - luma-inverted against a black-and-white texture.

diff --git a/docs/docs/compositions/index.html b/docs/docs/compositions/index.html index 170fe9727..ed0eefe2e 100644 --- a/docs/docs/compositions/index.html +++ b/docs/docs/compositions/index.html @@ -95,7 +95,7 @@

Compositions (nested sequences)

"props": { "fit": "none", "y": 220 } } ]
keydefaultdoes
id · name- · the idhow clips and agents refer to it · the label shown on its clips and in the bin
width · heightthe project'sthe comp's frame, px (16…8192)
duration-seconds; what the comp shows past its clips is transparent (or its background)
backgroundnonea colour behind the comp's clips; leave it out for transparent
tracksV3…V1, A1, A2the comp's own lanes, like the project's tracks
clips[]ordinary clips of any kind (comp clips too), with times inside the comp
template-set on a placed template: {id, hold, fields} (see Presets and templates)

A comp clip (kind:"comp", compId, no mediaId) shows the comp from its in (comp seconds) for its duration, at speed 1. It draws like a picture of the comp's size: fit defaults to none (the comp's own pixels), and its transform, keyframes, opacity, transitions, masks, track matte, blend, grade and filters all apply to the comp's frame as a whole. Trims and splits move its in like a video clip's; the window can't run past the comp's length.

The media inside a comp plays and exports as if it were on the timeline: its video frames, and its audio, which goes through the main timeline's audio track of the same name (its fader, effects and bus). A comp clip that is disabled, or sits on a disabled track, silences the comp's audio too. Comps nest up to 4 deep, and a comp can never contain itself.

In the editor: the bin's Project tab lists the comps; drag one onto the timeline to place it, and double-click it (or a comp clip, or Open in the Inspector's Composition section) to open it. An open comp takes over the timeline: every tool, shortcut and inspector works on its clips, and the breadcrumb above the timeline (or Esc, once nothing is selected) goes back out. Right-click clips → Precompose moves them into a new comp and puts a comp clip in their place; right-click the Project tab → New composition starts an empty one. The Composition section also sets the comp's name, size, length and background.

Agents:

  • {op:"addComp", comp:{id?, name, duration, width?, height?, background?, tracks?, clips?:[…]}} adds one (its clips go through the same checks as addClip). {op:"updateComp", id, set:{name?, width?, height?, duration?, background?, tracks?}} changes it; {op:"removeComp", id} is refused while a clip still uses it.
  • Place it with addClip {kind:"comp", compId, track, start, duration, in?}.
  • {op:"inComp", comp, ops:[…]} runs clip and timeline ops on the comp's own clips: addClip, updateClip, removeClip, split, rippleDelete, the trims, setShape, setMask, setGrade, setParent, setMotionPath, setTextPath, clip setFx, precompose, and inComp for a comp inside it.
  • {op:"precompose", ids:[…], name?, id?} moves those clips (here, or in the comp an inComp is running in) into a new comp that starts at the earliest of them; a comp clip of the same length takes their place.
  • The compact view shows a comp clip as comp(lt in:1.5) and lists every comp under COMPS with its clips.

Recipes: reusable lower third - a template (next section) gives every speaker their own copy with their own name; a plain comp suits a graphic that is the same every time; logo sting - a draw-on logo comp at the head and tail of the edit; picture in picture of a whole scene - precompose the scene's clips, then scale the comp clip down and move it into a corner; one grade for a sequence - precompose it and grade the comp clip once.

diff --git a/docs/docs/editing/index.html b/docs/docs/editing/index.html index 9fcc378d2..10ea8177c 100644 --- a/docs/docs/editing/index.html +++ b/docs/docs/editing/index.html @@ -82,7 +82,7 @@

Editing rules

How tracks, links, locks, targeting and the trim tools behave, for people and agents alike.

  • Rendering order: V1 is drawn first, then V2, V3, … on top. SVG/image/text clips go on any V track (higher V lanes are handy overlay lanes). Add lanes with the timeline +V / +A buttons (or by listing them in tracks); up to 16 per kind. Right-click an empty track header → Remove track (disabled if the lane has clips or is the last video/audio track).
  • Audio tracks A1–An hold both standalone audio files and linked companions for imported video. Dropping a video creates the picture on a V track (props.volume: 0 so it isn't doubled) plus one kind:"audio" clip per source channel on consecutive A-tracks that share a linkGroup (and the same mediaId / timing). Each stem is mono-isolated then placed with pan (defaults preserve stereo: L −1, R +1). Standalone music/SFX also live on A-tracks. Linked partners move/trim/split together - edit timing on any member of the group; do not treat A-tracks as music-only.
  • Three track switches (Premiere-style), all in the track header and all persisted on project.json:
    • Enable (eye / speaker) → disabledTracks. Output only: a disabled lane is left out of preview, audio and export. It does not affect editing.
    • Target (click the track name - lit = targeted) → untargetedTracks. Decides which lanes an edit touches when nothing is selected: split at playhead (S), insert ripple (,), replace punches (.), ripple-delete shifting (⇧Del), close gap (⇧G), next gap (G), split / trim at IN/OUT (T / ⇧T) and jump to cut (↑ / ↓). Source placement follows targeting too: the picture lands on V1 if it is targeted, else the lowest targeted video lane (none → the edit lands audio-only); stems land on the first two targeted audio lanes. A selection is always edited wherever it sits.
    • Lock (padlock) → lockedTracks. Nothing on a locked lane can be moved, trimmed, split, deleted or edited in the inspector, and ripples leave it where it is while the other lanes shift. A locked lane is never an edit target. Typical use: lock the music bed, then ripple the picture freely.
  • Clip lock / enable - right-click a clip, or use the toggles at the top of the inspector. locked: true pins one clip the same way a locked lane does. disabled: true (⇧E) keeps the clip on the timeline but drops it from preview, audio and export - like a disabled lane, for a single clip. Both apply to the clip's whole linked group.
  • Locks and linked groups - a linked A/V group with any locked member (its own flag or its lane) counts as locked as a whole, so sync is never broken by a partial move.
  • Sync lock - edits that shift clips move the targeted lanes; linked AV partners always ride along, even on an untargeted lane, and locked groups stay put. On reload relinkClips rebuilds linkGroup from matching mediaId / start / in / duration.
  • Unlink / link (Ctrl/Cmd+L) - unlinking a group removes its linkGroup and stamps unlinked: true on each member, so the reload-time relink leaves them apart; picture and audio then move, trim and delete separately. Link (select one video clip plus its audio, Ctrl/Cmd+L) only joins clips of the same file that line up exactly - same start, in and duration - because a link here means identical timing.
  • Agents and locks - fablecut_patch_project refuses updateClip / removeClip on locked material (own flag, locked lane, or a linked partner of one) and addClip onto a locked lane. Treat locked clips as the user's finished work: leave them alone. Only when the user asks you to change one, pass force: true on that op, or unlock first with updateClip set:{locked:null} (always allowed). fablecut_set_project, REST PUT and direct file edits are not guarded - respect locks there too.
  • Media is fit-ted to the canvas (default "contain"), then crop → scale/x/y/ rotation → flips apply.
  • props keys are all optional - missing keys get the defaults above.
  • Video/audio clips must satisfy in + duration×speed ≤ media.duration.
  • Keyframes fully override the static prop value while present; they are clip-local and are re-based automatically when clips are split or trimmed.
  • Transitions modulate the evaluated props (fade also fades audio); they render on top of keyframes, so both can coexist.
  • Same-track overlap IS the crossfade idiom: overlap A and B by ~1 s and give B transitionIn: {type:"fade"} (for audio also A transitionOut, both with curve:"power" - see Audio mix).
  • A cut/split is just two clips: first with duration: t, second with start: +t, in: +t×speed, duration: rest.
  • Edit tools (timeline toolbar picker, or V / B / R / Y / U) change what a clip drag does. Agents run the same edits with the patch ops rippleTrim, roll, slip and slide (see Timeline edit ops).
    • Selection (V) - move and trim, as always.
    • Ripple edit (B) - drag a clip edge; everything after it on the targeted tracks (and the clip's own lanes) moves with it, so no gap opens or closes. Dragging a head keeps the clip's start and trims its source In.
    • Rolling edit (R) - drag a cut; the clip on one side lengthens by what the other loses, nothing else moves.
    • Slip (Y) - drag a clip to change its source In only (dragging left shows later source); position and length stay. Video / audio clips only.
    • Slide (U) - drag a clip along its track; the clip before it trims its tail and the clip after it its head, so the sequence length stays. All four are clamped to the available source media, MIN_DUR and the free room on the track, take linked partners with them, and refuse on locked clips; a readout by the pointer shows the offset while dragging.
  • Lift (;) / Extract (') - remove IN→OUT on the targeted tracks. Lift leaves the gap; Extract closes it. Linked partners are cut too, locked clips stay whole, and IN / OUT clear afterwards.
  • Jump to cut - ↑ / ↓ move the playhead to the previous / next clip In or Out. Selection first (that clip’s start then end); no selection walks targeted-track cuts. Source monitor: 0 / In / Out / duration. Does not change project.json.
  • bgRemove and chromaKey can combine with all filters; heavy pixel work is automatic (only runs when those props are set).
diff --git a/docs/docs/export/index.html b/docs/docs/export/index.html index e95091755..b6d60700d 100644 --- a/docs/docs/export/index.html +++ b/docs/docs/export/index.html @@ -128,7 +128,7 @@

Export

} }

Export is one ffmpeg pass. The server owns the input side and the output path; args is everything in between (plus JPEG color conversion derived from color):

ffmpeg -y -f image2pipe -framerate <fps> -i - [-i audio.wav] <jpeg-color> <args…> exports/<name><extension>
  • There is no allow-list. Any codec, filter, container or flag your local ffmpeg supports works - ProRes, DNxHD, NVENC/QSV/VideoToolbox, VP9/AV1, 10-bit, HDR tags. See the shipped prores422, broadcast1080i50, nvenc-h264, nvenc-hevc, videotoolbox-h264 and videotoolbox-hevc profiles (the NVENC ones need an NVIDIA GPU; VideoToolbox requires macOS / Apple Silicon).
  • Args are validated by ffmpeg itself, not by a schema: when an export starts the server dry-runs the profile against a 0.1 s synthetic input (lavfi). A typo or an encoder your build lacks is rejected up front with ffmpeg's own message, instead of failing after every frame has been rendered.
  • Use the array form - each element is passed to spawn untouched, so no quoting is needed (["-vf", "drawtext=text='hi there'"] just works). A plain string is accepted and split on whitespace.
  • color controls JPEG→YUV conversion and stream tags (-colorspace / -color_primaries / -color_trc / -color_range). Default is BT.709 limited (range: "tv"). Use "range": "pc" for full-range masters. Do not put those flags in args - the engine strips them and applies color so vf and tags stay aligned. -pix_fmt stays in args (sampling / bit depth only).
  • Nothing else is injected for you: +faststart, -shortest, -strict -2 for Opus in MP4 and pixel-format choices are all yours to write.
  • Frames arrive as JPEG (4:2:0), so yuv422p/yuv444p cannot recover chroma the source never had; raise jpegQuality before reaching for a wider pixel format. Optional pixelFormat:"rgba" on /api/export/begin pipes uncompressed canvas frames instead (-f rawvideo) when a caller wants full chroma.
  • The audio mix is only present when the timeline has audio; with no audio there is a single input, so avoid hardcoded -map 1:a.

Note: Fast export pipes composited JPEG frames from the browser (-f image2pipe), not -i source.mp4. Filters and codec settings apply to that frame stream. To transcode an existing file verbatim, run ffmpeg directly - that is outside the compositor path.

Encoding profiles are listed at the bottom of the Export dialog's Preset list.

What the Export dialog opens on (priority):

  1. project.delivery, then project.encodeProfile - set with setProject
  2. The last preset or profile used in this browser
  3. The master delivery preset

MCP: fablecut_encode_profiles lists profiles; {detail:true} includes each args array; {profile:"hq"} returns one profile. fablecut_status shows the effective profile.

diff --git a/docs/docs/frames/index.html b/docs/docs/frames/index.html index a9a1fec3f..2eb82afbc 100644 --- a/docs/docs/frames/index.html +++ b/docs/docs/frames/index.html @@ -82,7 +82,7 @@

Look at the footage

Show an agent what the footage holds: one frame, a contact sheet across a clip, or the composed timeline - as an image, or as text-only measurements for models without vision.

fablecut_analyze_reference gives you the ears - where the cuts are, how hard each shot hits. fablecut_frame gives you the eyes. It answers with a real image (an MCP image content block), so you can judge a shot instead of inferring it from an energy value.

callreturns
{path:"/media/x.mp4", t:3.2}that exact frame
{path:"/media/x.mp4", frames:12}a 4×3 contact sheet across the whole clip
{path:"/media/x.mp4", frames:12, from:30, to:90}a contact sheet across part of it
{time:8.5} (no path)the composed timeline at 8.5 s, graded, all tracks
{path} with an absolute paththe file is read in place without copying into media/
{path, text:true}text-only statistics (luma, colors, texture, saturation, motion) for non-vision agents

Each answer leads with a text line naming the source, the timestamp(s) and (in timeline mode) the clips on screen, so you always know what you are looking at. width sets the pixel width (default 768 for one frame, 320 per contact-sheet cell); text:true returns descriptive statistics instead of an image block, for agents without vision capability - luma levels (min, p1, median, mean, p99, max, all 0–1 like fablecut_scopes), dominant colors, texture, saturation and per-cell motion; where/timeout apply to timeline mode only.

The REST endpoint /api/frame accepts src, t, frames, from, to, w, q (JPEG quality 1–31) and text=1 (statistics mode) as query parameters.

When it pays. Before choosing a clip's in point, sample a few candidate moments - the blueprint tells you a shot spans 2.1 s–4.9 s and reads energy: 88, but only a frame tells you whether that is a car jump or a pan across a landscape. Contact sheets are the cheap survey: one call shows you what a whole 3-minute clip holds, then you grab single frames where it matters. Timeline mode answers "what did I actually build?" - the same picture the user sees and export renders, grades and transitions included.

Needs ffmpeg on PATH for the source modes. Timeline mode runs in the open editor tab, else a headless browser, like fablecut_export.

diff --git a/docs/docs/library/index.html b/docs/docs/library/index.html index 9fbd6e630..0d3a6f7bb 100644 --- a/docs/docs/library/index.html +++ b/docs/docs/library/index.html @@ -80,7 +80,7 @@

Asset library

Sound effects, overlays, fonts and animated SVGs that ship with the editor, and how to make your own.

-

The asset library#

Reusable assets, visible in the editor's left-panel tabs and never copied:

FolderEditor tabPurpose
library/sfx/Sound FXwhooshes, impacts, risers, UI clicks
library/elements/Elementsoverlay art: alpha PNGs, light leaks, textures, stickers
library/svg/SVGanimated vector graphics you author (convention below)
library/fonts/font editor.ttf/.otf/.woff/.woff2, auto-registered, family name = file name; a variable font draws every weight
library/presets/Inspector → Motion → Presetssaved animation presets, one .json each (see Presets and templates)
library/templates/Templatessaved templates, one .json each, listed after the built-in ones
library/workflows/-saved workflows, one .json each (see Workflows)
  • List via GET /api/library?dir=sfx|elements|svg|fonts|presets|templates|workflows (recursive; subfolders OK).
  • To use one in the timeline, add a media entry whose src is its library path, e.g. { "id":"m_x", "name":"whoosh.mp3", "kind":"audio", "src":"/library/sfx/whoosh.mp3" } - then reference it from clips like any other media.
  • Dropping files into these folders live-refreshes the open UI.

Authoring animated SVGs#

You can create your own vector animations/overlays: write an .svg file into library/svg/ (or media/), register it as media with "kind": "svg", and place it on a video track. The compositor renders it frame-accurately, driven by the clip's local time (preview and export).

Conventions (required for time-driven animation):

  1. Root <svg> must carry width and height attributes (or a viewBox).
  2. Animate with CSS @keyframes inside a <style> block - SMIL (<animate>) is NOT time-controlled.
  3. Never write a literal animation-delay. For staggered starts set the custom property --d on the element instead: style="--d:0.4s". (The engine drives time by overriding animation-delay to calc(var(--d,0s) - t) with animations paused.)
  4. animation-fill-mode: both (or the both keyword in the shorthand) for one-shot intros; infinite for loops - both work.
  5. For rotations/scales around an element's own center add transform-box: fill-box; transform-origin: center;.
  6. Keep files self-contained (no external hrefs).

Skeleton:

<svg xmlns="http://www.w3.org/2000/svg" width="800" height="450" viewBox="0 0 800 450">
+    

The asset library#

Reusable assets, visible in the editor's left-panel tabs and never copied. The bin's tabs are Project, Audio (Music, SFX) and Graphics (Elements, SVG, Shapes, Templates); a group remembers the tab last open in it.

FolderEditor tabPurpose
library/sfx/SFXwhooshes, impacts, risers, UI clicks (the tab also searches sound effects online - see Music)
library/elements/Elementsoverlay art: alpha PNGs, light leaks, textures, stickers
library/svg/SVGanimated vector graphics you author (convention below)
library/fonts/font editor.ttf/.otf/.woff/.woff2, auto-registered, family name = file name; a variable font draws every weight
library/presets/Inspector → Motion → Presetssaved animation presets, one .json each (see Presets and templates)
library/templates/Templatessaved templates, one .json each, listed after the built-in ones
library/workflows/-saved workflows, one .json each (see Workflows)
  • List via GET /api/library?dir=sfx|elements|svg|fonts|presets|templates|workflows (recursive; subfolders OK).
  • To use one in the timeline, add a media entry whose src is its library path, e.g. { "id":"m_x", "name":"whoosh.mp3", "kind":"audio", "src":"/library/sfx/whoosh.mp3" } - then reference it from clips like any other media.
  • Dropping files into these folders live-refreshes the open UI.

Authoring animated SVGs#

You can create your own vector animations/overlays: write an .svg file into library/svg/ (or media/), register it as media with "kind": "svg", and place it on a video track. The compositor renders it frame-accurately, driven by the clip's local time (preview and export).

Conventions (required for time-driven animation):

  1. Root <svg> must carry width and height attributes (or a viewBox).
  2. Animate with CSS @keyframes inside a <style> block - SMIL (<animate>) is NOT time-controlled.
  3. Never write a literal animation-delay. For staggered starts set the custom property --d on the element instead: style="--d:0.4s". (The engine drives time by overriding animation-delay to calc(var(--d,0s) - t) with animations paused.)
  4. animation-fill-mode: both (or the both keyword in the shorthand) for one-shot intros; infinite for loops - both work.
  5. For rotations/scales around an element's own center add transform-box: fill-box; transform-origin: center;.
  6. Keep files self-contained (no external hrefs).

Skeleton:

<svg xmlns="http://www.w3.org/2000/svg" width="800" height="450" viewBox="0 0 800 450">
   <style>
     .a { transform-box: fill-box; transform-origin: center;
          animation: pop 0.5s cubic-bezier(.34,1.56,.64,1) both; }
diff --git a/docs/docs/masks/index.html b/docs/docs/masks/index.html
index dd12024e1..7244d8676 100644
--- a/docs/docs/masks/index.html
+++ b/docs/docs/masks/index.html
@@ -88,7 +88,7 @@ 

Masks

"keys": [{ "t": 0, "x": 0.3 }, { "t": 2, "x": 0.6, "ease": "linear" }] } ]
keydefaultdoes
shape-rect · ellipse · bezier (write freehand with a stroke to have one drawn for you)
x · y0.5centre, as fractions of the clip's picture (0…1, y down)
w · h0.5size, fractions of the picture's width / height (rect, ellipse)
points-bezier: 3–64 anchors around x, y, each [dx, dy] (a corner) or [dx, dy, inX, inY, outX, outY] (with curve handles relative to the anchor), all fractions of the picture's width / height
stroke-freehand only: [[u, v], …] picture fractions along an outline; it is simplified and stored as an editable bezier
scale · rotation1 · 0about the centre; degrees clockwise
modeaddhow this mask combines with the ones before it: add · subtract · intersect · difference
invertfalseuse everything outside the shape
opacity10…1, how strongly this mask counts
feather0soft edge, project pixels, centred on the outline
expand0grow (+) or shrink (−) the outline, project pixels
name · on-a label; on:false turns the mask off
keys-animate it: [{t, x?, y?, w?, h?, scale?, rotation?, feather?, expand?, opacity?, points?, ease?}], t in seconds from the clip's start; each param eases between the keys that set it (ease on the arriving key, as for clip keyframes). points keys morph the outline and need the shape's point count

Masks combine bottom-up (first in the list first). The first one starts from nothing when it adds and from the whole picture otherwise, so a lone subtract cuts a hole in a full picture. At most 8 masks per clip.

The picture a mask lives in is the clip's drawn rectangle for video, image and svg (after fit and crop), the text block for text, and the whole canvas for an adjustment layer. Masks follow the clip when it is moved, scaled, rotated or flipped, and keep the clip's keyframes.

In the editor, the Masks section of the Inspector has + Rect, + Ellipse, Pen (click points on the monitor, drag while placing one to pull curve handles, click the first point or press Enter to close) and Draw (drag a free-hand outline). Matte shows the clip's matte in the monitor (white = visible). Pick a mask's chip to edit it: mode, Invert, the sliders, ↑ ↓ to reorder, Copy, Delete, and on the monitor, drag inside to move it, the edge handles to resize it and the knob to rotate it (Shift snaps to 15°). On a bezier, drag a point to move it, drag its handles to curve it (Alt breaks the pair), Alt-drag a point to pull fresh handles, Ctrl-click the outline to add a point, and double-click a point to remove it. ◆ Key keys the whole mask at the playhead; once it has keys, every change keys. Esc steps back (point, then mask).

Agents edit masks with patch ops:

  • {op:"setMask", id, set:{shape:"ellipse", x:0.5, y:0.45, w:0.4, h:0.7, feather:40}} adds a mask (no mask, an index one past the end or a new name adds one; a new mask needs shape). {op:"setMask", id, mask:"Subject", set:{x:0.6}} edits one, by index (0 = first) or name, merging key by key (null resets a key). replace:true starts it over, keeping its name. ids:[…] edits several clips.
  • A drawn outline: set:{shape:"freehand", stroke:[[0.4, 0.3], [0.6, 0.32], …]}. It is stored as an editable bezier.
  • {op:"setMaskKeys", id, mask, keys:[{t:0, x:0.3}, {t:2, x:0.7}]} animates one (keys:null stops it); {op:"removeMask", id, mask} deletes one.
  • props.masks written through addClip / updateClip is validated the same way. Bad keys, shapes or values refuse the whole patch. Locks apply (force:true as elsewhere).
  • fablecut_scopes {time, mask:{clip}} measures them: the % of the clip's picture its masks keep (the feathered matte, measured alone) and the % of the frame the masked clip covers. The compact project view lists each clip's masks as [2 masks: ellipse feather 40, rect subtract].

Recipes: spotlight - a feathered ellipse on the clip; split screen - two clips on V1 / V2, a rect on the top one covering its half; cut a logo out of the background - a bezier around it, feather 2–4; reveal - a rect whose w (or x) keys from 0 to full; effects only on the face - an adjustment layer with a feathered ellipse, keyed to follow it; vignette through an adjustment layer - an inverted ellipse with feather:200 and the layer's brightness down.

diff --git a/docs/docs/media/index.html b/docs/docs/media/index.html index 4f7c99ac6..6a17c3996 100644 --- a/docs/docs/media/index.html +++ b/docs/docs/media/index.html @@ -82,7 +82,7 @@

Media management

File details, search, filters, sorting, tags and collections, where each file is used, relinking missing files, and proxies for heavy footage.

The Project bin knows each file's details and helps find, group and track footage. The bin's organizing (details, favorites, tags, collections, search) changes nothing that plays or exports; moving and trashing the files themselves ("Files on disk" below) does what it says.

Metadata. The editor reads every file in media/ and library/ with ffprobe (via GET /api/media-info) and writes what it finds onto the media entry. These fields are read-only - they describe the file:

keydoes
fpsvideo frame rate (29.97, 25, 59.94 …); absent for stills and audio
codecvideo codec (h264, hevc, prores, vp9 …), or the image format (png, mjpeg)
audioCodec · audioChannels · sampleRatefirst audio stream: codec, channel count (0 = the file has no audio), Hz
size · bitratefile size in bytes · overall bitrate, bits per second
width · height · durationas before; filled in when missing (phone footage shot rotated reports its upright size)

Without ffprobe on PATH only size is filled in; the browser still probes duration, width and height.

Organizing. favorite: true stars a file; tags is a list of free-form labels (at most 24, each up to 32 characters, matched without regard to case). collections at the top of the document group media across folders - a file can be in any number of them, while it sits in one folder (folderId).

Usage. A file's placements are the clips that show it, on the main timeline and inside every composition. A video and the audio stems linked to it count as one placement, so a shot used twice reads "used 2×".

In the editor, the Project tab has:

  • Search - every word must match the name, kind, extension, codec, resolution (3840x2160, 2160p) or a tag; #word matches tags only. Esc clears it.
  • Show - All media · ★ Favorites · Used in the edit · Unused · a kind · a collection · a tag. While searching or filtering, the bin lists the hits flat (each with its folder), with a count and Clear; a collection's view also has Rename and Delete (its media stay).
  • Sort - name (natural: shot 2 before shot 10), kind, duration, resolution, frame rate, codec, audio channels, file size or times used, with ↑ / ↓. Files missing a value sort last either way. Folders keep their tree; the sort applies inside each.
  • ☰ List view - one row per file with columns: name, duration, resolution, FPS, codec, audio, size and uses; click a column heading to sort by it. On a narrow bin the columns drop out right to left; widen the panel to see them all.
  • On each file: ☆ stars it, the uses badge opens its placements. Right-click a file → Open in Source, Find timeline instances (every placement, main timeline and comps, with track and time - click one to jump there, opening its comp if needed), Media info…, favorites, Tags…, Add to / Remove from a collection, New collection…, Remove from project.
  • Right-click a clip on the timeline → Reveal in project scrolls the bin to its file (or its comp), opening folders and clearing a search that hides it.

Offline media. A file is offline when its src names nothing under media/ or library/ - it was moved, renamed or deleted. The editor checks on load and whenever those folders change. An offline file's clips stay where they are: the timeline hatches them red (⚠ Offline), the monitor and the export draw a Media offline slate in the picture's place, and its audio is silent. The bin marks the file OFFLINE, says how many are missing, and the Show filter gains ⚠ Offline. The Export dialog warns before rendering one. Files under media/ may sit in subfolders (/media/archive/a.mp4).

  • Relink points a media entry at the same footage where it is now; clips keep their In points, edits and everything else. Right-click the file → Relink… (or Relink… on the offline banner for all of them). The dialog looks through media/ and library/ for each file - same name, the same name with another extension, a similar name, the same size - and picks a same-name match for you. Browse… picks one file and Choose folder… matches a whole folder by name; either copies the chosen files into media/. A relinked file whose length differs from the original gets a warning (is it really the same footage?).
  • Replace file… (right-click a file) puts a different file behind the media entry - a new render, a better take. Every clip using it switches; each keeps its In point and timing, trimmed to fit a shorter file. The name and details follow the new file; favorites, tags and collections stay. To swap the file of one clip only, use the Inspector's Source menu instead.
  • Relink and replace are one undo step each.

Proxies. Heavy footage - 4K, HEVC, ProRes, long phone clips - can stutter while you scrub and play. A proxy is a light copy the editor plays instead while you edit: H.264 at 540p (or 720p / 1080p, never larger than the source), a keyframe every 12 frames so seeking is quick, the source's own timestamps (frame for frame - no frames added or dropped) and its first audio stream. The edit always refers to the original: the timeline, project.json and every clip stay the same whether proxies are on or off.

Export always reads the originals, and so do fablecut_frame (timeline mode), fablecut_scopes, tracking and every other measurement - the players switch to the original files for the render and back afterwards. A proxy only changes how smoothly the preview runs, never the result.

  • Right-click a video in the bin → Create proxy (540p) / (720p); right-click the Project tab → Create proxies for N videos. ffmpeg makes them on the server one at a time in the background; the bin shows each file's progress (P 42%), then a green P once it is ready. Delete proxy removes one. The bin's list view has a Proxy column, Show has Has a proxy / Video without a proxy, and Media info says which file is playing.
  • The monitor's Proxy button turns proxy playback on and off (on by default; remembered in this browser). The Source monitor follows it too.
  • Proxies live in analysis/proxies/, a disposable cache: each is named after its source file and that file's size and modification time, so a re-rendered or replaced original simply has no proxy until you make a new one. Deleting the folder loses nothing but time. Proxies need ffmpeg.

Agents:

  • {op:"updateMedia", id | ids, set:{name?, favorite?, tags?, folderId?}, addTags?, removeTags?} - organize files (favorite:false unstars; tags:[] clears). Metadata keys are refused: they come from the file.
  • {op:"setCollection", id?, name?, media?, add?, remove?} creates a collection (a new id, or a name no collection has) or changes one: media replaces its list, add / remove edit it. {op:"removeCollection", id} deletes it; its media stay. removeMedia takes a file out of every collection.
  • The compact view lists each file with its metadata, ★, tags, folder and uses:N, and the collections on one line: m_abc video "intro.mp4" 12.4s 1920×1080 29.97 fps h264 stereo 48 kHz 45 MB ★ #interview uses:2.
  • fablecut_import_media probes the file as it imports it, so the entry it returns already has these fields.
  • fablecut_status lists offline media, and the compact view marks each OFFLINE (file missing — relinkMedia) and each video with a proxy proxy:540p.
  • fablecut_proxy {} reports every video's proxy; {create:true, mediaIds?, height?} makes them (waits until done unless wait:false); {delete:true, mediaIds?} removes them. Proxies never change what you measure or export, so an agent only needs them when the user asks for smoother playback.
  • {op:"relinkMedia", id, src:"/media/…", name?} - the same footage found elsewhere: put the file in media/ (copy it, or fablecut_import_media and removeMedia the extra entry it registers), then relink. The note warns when the new file's length differs.
  • {op:"replaceMedia", id, src, name?} - a different file behind the entry; clips keep their timing, trimmed to fit (the note says how many). src must be an existing file under /media/ or /library/ of the same kind (an audio entry may use a video container).

Files on disk. The bin's folders (folders, folderId) only organize entries in project.json; the files themselves sit in media/ and may live in subfolders. fablecut_files works on those (or POST /api/files):

  • {action:"list", dir?} (an empty call to the MCP tool lists too) lists one folder: its subfolders and files with sizes and srcs. Dot-folders (media/.trash/) are left out.
  • {action:"mkdir", dir:"b-roll/day 1"} makes a folder (and its parents).
  • {action:"move", from, to} moves a file or folder into an existing folder, or to a new path (a rename); to is required ("/media/" is the top of media/). Every project's media entries that point at a moved file are repointed (the open project gets a new revision, so the editor reloads), a media name that was the old file name follows it, and the file's transcript goes with it (a warning says when one couldn't be). The move is refused while a project can't be read (force:true moves anyway, and the file goes offline there), and a project edited meanwhile stops it (CONFLICT, try again). If a project can't be written, the move is undone; if undoing fails too, the error says where the files are and which project couldn't be put back: check them there and relink. A name that is taken (also one taken while the move runs), and links inside media/, are refused, never replaced.
  • {action:"trash", paths:[…]} moves files or folders into media/.trash/<id>/files/ with a note of where they were; nothing is deleted. A file a project still uses is refused (the reply names the project and how many clips place it): removeMedia it first, or force:true to trash it anyway, and it shows as offline there until it is restored. A project whose project.json can't be read counts as possibly using it, so the same applies. One call can't list a folder and something inside it. When one of several fails, the reply lists the ones already trashed, with their ids, and the path it stopped at. {action:"trash-list"} lists the trash, {action:"restore", id} puts one back where it was (refused while something else has that name; a warning says when its trash entry couldn't be cleaned up).
  • Move, rename and trash only when the user asked: they change the user's folder. Versions keep the paths they were saved with, so restoring an old version after a move may need Relink.
diff --git a/docs/docs/motion-paths/index.html b/docs/docs/motion-paths/index.html index eac382361..fb743128a 100644 --- a/docs/docs/motion-paths/index.html +++ b/docs/docs/motion-paths/index.html @@ -87,7 +87,7 @@

Motion paths, motion blur and text on a path

"textPath": { "type": "ellipse", "w": 300, "h": 300 }, "pathAlign": "start" }, "keyframes": { "pathOffset": [ { "t": 0, "v": 0 }, { "t": 6, "v": 100, "ease": "linear" } ] } }

In the editor: when the selected clip has two or more position keys, its path shows on the monitor: the curve, a dot per frame (their spacing is the speed), a square per key and the keys' handles. Drag a key to move it, drag a handle to bend the path (Alt breaks the pair), Alt-drag a key to pull new handles, and double-click a key to make it a corner again. Moving the clip on the monitor or typing X / Y keys both channels together. The Inspector's Motion section has Smooth (handles through every position key), Straight, Auto-orient, Motion blur and Blur samples. A title's Text path section sets it on a Line, Arc, Circle, Wave or a Pen path (click points, drag to curve, Enter to finish, click the first point to close it). Edit path shows the path's points on the monitor, and Offset and Align place the text along it.

Agents:

  • Write pin / pout on x / y keys directly, or {op:"setMotionPath", id | ids, path:"smooth" | "straight", autoOrient?: true}. "smooth" needs the position keys first (x and y keyed together at two or more times).
  • Motion blur: updateClip with props:{motionBlur:180, motionBlurSamples:12}.
  • {op:"setTextPath", id | ids, path:"line" | "arc" | "circle" | "wave" | {type:"path", points:[…], closed:false, …} | null, offset?, align?} sets, replaces or removes (null) a title's path; animate pathOffset with keyframes.
  • These are validated on addClip / updateClip too. The compact view shows path:curved after a clip's keyframes, and a title's "textPath":"ellipse 300×300".

Recipes: fly-in on a curve - two position keys, setMotionPath smooth, autoOrient:true, motionBlur:180; orbiting label - circle textPath, pathOffset keyed 0 → 100 linear; stamp along a road - an open path textPath that follows the shape in the footage, pathAlign:"center", textAnim:"letter-pop"; whip without the transition - a fast x move over 4–6 frames with motionBlur:360.

diff --git a/docs/docs/motion/index.html b/docs/docs/motion/index.html index b4e46608a..3bf6fb35f 100644 --- a/docs/docs/motion/index.html +++ b/docs/docs/motion/index.html @@ -92,7 +92,7 @@

Shapes, nulls and parenting

"keys": [ { "t": 0, "rotation": 0 }, { "t": 5, "rotation": 360, "ease": "linear" } ] } ] } }
keydefaultdoes
typerectrect · ellipse · polygon · star · line · path · group
x · y0position in layer px, from the layer's origin (the clip's x/y, y down)
rotation · scale · opacity0 · 1 · 1about the item's own x, y
w · h200size, px (rect, ellipse, polygon, star)
radius0rect corner radius, px
sides · inner6 / 5 · 0.5polygon / star point count (3–64); a star's inner radius as a fraction of the outer
points-line: exactly 2 · path: 2–128 points [x, y] or [x, y, inX, inY, outX, outY] (curve handles relative to the point), px around the item's x, y
closedtruepath only; false leaves it open (lines are always open)
fill · stroke#ffffff · none"#rrggbb", "#rrggbbaa" or "none"; lines and open paths default to a white stroke and no fill
strokeWidth6 (8 open)px; set with stroke
lineCap · lineJoinround · roundbutt · round · square / miter · round · bevel
dash-[on, off, …] px, e.g. [24, 12]
trimStart · trimEnd0 · 100the part of the outline drawn, % - key trimEnd 0→100 to draw a path on
trimOffset0% of the outline the drawn part is shifted round by (key it to make a dash run round a loop)
items-group only: its items. A group moves, turns, scales, fades and trims them together (groups nest 4 deep)
name · on-a label (agents address items by it); on:false hides it
keys-[{t, ease?, …}], t in seconds from the clip's start. Keyable: x y rotation scale opacity w h radius inner strokeWidth trimStart trimEnd trimOffset fill stroke points. Each value eases between the keys that set it (ease on the arriving key); colours blend; points keys morph the path and need its point count

At most 64 items per layer (group children included). The layer itself is a normal visual clip: its x, y, scale, rotation, opacity, blend, masks, transitions and keyframes all work, as do blur and shake. Its own trimStart / trimEnd / trimOffset (clip props, keyframable) trim every path in it at once. A trimmed shape fills the part that is drawn.

Null objects. kind:"null" (no mediaId) is a clip that never renders. Give it x, y, rotation, scale (and keyframes), and parent clips to it to move them as one. The monitor shows it as a red square while it is on screen.

Parenting. "parent": "<clip id>" (top-level, next to track) makes a clip move, turn and scale with that clip. Its own x/y are then measured in the parent's space: from the parent's centre, turned and scaled with it. Parents chain (a parent can have a parent), and loops are refused. Only the transform follows: the parent's opacity, transitions, shake and effects do not, and the parent's keyframes are read even outside its time range (held at its first or last value). Splitting a parent leaves the children on the left half.

Anchor point. anchorX / anchorY (px from the picture's centre, for any visual clip) pick the point that x/y place and that rotation and scale turn around: anchorY: 200 on a 400 px tall shape spins it about its bottom edge. Moving the anchor without moving the picture means changing x/y with it (the editor's anchor tool does that).

In the editor: the bin's Shapes tab adds a rectangle, ellipse, polygon, star, line or pen-path layer, or a null object, at the playhead. The Shape layer section lists the items; pick one to edit it - the sliders, Fill / Stroke (colour or None), ends and joins, trim, Group / Ungroup / Out, ↑ ↓, Copy, Delete - and on the monitor drag it to move, the knob to turn it (Shift: 15°) and the corners to resize it. On a line or path, drag points and their handles (Alt breaks the pair, Alt-drag pulls new handles); on a path, Ctrl-click the outline to add a point and double-click one to remove it. Pen draws a new path: click points (drag to curve), click the first point to close it or press Enter to keep it open. Each value has its own ◆: key it at the playhead, and from then on changing it keys it. Every visual clip's Transform section has Anchor (✥ Move: drag on the monitor to move the anchor point while the picture stays put, Shift snaps to the centre; Centre puts it back) and Parent. Right-click clips → Parent to a new null groups them under a fresh null at their centre.

Agents:

  • Add a layer with addClip {kind:"shape", track, start, duration, props:{shapes:[…]}}, a null with addClip {kind:"null", track, start, duration, props:{x, y}}.
  • {op:"setShape", id, set:{type:"rect", w:400, h:80, fill:"#ffd166"}} adds an item (no shape, an index one past the end or a new name adds one; a new item needs type). {op:"setShape", id, shape:"Bar", set:{fill:"#22d3ee"}} edits one - by index (0 = first), name, or a path into groups like "2.0" (item 0 of group 2; "2.3" with 3 items adds one there) - merging key by key (null resets a key; a new type keeps the position and paint). replace:true starts it over. keys in set replaces its keys. {op:"removeShape", id, shape} deletes one. ids:[…] edits several clips.
  • {op:"setParent", id | ids, parent:"c_null"} parents clips and keeps them where they are on screen (at time at, default each clip's start; keyed channels are left as they are). keep:false keeps the numbers instead. parent:null unparents. Removing a parent clip unparents its children where they stand.
  • props.shapes and parent written through addClip / updateClip are validated the same way; bad input refuses the whole patch. The compact view lists a layer as [3 shapes: rect #ffd166 2 keys, line stroke #ffffff/6, group(star(5) #ff7ac8)] and a child as parent:c_null.

Recipes: draw-on logo - the logo as path items with a stroke and no fill, trimEnd keyed 0→100 (stagger the items' keys), then fill keyed from "#ffffff00" to "#ffffff"; lower third - a rect bar whose w keys from 0, a line drawn on under it, a title on the track above parented to the shape layer so they slide out together; loading ring - an ellipse with a stroke, trimEnd: 25, trimOffset keyed 0→100 with ease:"linear"; orbit - a null at the centre with rotation keyed 0→360, a shape parented to it with x: 300; swing from the top - anchorY at the top edge (minus half the height) and rotation keyed −10↔10; burst - a group of lines at different rotations with scale keyed 0→1 and opacity 1→0.

diff --git a/docs/docs/music/index.html b/docs/docs/music/index.html index bdf4a70a6..8728de56f 100644 --- a/docs/docs/music/index.html +++ b/docs/docs/music/index.html @@ -83,9 +83,9 @@

Music

The bin's Music tab and fablecut_music find music and sound effects that may be used in a video: openly licensed tracks from Openverse (openverse.org), which indexes Jamendo, Freesound, ccMixter, Wikimedia Commons and more. Results show every licence, not only the free ones, and each result says what its licence allows. FableCut is made with Openverse but isn't endorsed or certified by it. The licence is the artist's, and Openverse doesn't check it, so the person publishing the video is the one who must respect it.

licencelabelmay it go in a video?
cc0 · pdmfree to useyes, any use; no credit needed
bycredityes, any use; credit the artist
by-sacredit · share alikeyes; credit, and the video is shared under CC BY-SA too
by-nc · by-nc-sacredit · non-commercialnot in ads, sponsored or monetized videos; credit (NC-SA: share alike too)
by-nd · by-nc-ndno editsno: Creative Commons counts music set to video as a derivative
sampling+ · nc-sampling+credit · non-commercialparts may be sampled and remixed; the whole track only non-commercially

Search with words about the music (mood, genre, instrument: "chill lo-fi piano"); leave the words out to see the newest tracks. Music comes from the music category, sound effects from Freesound. Lengths are Openverse's: under 30 s, 30 s – 2 min, 2 – 10 min, over 10 min. Without an account Openverse answers 20 results a page, 240 per search and about 20 searches a minute and 200 a day per address. The search runs from the editor tab (or the MCP server) straight to Openverse, and the file goes through the editor server's URL import into media/.

An imported track keeps its licence on its media entry, so the credits can be listed later:

{ "id": "m_x", "name": "Cinematic — Jahzzar", "kind": "audio", "src": "/media/Cinematic%20-%20Jahzzar.mp3",
   "license": { "code": "by-sa", "label": "CC BY-SA 3.0", "url": "https://creativecommons.org/licenses/by-sa/3.0/",
     "title": "Cinematic", "creator": "Jahzzar", "page": "https://www.jamendo.com/track/918921",
-    "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } }

The credits are every licensed file the edit uses (main timeline, comps and other sequences; a denoised copy counts as its original), one line each: "Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921, with a warning for a licence that limits the video (non-commercial, share alike, no derivatives). They go in the video's description.

In the editor: the bin's Music tab has the search box, Music / Sound effects, a length, OK to monetize (only licences that allow commercial use and edits), and mood chips to start from. Each result shows its artist, length, genres, source, a licence badge (green: free to use, blue: credit, amber: non-commercial, red: no edits; hover for what it allows, click for the licence) and a link to its page. ▶ previews it, ⬇ imports it into the Project bin, + (or a double-click) imports it and adds it at the playhead. More results loads the next page. A file's Media info shows its licence and credit with Copy credit, and the Export dialog lists the edit's music credits with Copy. Importing needs the editor server (or Studio).

Agents use fablecut_music:

  • {query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?} searches: 20 tracks a page, each id "title" — artist · m:ss · licence [flags] · genres · source. commercial:true keeps licences that allow commercial use, edits:true leaves out ND; pass both when the video will be monetized.
  • {import:"<track id>"} downloads it into media/ (named "Title - Artist") and registers it with its license; the reply gives the licence, the credit and an addClip to place it. Then fablecut_beats {clipId} finds its tempo, retime cuts to it, and fablecut_auto_duck dips it under speech.
  • {credits:true} lists the edit's credits and licence warnings. fablecut_export adds them to its reply when the edit uses licensed music.
  • Say which licence a track has before the user publishes, and search with commercial:true, edits:true when they plan to monetize. Import what the user picked, or the best fit when they asked you to choose. The compact view shows an imported file's licence:"CC BY 3.0".

Recipes: music under a reel - search the mood with length:"short", import one, place it on A1, fablecut_beats {clipId, retime:{every:2}}; a whoosh on every cut - kind:"sfx", query:"whoosh", import a CC0 one, place it just before each cut; music for a sponsored video - commercial:true, edits:true, and give the user the credits from the reply.

+ "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } }

The credits are every licensed file the edit uses (main timeline, comps and other sequences; a denoised copy counts as its original), one line each: "Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921, with a warning for a licence that limits the video (non-commercial, share alike, no derivatives). They go in the video's description.

In the editor: the bin's Music tab has the search box, a length, OK to monetize (only licences that allow commercial use and edits), and mood chips to start from. The SFX tab has the same search for sound effects (with chips such as whoosh, impact, riser) above the files in library/sfx/. Each result shows its artist, length, genres, source, a licence badge (green: free to use, blue: credit, amber: non-commercial, red: no edits; hover for what it allows, click for the licence) and a link to its page. ▶ previews it, ⬇ imports it into the Project bin, + (or a double-click) imports it and adds it at the playhead. More results loads the next page. A file's Media info shows its licence and credit with Copy credit, and the Export dialog lists the edit's music credits with Copy. Importing needs the editor server (or Studio).

Agents use fablecut_music:

  • {query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?} searches: 20 tracks a page, each id "title" — artist · m:ss · licence [flags] · genres · source. commercial:true keeps licences that allow commercial use, edits:true leaves out ND; pass both when the video will be monetized.
  • {import:"<track id>"} downloads it into media/ (named "Title - Artist") and registers it with its license; the reply gives the licence, the credit and an addClip to place it. Then fablecut_beats {clipId} finds its tempo, retime cuts to it, and fablecut_auto_duck dips it under speech.
  • {credits:true} lists the edit's credits and licence warnings. fablecut_export adds them to its reply when the edit uses licensed music.
  • Say which licence a track has before the user publishes, and search with commercial:true, edits:true when they plan to monetize. Import what the user picked, or the best fit when they asked you to choose. The compact view shows an imported file's licence:"CC BY 3.0".

Recipes: music under a reel - search the mood with length:"short", import one, place it on A1, fablecut_beats {clipId, retime:{every:2}}; a whoosh on every cut - kind:"sfx", query:"whoosh", import a CC0 one, place it just before each cut; music for a sponsored video - commercial:true, edits:true, and give the user the credits from the reply.

diff --git a/docs/docs/presets-templates/index.html b/docs/docs/presets-templates/index.html index 2141e5953..701cf3882 100644 --- a/docs/docs/presets-templates/index.html +++ b/docs/docs/presets-templates/index.html @@ -88,7 +88,7 @@

Animation presets and templates

{ "key": "name", "label": "Name", "type": "text", "targets": [ "name:props.text" ], "value": "Ava Moreno" }, { "key": "accent", "label": "Accent", "type": "color", "targets": [ "bar:props.shapes.1.fill" ], "value": "#ffd166" } ] } }
templatenamesizelengthfields
lower-third-barLower third - Bar1920×10805 sname title accent panel
lower-third-underlineLower third - Underline1920×10805 sname title accent
lower-third-boxesLower third - Boxes1920×10805 sname title accent box
logo-ringLogo - Ring reveal1920×10804 slogo brand accent
logo-slamLogo - Slam1920×10803.5 slogo accent
logo-linesLogo - Lines1920×10804 slogo tagline lines
social-storyStory - Headline (9:16)1080×19206 sheadline subline button accent background
social-quotePost - Quote (1:1)1080×10806 squote author accent background
social-end-cardEnd card - Follow (16:9)1920×10806 sheading button accent background

Field types: text (a string), color (#rgb, #rrggbb or #rrggbbaa) and media (a media id of a picture: image, svg or video; the clip's kind follows it). A target is "<clip id>:<path>" inside the comp (props.text, props.shapes.1.fill, mediaId, …) or "comp:background"; one field can set several. The logo templates start with a placeholder, /library/elements/logo-placeholder.svg, until the logo field gets a picture. hold is when the exit starts: changing a template's length keeps everything after it at the same distance from the end, so a longer lower third just holds longer (it can't get shorter than its entrance needs).

A saved template (library/templates/<id>.json) is a template object: {id, name, group, width, height, duration, hold, background?, tracks?, clips, media?, fields}; media lists the {id, name, kind, src} entries its clips use (/library/… or /media/…), matched by src when it is placed. A saved preset or template whose name a built-in already has is saved as "<name> (saved)".

In the editor: the bin's Templates tab lists them by group (Lower thirds, Logo animations, Social, then Saved); drag one onto the timeline or click +. The Inspector's Template section on its clip edits the fields, its Length, and offers Use W×H canvas when the template was made for another shape. Right-click a comp in the Project tab → Save as template keeps it (every title's text and every picture become fields). The Motion section's Presets menus (In, Out, At playhead, Loop) put a preset on the selected clips, and Save as preset keeps this clip's keyframes (In: from its start to its last key; Out: from its first key to its end; Loop: the whole clip).

Agents:

  • {op:"applyPreset", id | ids, preset, length?, at?} - preset is a name, a saved one's id, or an inline preset object; at is timeline seconds (for an At preset; default the clip's start). Visual clips only.
  • {op:"addTemplate", template, start?, track?, duration?, fields?:{key: value}, id?, compId?, name?} places one (default track V2, at 0, its own length).
  • {op:"setTemplate", id, fields?:{key: value}, duration?} - id is its comp clip or its comp; a new duration retimes it, and clips that showed it to its end keep doing so.
  • {op:"savePreset", id, name, anchor?, from?, to?} (from/to in clip seconds) or {op:"savePreset", preset:{…}}; {op:"saveTemplate", comp, name?, fields?, hold?} or {op:"saveTemplate", template:{…}}. Files are written once the patch is saved, and later ops in the same patch can use them.
  • applyPreset, addTemplate and setTemplate also run inside inComp.
  • The compact view prints a placed template's fields under its comp: template lower-third-bar — fields (setTemplate): name="Ava Moreno" ….

Recipes: name every speaker - addTemplate lower-third-bar once per speaker with fields:{name, title}; branded intro - addTemplate logo-ring with fields:{logo:"<your logo's media id>", brand, accent} at 0; vertical teaser - set the canvas to 1080×1920, addTemplate social-story; house style - build a comp the way you like it, saveTemplate, then place it in every project; titles that arrive and leave the same way - applyPreset an In and an Out on every title in one patch.

diff --git a/docs/docs/project-json/index.html b/docs/docs/project-json/index.html index 67ae12342..819e10c51 100644 --- a/docs/docs/project-json/index.html +++ b/docs/docs/project-json/index.html @@ -178,7 +178,7 @@

project.json

] }
diff --git a/docs/docs/projects/index.html b/docs/docs/projects/index.html index 8fa2701fc..557bd4507 100644 --- a/docs/docs/projects/index.html +++ b/docs/docs/projects/index.html @@ -82,7 +82,7 @@

Projects

Keep many projects in one FableCut: a dashboard to open, create from a canvas or template, duplicate, rename, take notes on, tag, archive and delete them, and fablecut_projects for agents.

One FableCut keeps any number of projects. ./project.json is always the open project: the editor, every MCP tool, the REST API and scripts read and edit that file as before. The others wait in projects/, and opening one swaps it in:

pathholds
projects/index.json{active} - the open project's id
projects/<id>/meta.json{id, created, opened, archived, notes, tags, template?}
projects/<id>/project.jsonthe document (while that project is open, ./project.json is the live copy)
projects/<id>/thumb.jpgthe editor's last picture of it
library/project-templates/<id>.jsona saved project template {name, created, project}

media/, exports/, analysis/ and library/ are shared by every project, so a duplicate or a project made from a template copies no footage. The first time projects are used, the existing ./project.json becomes the first project, unchanged. Ids look like p_3f9a01c2de.

Opening a project saves the open one into its folder, then copies the chosen one to ./project.json with a revision above both. A save based on the project that was open before (an editor tab, an agent's fablecut_set_project, a baseRevision patch) is therefore refused as a CONFLICT instead of landing in the wrong project. Editor tabs reload, clear their undo history and close an open composition. GET /api/project names the open project in the X-FableCut-Project header, and the editor sends it back on every save, so an edit made for one project can never be written into another.

In the editor: Projects in the top bar (Ctrl/Cmd+O, or a click on the project name) opens the dashboard: cards with a picture, size, frame rate and length; search by name, notes or #tag; sort by last opened, last modified, created or name. Pick one to rename it, write notes, tag it, Open (or double-click / Enter on its card), Duplicate, Save as template or Archive it. Archived lists archived projects, where Unarchive brings one back and Delete… (click twice) removes it; only archived projects can be deleted, and the open one can be neither archived nor deleted. + New project starts one from a canvas (Landscape 16:9 1080p, Vertical 9:16, Square 1:1, Portrait 4:5, 4K UHD, Landscape 720p) or a saved template, with its own frame rate. Import… adds a project file from elsewhere (an old backup, another machine); its media must be in media/, and Relink finds files that moved.

Agents use fablecut_projects (or GET /api/projects, POST /api/projects):

  • {} or {action:"list", archived?:"only"|"all"} lists them: id, name, size, length, clips, tags, notes, and which is (OPEN).
  • {action:"open", id} switches the editor to that project; re-read it with fablecut_get_project {compact:true} before editing.
  • {action:"new", name, template?, fps?, width?, height?, notes?, tags?, open?} - template is landscape-1080 (default), vertical-1080, square-1080, portrait-1350, uhd-4k, landscape-720 or a saved template's id; it opens unless open:false.
  • {action:"duplicate", id, name?, open?} · {action:"update", id, name?, notes?, tags?} · {action:"archive" | "unarchive" | "delete", id}.
  • fablecut_status also counts the open project's versions; see Versions for them.
  • {action:"templates"} · {action:"save_template", id, name} (the project's canvas, tracks, clips and media references) · {action:"delete_template", template}.
  • Opening, archiving or deleting changes what the user sees: do it only when they asked. fablecut_status says how many projects there are.

Recipes: one edit, three versions - duplicate the project per client cut, put the brief in notes; house canvas - build an empty project with your tracks, intro and outro, save_template, then new from it for every episode; park finished work - archive delivered projects to keep the list short without deleting anything.

diff --git a/docs/docs/props/index.html b/docs/docs/props/index.html index 17b074d77..dd44b9454 100644 --- a/docs/docs/props/index.html +++ b/docs/docs/props/index.html @@ -82,7 +82,7 @@

Clip props

Every property a clip can carry and its default. A key a clip leaves out falls back to these.

Transform & compositing all visual kinds#

propdefaultnotes
x, y0px offset from canvas center
scale1
rotation0degrees
opacity10–1
anchorX, anchorY0anchor point, px from the picture's centre: the point x/y place and rotation/scale turn around
autoOrientfalseturn the clip with its direction of travel along its motion path (rotation adds on top)
motionBlur · motionBlurSamples0 · 8motion blur: shutter angle in degrees (0 = off, 180 = film look, up to 720) · sub-frame samples 2–32
blend"normal"how the clip lays over what is under it (see Track mattes and blending)
matte · matteTrack-a track matte (see Track mattes and blending)

Layout video/image/svg#

propdefaultnotes
fit"contain"contain · cover (fill canvas, crop overflow) · stretch · none (native px)
cropL cropR cropT cropB0% of the source trimmed off each edge
cornerRadius0px, rounded corners - the PiP look
reframe-set by Reframe ("follow" or "centre"): the clip's fit and position are Reframe's own, so running it again replaces them (see Sequences)
flipH, flipVfalsemirror

Filter / color video/image/svg#

propdefaultnotes
filterPreset"none"one of: cinematic · teal-orange · noir · vintage · faded · warm · cold · pop · dreamy · retro · bw-soft · cyberpunk · sunset · midnight. Combines non-destructively with the sliders below.
brightness contrast saturation100% (100 = neutral)
hue0degrees
temperature0−100 (cool blue) … +100 (warm orange)
tint0−100 (magenta) … +100 (green)
blur0px
grayscale sepia invert vignette0%

These are quick looks. For real grading use props.grade (see Color below).

Motion FX video/image/svg/adjust - all animatable#

propdefaultnotes
shake0camera-shake amplitude in px (deterministic - identical in export)
shakeSpeed8shake frequency
rgbSplit0chromatic aberration / RGB channel split, px
grain0animated film grain, %

Keying / cut-out video/image#

propdefaultnotes
chromaKey""hex key color, e.g. "#00ff00" for green screen ("" = off)
chromaTolerance260–100, how much color distance is keyed out
chromaSoftness120–100, edge feather + spill suppression
bgRemovefalseAI person cut-out (MediaPipe, loads from CDN on first use; needs internet once)

Audio / time video/audio#

propdefaultnotes
volume10–2 (linear; animatable - fades, ducking)
gain0clip gain in dB (−60…+24), applied before volume, so keyframes and fades ride on top. Set by Normalize.
channelMode"stereo"stereo · mono (L+R folded to one channel) · left · right (use one side) · swap (exchange L/R). Ignored on linked stems - audioChannel already picks their channel.
duck0ducking in dB (≤ 0), multiplied into volume. Normally keyframed by Auto-duck (keyframes.duck), so the clip's own volume, keyframes and fades are untouched.
pan0−1 (full left) … 0 (center) … +1 (full right). Linked stems default L −1 / R +1 / other 0. Projects saved before pan migrate once on load (panSchema); keep panSchema: 1 (and explicit pan on stems) when rewriting the document so a centered stem is not re-hard-panned.
speed10.25–4× playback rate. Keyframable → speed ramps: with keyframes.speed the engine time-remaps (media time = in + ∫speed dt), in preview and in the export audio mix. Static case: source window consumed = duration × speed, so in + duration×speed ≤ media.duration.

Text clips only#

propdefaultnotes
text"Title"\n for multi-line
fontSize72px
color"#ffffff"fill
color2""if set: vertical gradient fill color→color2
font"Segoe UI"system font, a library/fonts family, or ANY Google Font name - unknown names are fetched from Google Fonts automatically
bold / weighttrue / 0weight (300–900) overrides bold when non-zero
italic uppercasefalse
align"center"left · center · right · justify (inserts spaces between words to fill the text box width, or ~85% of the canvas when no box)
boxW boxH0px text box; 0 = hug content. When both > 0, corner handles resize the box (not scale). Default: fixed fontSize, word-wrap inside the box.
boxFitfalsewhen a box is set: false = wrap at fixed font size; true = scale font down (up to fontSize) so the whole text fits
vAlign"middle"top · middle · bottom - vertical alignment of the text block inside the box
direction"auto"auto · ltr · rtl - auto detects per line (Hebrew/Arabic → RTL); all textAnim modes honor reading direction (wipe, typewriter reveal, word/letter layout)
letterSpacing0px
lineHeight1.2multiplier
textShadow12soft drop shadow amount, 0 = off
glow0neon glow strength (0–100); replaces the drop shadow
glowColor""glow color ("" = use the text color)
strokeWidth strokeColor0, "#000"text outline
bgColor bgOpacity"#000", 0rounded pill behind each line
textAnim"none"typewriter · word-pop · word-slide · karaoke · highlight (every word shown; the one being said in highlightColor) · letter-pop (per-character entrance; Arabic/Indic auto-fallback to per-word clusters so joined letters shape correctly) · wave (looping per-character ride; same shaping fallback) · bounce (looping per-word hop) · shake (looping jitter) · clip-reveal (wipe-mask sweep, per line) · zoom-in (scale + opacity settle) · font-cut (rhythmically swaps typeface, then settles - see fontCutSet) · rise-mask (line rises from behind its baseline, lower-third reveal)
wordRate0.15seconds per word (typewriter: /4, letter-pop: /3 per character); also staggers clip-reveal/zoom-in/rise-mask per line
wordTimes-[[start, end], …], one pair per word (seconds from the clip's start): word-pop, word-slide, karaoke and highlight follow these instead of wordRate - a caption timed to speech. If the text is edited to another number of words they are spread over the clip. See Captions
highlightColor"#ffd166"the colour of the word being said in highlight
caption · captionStyle-set on caption clips (see Captions): how they are found, replaced and exported
textPath-set the title along a path: one shape item (path, line, ellipse, rect, polygon, star) whose outline is the baseline; more lines follow on parallel curves below it. See Motion paths, motion blur and text on a path
pathOffset · pathAlign0 · "start"where along the path the text sits (% of its length, keyframable, wraps on closed paths) · which end of the text sits there: start · center · end
fontCutSet(curated)array of font family names cycled by font-cut, e.g. ["Anton","Bebas Neue","Archivo Black","Oswald"]; each is auto-loaded

Title styles one-tap cohesive looks#

Text clips created in the UI now rotate through curated styles so titles vary instead of all looking basic (the old flat Segoe UI / no-animation default). Each style bundles a different font, placement and animation. Apply one in the inspector (Title style dropdown + Shuffle), or reproduce it from an agent by writing the same props:

StyleFontLook
impactAntonuppercase, lower third, word-pop, big shadow
elegantPlayfair Displaywhite→gold gradient, centered, clip-reveal
kineticBebas Neuegold, font-cut cycling Anton/Bebas/Archivo/Oswald
neonBebas Neuecyan glow, wave
handwrittenCaveatrotated −4°, lower-left, word-slide
serifDropAbril Fatfacecentered, zoom-in
subtitleRobotosmall, bottom, bg pill, karaoke
boldRiseArchivo Blackuppercase, lower third, rise-mask
luxuryCinzeluppercase, cream→gold gradient, wide letterSpacing, clip-reveal
popOutlineMontserrat 900uppercase, gold with a dark outline, letter-pop
boxedInter 800dark text on a white box, lower third, word-slide
headlineMontserrat 900uppercase, outlined, the word being said in pink (highlight)
comicBangersyellow with a thick outline, tilted −3°, bounce
typewriterSpecial Elitecream, lower-left, typewriter
minimalInter 300uppercase, very wide letterSpacing, no shadow, rise-mask
scriptGreat Vibeswhite→blush gradient, clip-reveal
retroMonotonuppercase, pink glow, letter-pop
stickerFredoka 700white on a violet box, tilted −2°, lower third, word-pop
glitchRusso Oneuppercase, red glow, shake
cinematicCormorant Garamond 500uppercase, wide letterSpacing, rise-mask

Rule for agents: vary the font per title - never reuse one font across a whole edit. Any Google Font name auto-loads; some display faces ship in library/fonts/. The font picker lists about sixty Google fonts by look (Display, Sans, Serif, Script & hand, Retro & mono) and loads one on first use. Placement props (x/y) are canvas-aware in the styles (lower third ≈ y: height*0.30).

Switching the style on an existing title (inspector dropdown/Shuffle) only restyles the look (font, size, colors, shadow/glow, animation) - the clip's x/y/scale/rotation/align and its text are preserved. The style's canvas-aware placement is applied only when a title is first created.

Adjustment layers kind:"adjust", mediaId:null#

A clip that re-renders everything drawn below it (lower tracks + earlier clips) through its own filter stack - Premiere-style. Supports all Filter/Color props, vignette, grain, rgbSplit, temperature/tint, whole-frame shake, and opacity as the intensity. Keyframe/transition it like any clip. Put it on V2/V3 above the footage. Example: 0.3 s impact shake over everything = {kind:"adjust", track:"V3", duration:0.3, props:{shake:18}}.

Masks masks, video/image/svg/text/adjust#

Shapes that cut what the clip shows - rect, ellipse, bezier, free-hand; feather, expand, invert, add / subtract / intersect, keyframes. See Masks below.

Shape layers kind:"shape"#

props.shapes (rectangles, ellipses, polygons, stars, lines, bezier paths, groups) and trimStart / trimEnd / trimOffset (%, a draw-on of every path). Null objects (kind:"null") never render; other clips are parented to them. See Shapes, nulls and parenting.

Comp clips kind:"comp", compId#

A composition placed as one clip - it draws like a picture of the comp's size (fit defaults to none) and its media plays and exports. See "Compositions (nested sequences)".

Animatable props usable in keyframes#

X, y, scale, rotation, opacity, anchorX, anchorY, trimStart, trimEnd, trimOffset, pathOffset, volume, pan, duck, speed, brightness, contrast, saturation, hue, blur, grayscale, sepia, invert, temperature, tint, vignette, cornerRadius, shake, rgbSplit, grain, fontSize, letterSpacing, glow.

Transition types#

Fade · slide-left/right/up/down · zoom · wipe (=wipe-left) · wipe-right/up/down · iris (circular) · spin · blur · whip (whip-pan) · glitch (RGB split + jitter) · pop (overshoot scale - stickers/captions).

diff --git a/docs/docs/recipes/index.html b/docs/docs/recipes/index.html index 806c25f35..247c2c39f 100644 --- a/docs/docs/recipes/index.html +++ b/docs/docs/recipes/index.html @@ -82,7 +82,7 @@

Recipes

Short answers for common edits: grades, captions, speed ramps, transitions and more, each one a few props away.

Assemble a rough cut#

Clips back-to-back on V1; each start = running sum of previous durations.

Insert / replace at playhead 3-point editing#

Load media into the Source monitor (double-click a bin item or timeline clip), mark the window with I/O, then , (insert icon) splits straddling clips on targeted tracks at the playhead, ripples everything later to the right by the window length, and drops the Source window in - video brings its linked audio stems. . (replace icon) overwrites instead: punches the placement tracks (V1 + linked stems) over [playhead, +window) with no ripple. Placement lanes are resolved against the live track list and follow targeting - if V1 / A1 / A2 were removed or untargeted, the lowest remaining targeted lanes of the right kind are used instead. Locked clips are never punched or split. A locked clip loaded into Source can't be retargeted with . (toast) until it is unlocked. When Source was loaded from a timeline clip, . instead retargets that clip's In/Out (and its linked stems) and ripples later clips on its tracks if the duration changed.

Ripple delete#

Select clip(s), then ⇧Del or the timeline-toolbar Ripple delete - removes the selection (linked partners included) and pulls later clips left on each targeted track to close the gap. Plain Del lifts (leaves a gap). Sync lock applies: linked partners on untargeted tracks move with the ripple, and locked clips are neither deleted nor moved. An unselected clip that merely overlaps the deleted range stays put - its overlap ends up bridging the shifted-in clip, so a crossfade across the cut survives.

Tighten a cut without breaking the rest#

Ripple edit (B) on the tail of the shot that runs long - the rest of the edit follows. To change where a cut falls between two shots without shifting anything else, Rolling edit (R) the cut. To keep a shot's timing but use a better take of the same moment, Slip (Y) it. To pull a whole segment out of the middle: set IN / OUT around it and Extract (').

Jump to cut#

Select a clip, then ↑ / ↓ - playhead snaps to its In, then Out (further taps walk neighboring cuts). No selection → previous / next cut on targeted tracks. Source monitor: same keys jump among 0 / In / Out / duration.

Protect finished work#

Lock the lanes you are done with (lockedTracks, or the padlock), e.g. setProject {lockedTracks:["A3"]} for a music bed. Now insert, ripple delete and close gap re-time the picture without touching it. To try an alternative without deleting a clip, disable it (⇧E / disabled:true).

Title card#

{kind:"text", mediaId:null, track:"V2", props:{text,fontSize,color}}.

Music bed#

Audio file on A1, props.volume: 0.3, trim with in/duration.

Level a voice-over edit#

fablecut_normalize_audio {clipIds:[…every VO clip…], target:-16} so all takes sit at one loudness, then keep the music on its own lane and pull that lane down: {op:"setTrack", id:"A3", set:{gain:-14}}. Then dip it under the voice: fablecut_auto_duck {clipIds:[<music clip>], under:["A1"], amount:-10}.

Cut a montage to the music#

Put the shots on V1 in the order you want (rough lengths are fine) and the music on an audio lane, then fablecut_beats {clipId:<the music>, retime:{every:2}} - each shot gets two beats where its footage allows (fewer when it runs out; clips past the music keep their length; one with less than a beat of footage refuses the re-cut), the cuts land on the beat. every:1 for a fast reel, 4 for a calm one; re-cut the part after the drop separately with retime:{from:<the drop>, every:1}. For an edit whose cuts are already chosen, snap:true just nudges each one onto the nearest beat (cuts on untargeted tracks, beside locked clips, or without spare footage to reach it stay where they are; the reply counts them). Check a cut with fablecut_frame before exporting.

Tighten a talking-head take#

Lock the music lane (setProject {lockedTracks:["A3"]}), then fablecut_silence {clipIds:[<the take>]} to see the pauses (it does the listening; fablecut_frame only shows the picture, handy to check a cut won't land mid-gesture), and fablecut_silence {clipIds:[<the take>], cut:true}. Add {op:"crossfade", ids:[…]} on the new audio cuts if a breath clicks.

Cut an interview down by text#

Lock the music lane, fablecut_transcribe {clipIds:[<the interview>]} to read what was said (name the speech clips, or the music bed is transcribed too), decide what stays, then fablecut_transcribe {clipIds:[<the interview>], find:["the sentence to drop", "and this one"], cut:true}. Then fablecut_silence {clipIds:[…], cut:true} for the pauses that are left.

Caption a talking-head reel#

Finish the cut first, then fablecut_captions {style:"highlight", clipIds:[<the talking-head clips>]} (name the speech clips, or a music bed with vocals gets captioned too), fablecut_frame {time:<mid-sentence>} to check the size and placement, and fablecut_captions {export:"srt"} for the platform's own subtitle upload.

Center a mono stem#

Linked or standalone audio clip with props.pan: 0 (inspector Pan slider, −1…+1). Stereo video stems default to L −1 / R +1; set A1 to 0 to center that channel in the mix.

Cinematic grade#

props.filterPreset: "teal-orange" (tweak with temperature/vignette on top).

Balanced, contrasty base grade then measure with fablecut_scopes#

{op:"setGrade", id, grade:{contrast:1.15, pivot:0.42, shadows:-10, highlights:-20, highSoft:30, saturation:108}}. Teal shadows / warm highlights: add lift:[-0.034, 0.008, 0.012, 0] and gain:[0.04, 0, -0.06, 0]. Film-style S-curve, muted greens, yellows pushed toward orange: grade:{curves:{y:[[0.25, 0.2], [0.75, 0.82]]}, hueSat:[[115, 0.7]], hueHue:[[60, -12]]} - then fablecut_scopes to check the blacks didn't crush. A grade on an adjustment layer over the whole edit = one look for every shot.

Green-screen composite#

Subject clip on V2 with props: {chromaKey:"#00ff00", chromaTolerance:30, chromaSoftness:15}, background footage on V1.

Remove background without a green screen people#

props: {bgRemove:true} - then put anything behind it on V1.

Picture-in-picture#

Clip on V3 with props: {scale:0.35, x:380, y:-200, cornerRadius:24} - add transitionIn: {type:"slide-right", duration:0.5} to fly it in.

Slow motion / timelapse#

props.speed: 0.5 (half speed) or 4 (4×). Remember the source window is duration × speed.

Speed ramp the reel move - fast into slow on the beat#

keyframes: { speed: [ {t:0, v:3}, {t:1.1, v:3}, {t:1.3, v:0.4, "ease":"ease-out"} ] } - sync the drop (t:1.3) to a marker; add transitionIn:{type:"whip",duration:0.2} before it.

Impact hit#

Adjustment layer, 0.25–0.4 s at the hit: {kind:"adjust", track:"V3", props:{shake:20, rgbSplit:8}} + impact-hit.mp3 from library/sfx on A2.

VHS / glitch look#

props: {rgbSplit:4, grain:35, saturation:120} + library/elements/vhs-scanlines.svg on V3 with blend:"soft-light", fit:"stretch". Cut between shots with transitionIn:{type:"glitch",duration:0.3}.

Film look#

Adjustment layer across the whole edit: props: {filterPreset:"cinematic", grain:18} - one clip grades every shot.

Neon caption#

props: {glow:60, glowColor:"#22d3ee", color:"#ffffff", font:"Bebas Neue", textAnim:"wave"} on a dark shot.

Light leak accent#

library/elements/light-leak-warm.svg on V3, props:{blend:"screen", fit:"cover", opacity:0.7}, 1–2 s at scene changes, transitionIn/Out: fade.

Light-leak / dust overlay#

Element from library/elements on V3 with props: {blend:"screen", opacity:0.6, fit:"cover"}.

Reel caption#

Text clip with props: {textAnim:"word-pop", wordRate:0.15, strokeWidth:6, bgColor:"#000000", bgOpacity:0.45, fontSize:88}. karaoke dims words until "spoken"; typewriter for terminal vibes.

RTL / Hebrew / Arabic caption#

Omit direction (defaults to "auto") or set direction:"rtl" explicitly; pick a font with the script's glyphs (Google Fonts work). Animations wipe and stagger in reading order automatically. letter-pop / wave animate whole words on Arabic/Indic lines (not isolated letters) so cursive joining stays correct.

Branded title#

props: {font:"Bebas Neue", weight:700, letterSpacing:6, uppercase:true, color:"#ffffff", color2:"#7b6cff", textShadow:20} - any Google Font name just works.

Kinetic font-cut title rhythmic typeface cuts on the beat, then settle#

props: {font:"Bebas Neue", fontSize:120, uppercase:true, color:"#ffd166", textAnim:"font-cut", fontCutSet:["Anton","Bebas Neue","Archivo Black","Oswald"]}.

Elegant clip-on title letters wipe in#

props: {font:"Playfair Display", fontSize:88, color:"#ffffff", color2:"#ffd166", letterSpacing:2, textAnim:"clip-reveal"} - centered, one clean sweep.

Lower-third reveal#

props: {font:"Archivo Black", fontSize:92, uppercase:true, textAnim:"rise-mask", y:<height*0.30>} - the line rises from behind its baseline. Pair with a serifDrop/zoom-in kicker above it.

Custom font#

Drop MyBrand.ttf into library/fonts/, then props.font: "MyBrand".

Animated sticker#

Author an SVG (convention above) into library/svg/, register {kind:"svg", src:"/library/svg/foo.svg"}, clip on V2/V3. Scale/move/ rotate with normal props & keyframes; the SVG's own CSS animation plays on top, frame-accurately.

Whoosh on a cut#

0.4 s sfx clip from library/sfx on A2 aligned to the cut.

Ken Burns slow push on a photo#

keyframes: { scale:[{t:0,v:1},{t:D,v:1.2,ease:"linear"}], x:[{t:0,v:0},{t:D,v:-40,ease:"linear"}] }.

Crossfade#

Overlap two clips on the same track by ~1 s; later clip gets transitionIn: {type:"fade", duration:1}. For audio give the earlier clip the matching transitionOut and both curve:"power" (or select a clip and press Shift+D in the editor).

Whip-pan cut#

A gets transitionOut:{type:"whip",duration:0.25}, B gets transitionIn:{type:"whip",duration:0.25}.

Beat-synced cut#

Write beat times into markers, then align clip starts to them (the UI also snaps drags to markers).

Label the structure#

Write named, coloured markers for sections the user can jump between (⇧M / Alt+⇧M, or the Markers list): setProject {markers:[{t:0,label:"intro",color:"blue"},{t:8.5,label:"drop",color:"red"},{t:24,label:"outro",color:"purple"}]}. setProject replaces the whole list - include the existing markers you want to keep.

Music fade-out#

Audio clip keyframes: { volume:[{t:D-3,v:0.8},{t:D,v:0}] } or simply transitionOut: {type:"fade", duration:3, curve:"exp"}.

Pulse / emphasis#

keyframes: { scale:[{t:0,v:1},{t:0.3,v:1.12},{t:0.6,v:1}] }.

Reframe horizontal → vertical#

Keep a wide composition canvas and crop for delivery - e.g. width:1920, height:1080 with exportFrame:{x:656,y:0,w:608,h:1080} (9:16 fitted to canvas height). Position footage with clip x/y/scale; the export frame can be dragged in the UI. Omit exportFrame to export the full canvas.

Vertical reel#

Set project width:1080, height:1920; use the UI's safe-area guides (▦) to keep captions out of platform UI zones.

Project frame rate#

Set fps in project.json (or the Program Monitor FPS dropdown - 24 / 25 / 30 / 50 / 60). Preview stepping, timecode frames, Fast / WebCodecs / Realtime export, and /api/export/begin all use this value; pass the same fps when starting an export via the API.

diff --git a/docs/docs/remake/index.html b/docs/docs/remake/index.html index d75048015..4103fd296 100644 --- a/docs/docs/remake/index.html +++ b/docs/docs/remake/index.html @@ -93,7 +93,7 @@

Remake a reference video

"music": { "name": "ref-music.m4a", "src": "/media/…", "mediaId": "m_x" } } // ^ extracted + registered by the MCP tool

threshold tunes cut sensitivity (default adapts 0.30→0.20→0.12): lower it if obvious cuts were missed, raise it if motion is being misread as cuts.

Rebuild recipe - the analysis is deterministic; the creative mapping is yours:

  1. setProject: copy the reference's width/height/fps; write beats (or the cuts) into markers so the user sees the grid.
  2. Music: the extracted track on A1, in:0, duration:<ref duration>.
  3. Structure: one clip per shots[] entry on V1 at the same start/duration (hard cuts by default - that's what shot detection saw). Pick source footage whose motion matches each shot's energy (calm ≤40, action ≥70), and choose each clip's in so something interesting happens inside the window. Then look: fablecut_frame {path, frames:12} to survey a candidate clip, {path, t} at the exact moment you want, before committing to an in.
  4. The drop: put the hero shot there; classic garnish = a speed ramp landing on it, an impact adjust layer (shake+rgbSplit), or a whip transition.
  5. Pacing garnish to taste: shots shorter than ~0.6 s read as beat-flashes; avgShotLen tells you the reference's overall pace. Captions/grade/SFX per the Recipes section - the blueprint gives structure, not style.
diff --git a/docs/docs/rest-api/index.html b/docs/docs/rest-api/index.html index 7169aa6fe..d9bdf4cce 100644 --- a/docs/docs/rest-api/index.html +++ b/docs/docs/rest-api/index.html @@ -82,7 +82,7 @@

REST API

The HTTP endpoints behind the editor, for scripts and tools that don't speak MCP.

  • GET /api/project - current project JSON
  • PUT /api/project - replace project JSON (body = full document). Conflict-safe: if the body's revision ≤ the revision currently on disk, the server rejects with 409 and returns {"error":"…","revision":<current>}. Append ?force=1 to overwrite unconditionally. A request with an X-FableCut-Project header (the editor sends the id of the project it loaded) is also refused with 409 when another project is open (see Projects). Writes are atomic (tmp file + rename), so a crashed write never corrupts the file.
  • GET /api/media - list files in ./media (name, src, size)
  • GET /api/media-info?src=/media/x.mp4 → {src, info} · POST /api/media-info {srcs:[…], stat?} → {info:{src: info}} (up to 2000; stat:true answers only {size, mtimeMs}, no ffprobe - how the editor checks for offline files) - a file's metadata from ffprobe: size, fps, codec, audioCodec, audioChannels, sampleRate, bitrate, duration, width, height and probe ("ffprobe", or "stat" when only the size could be read). info is null when the src names no file under /media/ or /library/. Cached per file version.
  • POST /api/proxy {srcs:[…], height?:540|720|1080} → {status:{src: status}} queues proxies (ffmpeg, one at a time); POST /api/proxy/status {srcs} → {status:{src: status | null}}; POST /api/proxy/delete {srcs} → {deleted:{src: n}}. A status is {state:"ready", src:"/proxies/…", width, height, size}, {state:"queued"|"running", progress, height}, {state:"failed", error} or {state:"none"} (null = no such source file). Progress and results are also pushed as SSE event proxy ({src, status}). GET /proxies/<name> serves a proxy file from analysis/proxies/. /api/proxy answers 503 without ffmpeg.
  • POST /api/relink/candidates {media:[{id, name, src?, size?, kind?}]} → {candidates:{id:[{src, name, size, score, why}]}} - where a missing file might be now: files under media/ and library/ (subfolders included) of the same kind, ranked by name (same name, same name with another extension, similar name) and size, best 5 each.
  • GET /api/projects[?archived=only|all] → {active, projects:[{id, name, active, archived, notes, tags, created, opened, modified, width, height, fps, duration, clips, media, thumb}], templates:[…]} · POST /api/projects {action, …} - the actions of fablecut_projects (plus import {project, name?}). The answer depends on the action: {id, project} for open / new / duplicate / update / archive / unarchive / import (plus from when the open project changed, already when it was open), {id, deleted} for delete, {templates} for templates, {template} for save_template (the saved one) and {template, deleted} for delete_template · GET / PUT /api/projects/thumb?id= - a project's JPEG thumbnail (1 MB max). SSE event projects ({action, id, active}) after each change. See Projects.
  • GET /api/versions[?project=] → {project, versions:[{v, name, note, kind, created, revision, clips, duration, final}]} (newest first; default the open project) · POST /api/versions {action, project?, version?, …} - save {name?, note?, final?} → {project, version} · diff {version, to?} → {same, lines, added, removed, changed, mediaAdded, mediaRemoved, settings} · restore {version} → {restored, saved} · update {version, name?, note?, final?} → {version} · delete {version} → {deleted}. GET /api/versions/file?project=&version= is that version's document; GET /api/projects/backup?id= a project with all its versions (import it with POST /api/projects {action:"import", project:<the backup>}). SSE event versions ({project, action}). See Versions.
  • POST /api/files {action, …} - the files in media/: list {dir?} → {dir, folders, files:[{name, src, size}]} · mkdir {dir} · move {from, to, force?} → {from, to, moved:[{from, to}], repointed:[{project, open, media}], warning?} (from / to are the item itself; moved lists each file in it, so it is empty for an empty folder or a no-op; 409 while a project can't be read, unless force:true) · trash {paths, force?} → {trashed:[{id, src}], offline} (409 while a project uses one or can't be read, unless force:true; a batch that stops part-way answers 400 with trashed and failed; stillThere lists uses whose file is still in place) · trash-list → {items} · restore {id}. See Media management.
  • GET /api/library?dir=sfx|elements|svg|fonts|presets|templates - list library assets
  • GET /api/presets · GET /api/templates - the saved presets / templates, validated (bad files skipped); POST /api/presets {preset} · POST /api/templates {template} - validate one and save it as library/presets/<id>.json / library/templates/<id>.json, returning {id, name, file}
  • GET /api/workflows[?id=] - the saved workflows, validated (bad files skipped), or one by id or name (404 if none) · POST /api/workflows {workflow} - validate and save it as library/workflows/<id>.json, returning it with created / updated · POST /api/workflows/delete {id} → {deleted}. See Workflows.
  • POST /api/upload?name=foo.mp4 - raw body saved into ./media, returns {src}. MP4/MOV/M4V uploads are auto-remuxed with +faststart (needs ffmpeg on PATH). Files copied straight into ./media by external tools skip this - remux big ones yourself (ffmpeg -i in.mp4 -c copy -movflags +faststart out.mp4) or playback stalls.
  • POST /api/import-url - body {url:"https://…", name?} downloads the file into ./media/ and returns {src,name} (same-origin /media/…, like upload). name is the file name to save as (its extension follows the download). HTTPS only; rejects localhost, private/link-local/CGNAT addresses, and redirects to those. Remote SVG is refused (/media/*.svg is served same-origin as image/svg+xml - a scripted SVG opened as a document would run on the editor origin). Does not write project.json - register the media afterwards (UI and fablecut_import_media do this). Do not put a raw https:// URL (or another origin, including localhost on a different port) in media.src: canvas CORS would taint the compositor and Fast / WebCodecs export cannot JPEG-encode. Import into ./media so src is /media/…, or serve the remote with Access-Control-Allow-Origin.
  • GET /api/transcript?src=/media/x.mp4 → {transcript} (null when the file has none yet; 404 when the file is missing) · POST /api/transcript?src= (a transcript document) → {src, words} · POST /api/transcript/status {srcs} → {status:{src: {words, language, model, duration, created} | false | null}} · POST /api/transcript/delete {src} → {deleted}. SSE event transcript ({src}) after each save or delete. POST /api/transcribe/request {transcribe:{srcs, model?, language?, again?}, where?} queues a transcription on the export-job queue (poll GET /api/export/job?id=); the tab saves each transcript, and the job's result lists done, skipped and failed. See Transcripts and text-based editing.
  • POST /api/denoise - body {src:"/media/…", amount:"light"|"medium"|"strong"}: writes a noise-reduced FLAC of the whole file into ./media/ (reused if it exists) and returns {src, name, duration, channels}. Does not touch project.json (see Audio mix).
  • POST /api/analyze - body {src:"/media/ref.mp4", threshold?, music?}: analyze a reference video into an edit blueprint (see Remake a reference video); extracts its music into ./media. GET /api/analyze?src=… returns the cached blueprint.
  • GET /api/frame?src=/media/x.mp4&t=3.2 - one JPEG still of a source clip, the "eyes" to go with /api/analyze's ears (see Look at the footage). Optional w (pixel width, default 768) and q (ffmpeg -q:v 1–31, default 4). &frames=N[&cols=][&from=][&to=][&w=320] instead returns one N-up contact sheet across the clip (N 2–60; cols omitted → the squarest layout, so 6 frames give 3×2 rather than 4×2 with two black cells). src must name an existing file under /media/ or /library/ (404 otherwise). ?path= reads any file on the machine but only with the X-FableCut-Client: mcp request header, which only the local MCP client sends - without it the request is refused (403) before the path is even resolved. Results are cached in analysis/frames/ keyed by source path, size and mtime; the cache is capped (500 files / 128 MB, oldest first). The response carries X-FableCut-Frame-Times (comma-separated sample times, so a sheet's cells can be mapped back to timestamps) and X-FableCut-Frame-Source.
  • POST /api/scopes/request also takes {"image":true}, which makes the editor return the measured still as a JPEG data URL in result.image - how fablecut_frame {time} shows an agent the composed program picture.
  • GET /api/events - SSE: named event change when project.json, ./media or ./library changes; named event profiles when encoding-profiles.json changes (UI refreshes the export-profile list only - no project reload); named event proxy as a proxy is queued, makes progress, finishes or is deleted
  • Fast / WebCodecs export (browser compositor → server ffmpeg): GET /api/export/ffmpeg → {available} · GET /api/export/profiles[?detail=1] → {default, profiles, issues} · POST /api/export/begin {fps,name,mode?,profile?,hasAudio?,pixelFormat?,width?,height?} → {id,mode,profile?,label,summary} (fps is required - pass project.fps, no server-side default; mode is "jpeg" (default, Fast) or "annexb" (WebCodecs H.264 elementary stream); jpeg 400 if profile is not a defined id, or if ffmpeg rejects its args in the dry run; optional pixelFormat:"rgba" plus width/height pipes raw canvas frames instead of JPEG) · POST /api/export/frame?id= (JPEG body for jpeg mode; raw RGBA if begin used pixelFormat:"rgba"; Annex-B for annexb - one POST may concatenate frames or AUs. Must be after audio; ffmpeg is spawned on the first frame in both modes) · POST /api/export/audio?id= (WAV body - must be sent before the first frame) · POST /api/export/end?id=[&discard=1] → {src} under /exports/
  • Export jobs (what fablecut_export drives): POST /api/export/request {range?, profile?, where?:"auto"|"tab"|"headless"} → {id, status, via, …} (409 if one is already running, or nothing can render it) · GET /api/export/job?id= → {status: pending|running|done|failed|cancelled, progress 0–1, src, error} · POST /api/export/job/cancel?id=. The editor tab side: SSE event export (a ticket), GET /api/export/job/ticket?id=, POST /api/export/job/claim?id= (first tab wins, else 409), POST /api/export/job/report?id= {progress} | {status:"done", src} | {status:"failed", error} → {cancel}.
diff --git a/docs/docs/sequences/index.html b/docs/docs/sequences/index.html index faca64950..e8cd4468a 100644 --- a/docs/docs/sequences/index.html +++ b/docs/docs/sequences/index.html @@ -87,7 +87,7 @@

Sequences

"clips": [ /* … */ ], "tracks": [ /* … */ ], "markers": [ /* … */ ], "delivery": { "preset": "instagram-reels" } } ]

Opening another sequence parks the top-level keys in the open one's entry and brings the other's up, with a new revision - like any edit. A clip in a sequence that isn't open still counts: its media shows "used" in the bin, can't be removed while it is there (removeMedia and Remove from project refuse and name the sequence), and Replace file… trims it too; a comp it places can't be removed either. A project with one sequence named Main has neither key.

In the editor: the sequence menu at the left of the timeline toolbar (it shows the open sequence's name, and how many there are) lists them - click one to open it - and has New sequence… (a name, a canvas - the same as the open one, or 16:9, 9:16, 4:5, 1:1 - and, optionally, a copy of the open sequence's timeline to start from), Duplicate, Rename… and Delete… (click twice; the project is first kept as a version, so a deleted sequence can be restored from Projects → Versions). For the session each sequence keeps its own undo history, playhead and selection. The Export dialog, the Mixer, IN / OUT and the canvas settings all belong to the open sequence. Find timeline instances lists placements in other sequences too; clicking one opens its sequence.

Agents (fablecut_patch_project):

  • {op:"addSequence", name?, id?, from?, width?, height?, fps?, open?:true} - from:"empty" (default; the open sequence's canvas and frame rate, no clips), "open" (a copy of the open sequence's timeline) or a sequence id (a copy of that one). width / height / fps change the copy's canvas: the clips keep their positions relative to the centre, and an exportFrame is dropped.
  • {op:"inSequence", sequence, ops:[…]} runs ops on a sequence without opening it: clip and timeline ops, setProject (its canvas, markers, IN / OUT, delivery), setTrack, setBus, setFx on its tracks, and updateSequence (name, index) - not addSequence, openSequence, removeSequence or another inSequence. The user's editor stays where it is.
  • {op:"openSequence", id} changes what the user's editor shows, and what fablecut_export, fablecut_frame {time} and fablecut_scopes render: do it when the user asked, or to export that sequence.
  • {op:"updateSequence", id, set:{name?, index?}} renames or reorders one; {op:"removeSequence", id} deletes one (only when asked; the last one stays, deleting the open one opens its neighbour, and one holding locked clips or tracks needs force:true).
  • The compact view and fablecut_status list every sequence (id, name, canvas, clips, length, which is open). A version's Compare reports each sequence's changes on its own, sequences added and removed, and which one was open.

Reframe - fablecut_reframe {aspect?:"9:16"|"1:1"|"4:5"|"16:9"|"4:3"|"2:3", name?, clipIds?, follow?, smooth?, force?} makes a copy of the open sequence on that canvas shape and opens it (the project's shorter side kept: 1920×1080 → 1080×1920 for 9:16, 1080×1080 for 1:1), so the original cut stays as it was; without aspect it reframes the open sequence on its own canvas. Each full-frame shot - a video or still that isn't moved, scaled, cropped or keyed by hand - gets fit:"cover" and an x (or y) that keeps its subject in view. Frames are sampled 5 times a second at 96 px; the subject is where motion (against the shot's own movement, so a pan or a flicker doesn't count), detail and colour gather, pulled gently toward the centre. A virtual camera operator then holds still while the subject stays inside a dead zone and eases after it no faster than a pan speed, and the path becomes ordinary keyframes (thinned to within ~2 px), or one steady position. Shots with no clear subject are centred. Titles, picture-in-picture, clips placed or animated by hand and locked clips (unless force:true) are left alone and listed in the reply - check them on the new canvas with fablecut_frame {time}. follow:false only fits and centres; smooth 0…1 (default 0.5) holds longer and pans slower as it rises. props.reframe marks what Reframe did, so running it again replaces its own keys. A version is kept first. In the editor: New sequence… with a copy of the open sequence on another shape has Follow the subject in each shot; the Inspector's Reframe section on a video or picture of another shape than the canvas has Follow subject, Centre and Lively / Balanced / Steady (the selected clips, one undo step, with Cancel).

Highlights - fablecut_highlights {duration?, shot?, clipIds?, mediaIds?, name?, aspect?} finds the best moments of long footage and cuts them into a short edit: a new sequence (Highlights 30 s, or name), opened, so the timeline it came from stays as it was. It reads the video clips on the open timeline (clipIds limits them; mediaIds reads whole files instead), up to an hour of footage at a time: frames twice a second at 64 px, and the sound. Every half second is scored for movement, sound louder than the 20 s around it (a cheer, a laugh, a hit), its overall level, and a clear picture; black frames and flat colour count for little. Cuts already in the footage are found, and a moment never crosses one. It then takes the best moments of shot seconds (default duration / 8, kept within 1.5–4 s), apart in the same footage (by half a moment, at least a second) and spread over its shots, until the edit is duration seconds (default 30; 5…600), trims the last ones to fit exactly, and nudges each end up to 0.3 s to the quietest point near it, so no word or hit is cut through. The moments go back to back on V1 in story order, each a clip of its source with its props (a reframed clip's framing isn't carried over) and its linked sound clips beside it (their own tracks, linked again); their keyframes aren't carried over. A moment from a whole file (mediaIds) is one video clip that plays its own sound, with no separate audio clips. A clip played faster or slower counts by its length on the timeline: duration and shot are always seconds of the edit. In the editor (and Studio) the sound of a file longer than 30 minutes isn't read, so as not to decode it whole in the browser; its picture decides. Disabled clips and clips with a speed ramp are not read. aspect makes the new sequence 9:16, 1:1 or 4:5: the shots are then letterboxed, and fablecut_reframe {} fits them and follows the subject. The reply lists each moment (its source, times, length, why it was picked and its score). A version is kept first. In the editor: the sequence menu's Highlights… (15, 30, 60 or 90 s; a canvas, and Follow the subject in each shot on another shape) reads the selected video clips, else every video clip on the timeline, with progress and Cancel.

Recipes: vertical cut of a finished edit - fablecut_reframe {aspect:"9:16"}, then check the titles with fablecut_frame; by hand, addSequence {name:"Reel 9:16", from:"open", width:1080, height:1920}, then inSequence ops to re-position or re-scale the shots and setProject {delivery:"instagram-reels"} in it; reel from a long video - fablecut_highlights {duration:30, aspect:"9:16"}, then fablecut_reframe {}, music on an audio track and fablecut_beats {clipId:<the music>, retime:{every:2}}, then captions; cut-downs - duplicate the edit as "30 s" and "15 s" and tighten each with the trim ops inside inSequence; selects reel - an empty sequence the user drops favourite takes on, cut into the edit from the Source monitor.

diff --git a/docs/docs/tracking/index.html b/docs/docs/tracking/index.html index 290d69b1f..470c4701b 100644 --- a/docs/docs/tracking/index.html +++ b/docs/docs/tracking/index.html @@ -85,7 +85,7 @@

Motion tracking

"samples": [[0, 0.31, 0.42, 1, 0, 1], [0.0333, 0.312, 0.421, 1, 0, 0.98]] } ]
keydoes
namehow masks, clips and agents refer to it (default Track n, or the mask's name)
kindpoint (position) or box (position, size and rotation were followed)
w · hthe region that was matched, fractions of the clip's picture
samplesone per frame: [t, x, y, s, r, q]. t is seconds from the clip's start, x, y is the centre (fractions of the picture, like masks), s is the scale and r the rotation (°) relative to the first sample, q is the match quality 0…1

The tracker matches a small greyscale template of the region (normalized cross-correlation, sub-pixel, optionally over scale and rotation) and keeps the template fresh while anchoring it to the first frame so it does not drift. It stops where the match quality drops below 0.45 (the region was covered, left the frame or changed too much) and keeps what it tracked up to there. Pick regions with detail: corners, text, edges. Flat sky or a blank wall can't be tracked. A track without scale follows position only: if the thing grows, shrinks or turns noticeably, turn on Scale / Rotate (scale / rotation), or the match fades and the track stops early. Tracks are stored in clip time, so they move with the clip and follow trims and splits (re-track after changing its speed).

In the editor:

  • Mask tracking. Select a mask on a video clip. Under its mode row, ◀ Back and On ▶ follow what the mask covers from the playhead to the clip's start or end, and key the mask's x / y. Turn on Scale and Rotate to key those too. The keys are linear and simplified (a key only where the motion turns, within ~1.5 px). Keys the mask had in that range lose their position and keep everything else.
  • Point tracking. The Inspector's Tracking section (video clips): + Track point, then click the spot on the monitor. It tracks from the playhead to the clip's end. Region sets the matched area (% of the picture's width). Pick a track's chip to see its path and region on the monitor, ◀ Track back / Track on ▶ to extend it from the playhead, and Delete it.
  • Attach a clip. With a track picked, choose a clip in Attach (any visual clip that overlaps it in time) and press Attach to the track. The clip gets x / y keyframes (plus scale / rotation with those toggles on) that ride on the track and keep it where it is at the playhead. Stickers, titles, a blur box or a highlight then stay pinned to the moving thing.
  • Tracking runs from a private copy of the video, so the monitor does not move. Progress shows in the Inspector, and Esc stops it and keeps what it has. Each finished track is one undo step.

Agents: fablecut_track runs the tracker in the editor (an open tab, else headless Chrome / Edge) and saves the result:

  • {clip, point:{x:0.62, y:0.4}, at:12} follows a spot from at to the clip's end. region:{x, y, w, h} gives the area instead, size sets a point's region (default 0.08 of the width), direction:"backward"|"both" and to (timeline seconds) set the range, and scale / rotation follow those too.
  • apply:{mask:"Face"} bakes the result into that mask's keys. Leave out point / region and the mask's own outline is what gets followed.
  • apply:{clip:"c_sticker", scale?, rotation?, at?} pins another clip to the track.
  • name names the track. Passing an existing name with apply and no region re-applies the stored track without tracking again.
  • The reply gives the range, the match quality (min / mean; ≥ 0.8 is solid), where it was lost, and what was keyed.
  • {op:"removeTrack", id, track} deletes a stored track; what followed it keeps its keys. The compact project view lists tracks as [tracks: "Logo" point 0.00–4.20 s (127 samples)], never their samples.

Recipes: a title that follows a car - track a point on the car, attach the title; blur a face or a plate - an ellipse mask on a blurred copy of the shot on the track above, then apply:{mask:"Face"}; a screen replacement - track the screen with Scale and Rotate on and attach the new picture, cropped to fit; a highlight that stays on a UI element in a screen recording - track the button, attach a rect svg.

diff --git a/docs/docs/transcripts/index.html b/docs/docs/transcripts/index.html index 729a615c0..7f4d114e9 100644 --- a/docs/docs/transcripts/index.html +++ b/docs/docs/transcripts/index.html @@ -82,7 +82,7 @@

Transcripts and text-based editing

Turn speech into words with times, in the browser, then read, search and cut the edit like text: in the Transcript tab, or from an agent with fablecut_transcribe.

FableCut turns the speech in a clip into words with times, so an edit can be read, searched and cut like text. Transcription runs in the browser: Whisper (OpenAI's speech model, through transformers.js) in a background worker of the editor tab. The library and the model are fetched from a CDN the first time and kept by the browser after that; the audio never leaves the machine.

modeldownload
base (default)77 MBquick: about 15 s per minute of speech on a fast desktop
small250 MBoften more accurate (accents, noisy rooms, numbers); about twice as slow

Whisper detects the language by itself; give it one (en, es, hi, ja, … any Whisper code) when a clip is short or mixes languages. Long files are split at their quietest moments into pieces of at most 28 s, and stretches of silence are skipped (Whisper invents words in silence).

One transcript per file, kept by the server in analysis/transcripts/: {v, src, model, language, duration, created, words:[[text, start, end], …]}, times in seconds of the file. Like a proxy it belongs to the file's size and modification time, so a replaced or re-rendered file has none until it is transcribed again. It is not stored in project.json, so it never bloats the timeline, and every clip and sequence that uses the file reads the same one.

On the timeline a clip shows the words its window of the file holds, placed through its in point and speed (a word counts when its middle is inside the clip). A clip with a speed ramp is left out, and so are disabled clips and pictures whose sound is off.

Cutting words extracts on the targeted tracks, from just before the first word to just before the word after the last one: the pause after the cut goes too, the pause before it stays. Cuts land on whole frames, never in a neighbouring word or past the clip. Several cuts go last first, as one undo step (one revision for an agent): later material moves up, linked stems stay in step, and locked clips stay put - lock the music bed first if it should keep running under the tightened edit. Find matches whole words and ignores case, accents, punctuation and spacing: "ai powered" finds "A.I.-powered", and "cat" doesn't find "category".

In the editor, the Transcript tab beside the Inspector:

  • Transcribe works on the selected clips' files (a selection with no speech, such as a title, transcribes nothing), else on every file on the timeline that has no transcript yet; once every file has one (an agent may have made them), it reads Transcribe again and redoes them all. The model and the language are beside it. Progress shows below (the first time, the model download), with Cancel. A line above the words says which model and language made them: when the words look wrong, pick the language spoken and the Small model, then Transcribe again.
  • The timeline's words, in paragraphs with timecodes. Click a word to go there; the word under the playhead is underlined and followed while playing. ⇧-click or drag to select a run of words, then press Delete (or Cut) to extract it.
  • Find words marks every match, Enter steps through them, and Cut N extracts them all. Copy copies the text with its timecodes.

Agents use fablecut_transcribe. It transcribes in an open editor tab, else in headless Chrome / Edge, whose profile is kept in analysis/browser-profile/ so the model downloads once:

  • {} transcribes every clip with sound that has no transcript yet, then returns the timeline's words as timed lines: [0:12.08] Open the demo, nothing to install. clipIds limits it to some clips; from / to limit the time (the reply stops at 300 lines); mediaIds reads whole files in file seconds instead.
  • model:"small", language:"es", and again:true (transcribe again, with another model or language).
  • find:"phrase" (or a list) reports each place it is said, with its span, the words around it and how much cutting them would remove; cut:true extracts them (tracks and force as for fablecut_silence). A version of the project is kept before the cut.

Whisper writes clean text: it often leaves out fillers ("um", "uh") and false starts, so find those by ear (fablecut_silence for the pauses), not by text. Word times are good to about a tenth of a second; listen to a cut that matters, or check it with fablecut_frame.

diff --git a/docs/docs/versions/index.html b/docs/docs/versions/index.html index dbeeee701..0242d9833 100644 --- a/docs/docs/versions/index.html +++ b/docs/docs/versions/index.html @@ -82,7 +82,7 @@

Versions

Saved copies of a project you can compare and go back to, made by you, every few minutes, and before an agent edits; restoring is never destructive, and a backup carries them all.

Every edit is saved as it happens, and undo covers the session. An edit that reaches the open editor from outside (an agent, another tab) is one undo step of its own there: Ctrl+Z takes it back first, then the user's own edits. Versions are what you come back to later: full copies of a project, kept beside it, that are never overwritten. Restoring one is not destructive either - what is there is saved as a version first, so a restore can be undone by restoring that.

pathholds
projects/<id>/history/v0007.jsonthe project as it was
projects/<id>/history/v0007.meta.json{v, name, note, kind, created, revision, clips, duration, final}

A version's kind says where it came from:

kindmade
manualby you (Save version, Ctrl/Cmd+S) or an agent (fablecut_versions {action:"save"})
autoevery 10 minutes while the open project changes, whoever changes it (FABLECUT_AUTO_VERSION_MIN sets the minutes); the newest 30 are kept
agentbefore an agent's first edit of a session (again after 10 quiet minutes), and before every fablecut_set_project rewrite
restorewhat was there just before a restore

One version per project can be marked final (the cut that went out); a final version can't be deleted until it is unmarked. Manual, agent and restore versions are never pruned.

Compare tells what changed between a version and now (or two versions): clips added, removed and changed (timing, which props, keyframes, effects, transitions, source, track), media added and removed, the length, and project settings (name, canvas, frame rate, IN / OUT, tracks, markers, comps, mix, delivery, …).

Backup and recovery. Download backup saves a project with all its versions as one .fablecut-backup.json file; Import… in the dashboard brings it back, versions included. When project.json can't be read as the server starts (another tool crashed mid-write, a bad hand edit), the server keeps the broken file as project.corrupt-<time>.json and puts back the newest good copy: the latest version, or the project's last parked copy.

In the editor: Ctrl/Cmd+S saves a version of the open project. In the Projects dashboard, a project's Versions… lists its versions, newest first, with Save version (name and note), and per version Compare with now, Restore… (click twice), Mark final, Rename, Download and Delete… (click twice). Esc goes back to the projects.

Agents use fablecut_versions (or GET / POST /api/versions):

  • {} lists the open project's versions (project picks another one).
  • {action:"save", name?, note?, final?} - save one before a big or risky change (a restructure, a remake, a new grade on every shot) and when the user is happy with a cut, so there is a named point to go back to.
  • {action:"diff", version, to?} - what changed since that version (to now, or to version to). Use it to tell the user what an edit session changed.
  • {action:"restore", version} - only when the user asked; then re-read the project. {action:"update", version, name?, note?, final?} · {action:"delete", version}.

Recipes: try a bold alternative - save a version, make the change, compare, and restore if the user prefers the old one; client rounds - save "Round 1", "Round 2", … with the feedback in the note, mark the approved one final; what did the agent do? - diff against the "Before agent edits" version.

diff --git a/docs/docs/workflows/index.html b/docs/docs/workflows/index.html index 58f5de337..096e5324f 100644 --- a/docs/docs/workflows/index.html +++ b/docs/docs/workflows/index.html @@ -91,7 +91,7 @@

Workflows

{ "text": "Export for YouTube Shorts.", "call": { "tool": "fablecut_export", "args": { "preset": "youtube-shorts" } } } ], "created": "…", "updated": "…" }
keydoes
name · idup to 80 characters; the id is made from the name, and saving the same name again updates that workflow (it keeps its created)
description · tagswhat it is for (up to 600 characters) · up to 12 labels
steps1–50, each {text, call?} (a plain string is a step with only text); text up to 1000 characters
call{tool, args}: a FableCut tool (not fablecut_workflows) and the arguments it was given, up to 20 000 characters

Following one is a job for judgement, not a replay. The new project has other clips, ids and times, so a step's call is a worked example: read what the step says, look at the project (fablecut_get_project {compact:true}, fablecut_frame), and make the call that does that here. A step with no call is one only the agent's judgement can do ("pick the three strongest shots").

Agents use fablecut_workflows (or the REST endpoints below):

  • {} lists them (id, name, steps, tags, description); {action:"show", id} gives the steps to follow (id or name).
  • {action:"save", workflow:{name, description?, tags?, steps}} keeps one. Save when the user asks to keep or repeat what was just done: write each step the way you would explain it to another editor, and attach the calls that worked. A call to a tool that doesn't exist refuses the save.
  • {action:"delete", id} removes one: only when the user asks.

Recipes: "do what you did last week" - {}, then show the one that matches and do its steps; a house style for every episode - after the first episode is right, save its loudness, captions, grade and export steps as one workflow; hand a routine to another agent - the file in library/workflows/ is plain JSON any agent can read.

diff --git a/index.html b/index.html index 3b0e8c154..c3d02cce7 100644 --- a/index.html +++ b/index.html @@ -58,12 +58,16 @@
- - - - - - + + +
+
diff --git a/music.js b/music.js index 495143b1f..46bcc6d33 100644 --- a/music.js +++ b/music.js @@ -32,6 +32,8 @@ const KINDS = { music: { category: "music" }, sfx: { source: "freesound" } }; const MOODS = ["upbeat", "chill", "cinematic", "epic", "lo-fi", "acoustic", "electronic", "happy", "sad", "ambient", "piano", "corporate", "hip hop", "rock"]; + const SFX_WORDS = ["whoosh", "impact", "riser", "swoosh", "pop", "click", "ding", "glitch", + "boom", "camera shutter", "typing", "applause", "footsteps", "crowd"]; /* What each licence lets a video editor do. edits: may it be cut, looped and put under picture? Creative Commons counts music synced to moving images as @@ -124,9 +126,10 @@ tracks: (json.results || []).filter((r) => r && r.url).map(track) }; } - /** 125.4 → "2:05". */ + /** 125.4 → "2:05"; under 10 s with a tenth (a 0.4 s swipe reads "0.4 s", not "0:00"). */ function fmtLen(sec) { - const s = Math.round(+sec || 0); + if (+sec < 10) return (Math.round((+sec || 0) * 10) / 10) + " s"; + const s = Math.round(+sec); return Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"); } @@ -190,6 +193,6 @@ const ABOUT = "Music from Openverse (openverse.org) — made with Openverse, not endorsed or certified by it. Each track's licence is the artist's: check it before you publish."; - return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, LICENSES, ABOUT, + return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, SFX_WORDS, LICENSES, ABOUT, licence, flags, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; }); diff --git a/style.css b/style.css index f4575e305..1dcee36ff 100644 --- a/style.css +++ b/style.css @@ -486,6 +486,26 @@ body.track-size-s .clip.selected { border-bottom-color: var(--accent); } +/* the open group's own tabs (Audio: Music, SFX · Graphics: Elements…Templates) */ +.bin-subtabs { + display: flex; + gap: 4px; + padding: 6px 8px 0; +} +.bin-subtabs.hidden, .bin-subtabs button.hidden { display: none; } +.bin-subtabs button { + background: none; + border: 1px solid transparent; + border-radius: 6px; + color: var(--dim); + font: 600 11px/1.2 "Segoe UI", sans-serif; + padding: 4px 10px; + cursor: pointer; + white-space: nowrap; +} +.bin-subtabs button:hover { color: var(--text); } +.bin-subtabs button.on { color: #cfc8ff; background: #7b6cff22; border-color: #7b6cff55; } + .bin-list { flex: 1; overflow-y: auto; @@ -4850,6 +4870,7 @@ input[type=number]:hover::-webkit-inner-spin-button { opacity: .8; } .music-more { align-self: center; margin: 4px 0; } .music-about { font-size: 10px; line-height: 1.45; color: var(--dim); margin: 8px 2px 2px; } .music-about a { color: inherit; } +.music-status.lib-head { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); } .bin-info .bin-copy-credit { margin: 6px 0 2px; } .export-credits { margin: 0 0 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-sub); font-size: 12px; line-height: 1.4; } .export-credits-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; } diff --git a/test/music.test.js b/test/music.test.js index 931b6337b..7bbcb3397 100644 --- a/test/music.test.js +++ b/test/music.test.js @@ -66,6 +66,7 @@ test("results become plain tracks", () => { assert.equal(M.fileName(t), "Night Day - Jahzzar.mp3", "mp32 is an mp3"); assert.equal(M.fileName({ ...t, filetype: "oga" }), "Night Day - Jahzzar.ogg"); assert.equal(M.fmtLen(59.7), "1:00"); + assert.equal(M.fmtLen(0.43), "0.4 s"); const r = M.results({ result_count: 999, page_count: 50, results: [result(), result({ url: "" })] }, 2); assert.equal(r.tracks.length, 1, "a result without a file is dropped"); assert.equal(r.pages, 12); @@ -135,7 +136,7 @@ test("fablecut_music searches, imports a track with its licence, and lists the c const found = await text({ query: "calm night", commercial: true }); assert.match(found, /^1 result\(s\), page 1\/1 for "calm night"/); - assert.match(found, /1\. c14c7353-1688-4204-9af0-64c0a5e8ccc3 "Night & Day" — Jahzzar · 0:01 · CC BY-SA 3\.0 \[credit, share alike\] · ambient · jamendo/); + assert.match(found, /1\. c14c7353-1688-4204-9af0-64c0a5e8ccc3 "Night & Day" — Jahzzar · 1 s · CC BY-SA 3\.0 \[credit, share alike\] · ambient · jamendo/); assert.match(found, /made with Openverse, not endorsed/); assert.match(ov.seen[0], /q=calm\+night&category=music&license_type=commercial/); assert.match(await text({ page: 0 }), /ERROR .*page is 1–12/); From d042deb5d6d3b8ede6dda3e3ae1b8e697a7416ab Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:38:11 +0530 Subject: [PATCH 3/9] Skills: point agents at fablecut_music for music and sound effects --- skills/edit-video/SKILL.md | 5 +++++ skills/remake-reel/SKILL.md | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/skills/edit-video/SKILL.md b/skills/edit-video/SKILL.md index a0ff0f4b4..6d2b90ab9 100644 --- a/skills/edit-video/SKILL.md +++ b/skills/edit-video/SKILL.md @@ -103,6 +103,11 @@ them: look at those with `fablecut_frame` on the new canvas and move them. Lock the music lane before either cut. Caption it last: `fablecut_captions {style:"highlight", clipIds:[…the speech clips]}` (or subtitle, karaoke, pop), then look at a frame mid-sentence. +- **Music and sound effects** the user may use: `fablecut_music {query:"upbeat acoustic"}` + (or `kind:"sfx"`) lists openly licensed tracks with their licences; tell the + user the licence before they publish (ND tracks can't go under video; NC ones + not in monetized videos). `{import:""}` brings one in, `{credits:true}` + gives the lines for the video's description. - Vary the font per title. Reusing one typeface across a whole edit is the single clearest tell of a machine-made cut; `fablecut_docs {section:"Text"}` lists the built-in title styles. diff --git a/skills/remake-reel/SKILL.md b/skills/remake-reel/SKILL.md index 99b404598..65323f03b 100644 --- a/skills/remake-reel/SKILL.md +++ b/skills/remake-reel/SKILL.md @@ -38,7 +38,11 @@ as cuts, raise it. a whip transition on the way in. 5. Pace to taste: shots under ~0.6 s read as beat-flashes. `avgShotLen` tells you the reference's overall rhythm. -6. With the user's own music instead of the reference's, `fablecut_beats +6. No music of their own? `fablecut_music {query:"", length:"short"}` + finds openly licensed tracks (say each one's licence; add + `commercial:true, edits:true` when the reel will be monetized), and + `{import:""}` brings one in with its credit. + With the user's own music instead of the reference's, `fablecut_beats {clipId}` finds its tempo, beat and drop; `snap:true` rolls the cuts onto the beat, `retime:{every:2}` re-cuts V1 so each shot lasts 2 beats. 7. Posting it vertically: `fablecut_reframe {aspect:"9:16"}` makes a copy whose From c16880b54ba6cafb8b3e6ec861fbfe7673d451d2 Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:57:44 +0530 Subject: [PATCH 4/9] =?UTF-8?q?Music:=20address=20review=20=E2=80=94=20lic?= =?UTF-8?q?ence=20links,=20commercial=20filter,=20Sampling+,=20credits=20p?= =?UTF-8?q?er=20job,=20safer=20import=20and=20placement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Only http(s) links from search results; licence links saved whole or not at all - commercial / edits filter by FableCut's licence table (Openverse's commercial group has Sampling+) - Sampling+ / NC Sampling+: flagged samples only, with a warning - Credits note a denoised copy (changed: noise reduced); export credits kept per job - A music import leaves the read marker alone and removes its file if registration fails - No placement recipe for ND or Sampling tracks - replaceMedia and Replace file drop the old licence; relink keeps it - Editor: place on the timeline and playhead that were clicked, only with a known length, not during an export; report a refused placement; keep the typed search; previews reset; clipboard fallback - Requested file names: no dotfile, the stem is cut rather than the extension --- CLAUDE.md | 17 ++++-- app.js | 47 +++++++++++---- docs/demo/app.js | 47 +++++++++++---- docs/demo/music.js | 80 +++++++++++++++++--------- docs/docs/captions/index.html | 2 +- docs/docs/color/index.html | 2 +- docs/docs/compositing/index.html | 2 +- docs/docs/compositions/index.html | 2 +- docs/docs/editing/index.html | 2 +- docs/docs/export/index.html | 2 +- docs/docs/frames/index.html | 2 +- docs/docs/masks/index.html | 2 +- docs/docs/media/index.html | 2 +- docs/docs/motion-paths/index.html | 2 +- docs/docs/motion/index.html | 2 +- docs/docs/music/index.html | 4 +- docs/docs/presets-templates/index.html | 2 +- docs/docs/projects/index.html | 2 +- docs/docs/recipes/index.html | 2 +- docs/docs/remake/index.html | 2 +- docs/docs/rest-api/index.html | 2 +- docs/docs/sequences/index.html | 2 +- docs/docs/tracking/index.html | 2 +- docs/docs/transcripts/index.html | 2 +- docs/docs/versions/index.html | 2 +- docs/docs/workflows/index.html | 2 +- import-url.js | 4 +- mcp-server.js | 35 ++++++++--- music.js | 80 +++++++++++++++++--------- project-ops.js | 1 + skills/remake-reel/SKILL.md | 3 +- test/music.test.js | 60 +++++++++++++++++-- 32 files changed, 299 insertions(+), 121 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index c475110d6..a011a04aa 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -717,7 +717,8 @@ so the person publishing the video is the one who must respect it. | `by-sa` | credit · share alike | yes; credit, and the video is shared under CC BY-SA too | | `by-nc` · `by-nc-sa` | credit · non-commercial | not in ads, sponsored or monetized videos; credit (NC-SA: share alike too) | | `by-nd` · `by-nc-nd` | no edits | **no**: Creative Commons counts music set to video as a derivative | -| `sampling+` · `nc-sampling+` | credit · non-commercial | parts may be sampled and remixed; the whole track only non-commercially | +| `sampling+` | credit · non-commercial · samples only | parts may be sampled and transformed, also commercially (not in ads); the whole track as it is can't be set under a video | +| `nc-sampling+` | credit · non-commercial · samples only | parts may be sampled and transformed, non-commercially only; the whole track as it is can't be set under a video | Search with words about the music (mood, genre, instrument: "chill lo-fi piano"); leave the words out to see the newest tracks. Music comes from the @@ -742,7 +743,9 @@ The **credits** are every licensed file the edit uses (main timeline, comps and other sequences; a denoised copy counts as its original), one line each: `"Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921`, with a warning for a licence that limits the video (non-commercial, share -alike, no derivatives). They go in the video's description. +alike, no derivatives, samples only), and `— changed: noise reduced` when the +edit plays a denoised copy. They go in the video's description. Replacing a +file (**Replace file…**, `replaceMedia`) drops its licence; a relink keeps it. In the editor: the bin's **Music** tab has the search box, a length, **OK to monetize** (only licences that allow commercial use and edits), and mood chips @@ -760,11 +763,13 @@ music credits with **Copy**. Importing needs the editor server (or Studio). - `{query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?}` searches: 20 tracks a page, each `id "title" — artist · m:ss · licence [flags] · genres · source`. - `commercial:true` keeps licences that allow commercial use, `edits:true` leaves out - ND; pass both when the video will be monetized. + `commercial:true` keeps licences that allow commercial use (CC0, public domain, BY, + BY-SA, BY-ND), `edits:true` those that allow edits (it leaves out ND); pass both when + the video will be monetized. With `licenses`, only the ones among them that pass. - `{import:""}` downloads it into `media/` (named "Title - Artist") and - registers it with its `license`; the reply gives the licence, the credit and - an `addClip` to place it. Then `fablecut_beats {clipId}` finds its tempo, + registers it with its `license`; the reply gives the licence, the credit, any + limits, and an `addClip` to place it (not for an ND or Sampling track, which + can't go under a video as it is). Then `fablecut_beats {clipId}` finds its tempo, `retime` cuts to it, and `fablecut_auto_duck` dips it under speech. - `{credits:true}` lists the edit's credits and licence warnings. `fablecut_export` adds them to its reply when the edit uses licensed music. diff --git a/app.js b/app.js index bce772c9a..8b20f60cf 100644 --- a/app.js +++ b/app.js @@ -2766,6 +2766,7 @@ async function setMediaSource(m, src, mode, name) { if (mode === "replace") { m.name = name || MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; + delete m.license; // another file: the old track's licence and credit don't apply (a relink keeps it) } mediaOffline.delete(m.id); reloadMediaSource(m, oldSrc); @@ -3196,7 +3197,8 @@ function toggleSfxPreview(f, btn) { } function renderLibrary() { const dir = state.binTab; - if (dir === "project") return; + // a library listing that arrives after the user moved to a tab drawn elsewhere must not replace it + if (dir === "project" || dir === "music" || dir === "shapes" || dir === "templates") return; const files = runtime.library[dir] || []; els.libList.innerHTML = ""; if (dir === "sfx") { @@ -3329,8 +3331,18 @@ function musicTogglePreview(t, btn) { if (runtime.sfxPreview) runtime.sfxPreview.pause(); els.libList.querySelectorAll(".music-play, .lib-play").forEach((b) => (b.textContent = "▶")); const a = new Audio(t.url); - a.onended = () => { if (musicPreview && musicPreview.audio === a) { musicPreview = null; btn.textContent = "▶"; } }; - a.play().catch(() => { toast("Couldn't play " + t.title); btn.textContent = "▶"; }); + // the list may have been redrawn since: reset whichever ▶ buttons are on screen now + const done = () => { + if (!musicPreview || musicPreview.audio !== a) return; // stopped or replaced meanwhile + musicPreview = null; + els.libList.querySelectorAll(".music-play").forEach((b) => (b.textContent = "▶")); + }; + a.onended = done; + a.play().catch((e) => { + if (!musicPreview || musicPreview.audio !== a || (e && e.name === "AbortError")) return; + done(); + toast("Couldn't play " + t.title); + }); btn.textContent = "⏸"; musicPreview = { id: t.id, audio: a }; } @@ -3346,7 +3358,8 @@ async function musicImport(t, place, kind) { } musicImporting.add(t.id); renderOnlineTab(kind); - const gen = runtime.projectGen; + // + places it where the user clicked: that timeline (sequence / comp) and playhead + const gen = runtime.projectGen, at = { seq: project.sequence || null, comp: compCtxId(), t: state.time }; try { const res = await fetch("/api/import-url", { method: "POST", headers: { "Content-Type": "application/json" }, @@ -3362,8 +3375,16 @@ async function musicImport(t, place, kind) { if (gen !== runtime.projectGen) throw new Error("another project was opened — the file is in media/"); project.media.push(m); renderBin(); scheduleSave(); - if (place) addClipFromMedia(m, null, state.time); - toast(`Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`); + const what = `Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`; + const limit = FableCutMusic.warnings(t.license).find((w) => /derivatives|sampled/.test(w)); + let unplaced = ""; + if (place) { + if (!(m.duration > 0 && isFinite(m.duration))) unplaced = "its length couldn't be read, so it's in the Project bin but not on the timeline"; + else if ((project.sequence || null) !== at.seq || compCtxId() !== at.comp) unplaced = "another timeline is open now, so it's in the Project bin but not placed"; + else if (exportBusy()) unplaced = "an export is running, so it's in the Project bin but not placed"; + else if (!addClipFromMedia(m, null, at.t)) unplaced = "it's in the Project bin, but the audio track is locked, so it wasn't placed"; + } + toast(what + (unplaced ? " — " + unplaced : "") + (limit ? " ⚠ " + limit : "")); } catch (e) { toast(e && e.message ? e.message : "Couldn't import it"); } finally { @@ -3372,7 +3393,10 @@ async function musicImport(t, place, kind) { } } function copyCredits(lines) { - navigator.clipboard.writeText(lines.join("\n")).then(() => toast(lines.length === 1 ? "Copied the credit" : `Copied ${lines.length} credits`), () => toast("Couldn't copy — the browser refused")); + const refused = () => toast("Couldn't copy — select the credit text and copy it yourself"); + try { + navigator.clipboard.writeText(lines.join("\n")).then(() => toast(lines.length === 1 ? "Copied the credit" : `Copied ${lines.length} credits`), refused); + } catch { refused(); } // no clipboard access (an insecure page, an old browser) } /** The Export dialog's note: the licensed music the edit uses, its credits and any licence warnings. */ function syncExportCredits() { @@ -3414,17 +3438,18 @@ function appendOnlineSearch(kind) {
`; const q = form.querySelector("input[type=search]"); - q.value = s.query; + q.value = s.draft != null ? s.draft : s.query; // what the user is typing survives a redraw + q.addEventListener("input", () => { s.draft = q.value; }); const len = form.querySelector('[data-f="length"]'); if (len) len.value = s.length; form.querySelector('[data-f="commercial"]').checked = s.commercial; - form.addEventListener("submit", (e) => { e.preventDefault(); s.query = q.value.trim(); musicSearch(kind, false); }); + form.addEventListener("submit", (e) => { e.preventDefault(); s.query = q.value.trim(); s.draft = null; musicSearch(kind, false); }); form.addEventListener("change", (e) => { const f = e.target.dataset.f; if (f === "length") s.length = e.target.value; else if (f === "commercial") s.commercial = e.target.checked; else return; - s.query = q.value.trim(); + s.query = q.value.trim(); s.draft = null; musicSearch(kind, false); }); list.appendChild(form); @@ -3436,7 +3461,7 @@ function appendOnlineSearch(kind) { for (const w of sfx ? FableCutMusic.SFX_WORDS : FableCutMusic.MOODS) { const b = document.createElement("button"); b.type = "button"; b.className = "bin-tag chip"; b.textContent = w; - b.addEventListener("click", () => { s.query = w; musicSearch(kind, false); }); + b.addEventListener("click", () => { s.query = w; s.draft = null; musicSearch(kind, false); }); moods.appendChild(b); } list.appendChild(moods); diff --git a/docs/demo/app.js b/docs/demo/app.js index bce772c9a..8b20f60cf 100644 --- a/docs/demo/app.js +++ b/docs/demo/app.js @@ -2766,6 +2766,7 @@ async function setMediaSource(m, src, mode, name) { if (mode === "replace") { m.name = name || MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; + delete m.license; // another file: the old track's licence and credit don't apply (a relink keeps it) } mediaOffline.delete(m.id); reloadMediaSource(m, oldSrc); @@ -3196,7 +3197,8 @@ function toggleSfxPreview(f, btn) { } function renderLibrary() { const dir = state.binTab; - if (dir === "project") return; + // a library listing that arrives after the user moved to a tab drawn elsewhere must not replace it + if (dir === "project" || dir === "music" || dir === "shapes" || dir === "templates") return; const files = runtime.library[dir] || []; els.libList.innerHTML = ""; if (dir === "sfx") { @@ -3329,8 +3331,18 @@ function musicTogglePreview(t, btn) { if (runtime.sfxPreview) runtime.sfxPreview.pause(); els.libList.querySelectorAll(".music-play, .lib-play").forEach((b) => (b.textContent = "▶")); const a = new Audio(t.url); - a.onended = () => { if (musicPreview && musicPreview.audio === a) { musicPreview = null; btn.textContent = "▶"; } }; - a.play().catch(() => { toast("Couldn't play " + t.title); btn.textContent = "▶"; }); + // the list may have been redrawn since: reset whichever ▶ buttons are on screen now + const done = () => { + if (!musicPreview || musicPreview.audio !== a) return; // stopped or replaced meanwhile + musicPreview = null; + els.libList.querySelectorAll(".music-play").forEach((b) => (b.textContent = "▶")); + }; + a.onended = done; + a.play().catch((e) => { + if (!musicPreview || musicPreview.audio !== a || (e && e.name === "AbortError")) return; + done(); + toast("Couldn't play " + t.title); + }); btn.textContent = "⏸"; musicPreview = { id: t.id, audio: a }; } @@ -3346,7 +3358,8 @@ async function musicImport(t, place, kind) { } musicImporting.add(t.id); renderOnlineTab(kind); - const gen = runtime.projectGen; + // + places it where the user clicked: that timeline (sequence / comp) and playhead + const gen = runtime.projectGen, at = { seq: project.sequence || null, comp: compCtxId(), t: state.time }; try { const res = await fetch("/api/import-url", { method: "POST", headers: { "Content-Type": "application/json" }, @@ -3362,8 +3375,16 @@ async function musicImport(t, place, kind) { if (gen !== runtime.projectGen) throw new Error("another project was opened — the file is in media/"); project.media.push(m); renderBin(); scheduleSave(); - if (place) addClipFromMedia(m, null, state.time); - toast(`Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`); + const what = `Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`; + const limit = FableCutMusic.warnings(t.license).find((w) => /derivatives|sampled/.test(w)); + let unplaced = ""; + if (place) { + if (!(m.duration > 0 && isFinite(m.duration))) unplaced = "its length couldn't be read, so it's in the Project bin but not on the timeline"; + else if ((project.sequence || null) !== at.seq || compCtxId() !== at.comp) unplaced = "another timeline is open now, so it's in the Project bin but not placed"; + else if (exportBusy()) unplaced = "an export is running, so it's in the Project bin but not placed"; + else if (!addClipFromMedia(m, null, at.t)) unplaced = "it's in the Project bin, but the audio track is locked, so it wasn't placed"; + } + toast(what + (unplaced ? " — " + unplaced : "") + (limit ? " ⚠ " + limit : "")); } catch (e) { toast(e && e.message ? e.message : "Couldn't import it"); } finally { @@ -3372,7 +3393,10 @@ async function musicImport(t, place, kind) { } } function copyCredits(lines) { - navigator.clipboard.writeText(lines.join("\n")).then(() => toast(lines.length === 1 ? "Copied the credit" : `Copied ${lines.length} credits`), () => toast("Couldn't copy — the browser refused")); + const refused = () => toast("Couldn't copy — select the credit text and copy it yourself"); + try { + navigator.clipboard.writeText(lines.join("\n")).then(() => toast(lines.length === 1 ? "Copied the credit" : `Copied ${lines.length} credits`), refused); + } catch { refused(); } // no clipboard access (an insecure page, an old browser) } /** The Export dialog's note: the licensed music the edit uses, its credits and any licence warnings. */ function syncExportCredits() { @@ -3414,17 +3438,18 @@ function appendOnlineSearch(kind) {
`; const q = form.querySelector("input[type=search]"); - q.value = s.query; + q.value = s.draft != null ? s.draft : s.query; // what the user is typing survives a redraw + q.addEventListener("input", () => { s.draft = q.value; }); const len = form.querySelector('[data-f="length"]'); if (len) len.value = s.length; form.querySelector('[data-f="commercial"]').checked = s.commercial; - form.addEventListener("submit", (e) => { e.preventDefault(); s.query = q.value.trim(); musicSearch(kind, false); }); + form.addEventListener("submit", (e) => { e.preventDefault(); s.query = q.value.trim(); s.draft = null; musicSearch(kind, false); }); form.addEventListener("change", (e) => { const f = e.target.dataset.f; if (f === "length") s.length = e.target.value; else if (f === "commercial") s.commercial = e.target.checked; else return; - s.query = q.value.trim(); + s.query = q.value.trim(); s.draft = null; musicSearch(kind, false); }); list.appendChild(form); @@ -3436,7 +3461,7 @@ function appendOnlineSearch(kind) { for (const w of sfx ? FableCutMusic.SFX_WORDS : FableCutMusic.MOODS) { const b = document.createElement("button"); b.type = "button"; b.className = "bin-tag chip"; b.textContent = w; - b.addEventListener("click", () => { s.query = w; musicSearch(kind, false); }); + b.addEventListener("click", () => { s.query = w; s.draft = null; musicSearch(kind, false); }); moods.appendChild(b); } list.appendChild(moods); diff --git a/docs/demo/music.js b/docs/demo/music.js index 46bcc6d33..2878efe8c 100644 --- a/docs/demo/music.js +++ b/docs/demo/music.js @@ -47,8 +47,9 @@ "by-nc-sa": { label: "CC BY-NC-SA", commercial: false, edits: true, credit: true, note: "non-commercial only, credit the artist; the video must be shared under CC BY-NC-SA too" }, "by-nd": { label: "CC BY-ND", commercial: true, edits: false, credit: true, note: "no derivatives: music set to video counts as one, so it can't go into an edit" }, "by-nc-nd": { label: "CC BY-NC-ND", commercial: false, edits: false, credit: true, note: "non-commercial and no derivatives: music set to video counts as one, so it can't go into an edit" }, - "sampling+": { label: "Sampling+", commercial: false, edits: true, credit: true, note: "parts may be sampled and remixed, also commercially (not for ads); the whole track only non-commercially; credit the artist" }, - "nc-sampling+": { label: "NC Sampling+", commercial: false, edits: true, credit: true, note: "parts may be sampled and remixed non-commercially; credit the artist" }, + // Sampling licences allow transforming parts of a track, not setting the whole track to video as it is + "sampling+": { label: "Sampling+", commercial: false, edits: true, sampling: true, credit: true, note: "parts may be sampled and transformed, also commercially (not in ads); the whole track as it is only shared non-commercially, not set to video; credit the artist" }, + "nc-sampling+": { label: "NC Sampling+", commercial: false, edits: true, sampling: true, credit: true, note: "parts may be sampled and transformed, non-commercially only; the whole track as it is can't be set to video; credit the artist" }, }; /** What a licence allows: {code, label ("CC BY 4.0"), commercial, edits, credit, note, url}. */ @@ -57,20 +58,37 @@ const base = LICENSES[c] || { label: c ? c.toUpperCase() : "Unknown licence", commercial: false, edits: false, credit: true, note: "unknown licence — check the track's page before using it" }; const v = version && !/^(cc0|pdm)$/.test(c) ? String(version) : ""; return { code: c, label: base.label + (v ? " " + v : ""), commercial: base.commercial, edits: base.edits, - credit: base.credit, note: base.note, url: url || "" }; + sampling: !!base.sampling, credit: base.credit, note: base.note, url: url || "" }; } - /** The words that sum a licence up for a badge: "free to use", "credit", "non-commercial", "no edits", "share alike". */ + /** The words that sum a licence up for a badge: "free to use", "credit", "non-commercial", "no edits", "samples only", "share alike". */ function flags(lic) { const out = []; if (!lic.credit && lic.commercial && lic.edits) out.push("free to use"); if (lic.credit) out.push("credit"); if (!lic.commercial) out.push("non-commercial"); if (!lic.edits) out.push("no edits"); + if (lic.sampling) out.push("samples only"); if (/-sa$/.test(lic.code)) out.push("share alike"); return out; } + /** Why a licence limits a video, one line each (credits and the import reply). */ + function warnings(lic) { + const out = []; + if (!lic.edits) out.push(lic.label + " allows no derivatives — music set to video counts as one"); + if (lic.sampling) out.push(lic.label + " allows only sampled, transformed parts — not the whole track under a video"); + if (!lic.commercial) out.push(lic.label + " is non-commercial only"); + if (/-sa$/.test(lic.code)) out.push(lic.label + ": share the video under the same licence"); + return out; + } + + /** Only http(s) links reach a page's href; anything else becomes "". */ + function webUrl(u) { + try { const x = new URL(String(u || "")); return x.protocol === "https:" || x.protocol === "http:" ? x.href : ""; } + catch (_) { return ""; } + } + /** The Openverse search URL. opts: {query, kind:'music'|'sfx', length:'shortest'|'short'|'medium'|'long', * commercial:true (only licences that allow commercial use), edits:true (only ones that allow * edits), licenses:[codes], page}. */ @@ -82,11 +100,15 @@ const kind = KINDS[opts.kind] || KINDS.music; for (const k of Object.keys(kind)) p.set(k, kind[k]); if (opts.length && LENGTHS[opts.length]) p.set("length", opts.length); - const types = []; - if (opts.commercial) types.push("commercial"); - if (opts.edits) types.push("modification"); - if (types.length) p.set("license_type", types.join(",")); - const lic = (opts.licenses || []).map((l) => String(l).toLowerCase()).filter((l) => LICENSES[l]); + // commercial / edits pick licence codes by FableCut's own table: Openverse's "commercial" group + // includes Sampling+, which FableCut labels non-commercial for a whole track + let lic = (opts.licenses || []).map((l) => String(l).toLowerCase()).filter((l) => LICENSES[l]); + if (opts.commercial || opts.edits) { + const ok = (c) => (!opts.commercial || LICENSES[c].commercial) && (!opts.edits || LICENSES[c].edits); + const picked = (lic.length ? lic : Object.keys(LICENSES)).filter(ok); + if (!picked.length) throw new Error("none of those licences allow " + [opts.commercial && "commercial use", opts.edits && "edits"].filter(Boolean).join(" and ")); + lic = picked; + } if (lic.length) p.set("license", lic.join(",")); p.set("mature", "false"); p.set("page_size", String(PAGE_SIZE)); @@ -108,12 +130,12 @@ /** An Openverse result as a plain track. */ function track(r) { r = r || {}; - const lic = licence(r.license, r.license_version, r.license_url); + const lic = licence(r.license, r.license_version, webUrl(r.license_url)); return { id: r.id, title: unescape(r.title || "Untitled"), creator: unescape(r.creator || "Unknown artist"), - creatorUrl: r.creator_url || "", duration: r.duration ? Math.round(r.duration / 100) / 10 : null, + creatorUrl: webUrl(r.creator_url), duration: r.duration ? Math.round(r.duration / 100) / 10 : null, license: lic, flags: flags(lic), - url: r.url || "", page: r.foreign_landing_url || "", source: r.source || r.provider || "", + url: webUrl(r.url), page: webUrl(r.foreign_landing_url), source: r.source || r.provider || "", genres: (r.genres || []).slice(0, 6), tags: (r.tags || []).map((t) => t && t.name).filter(Boolean).slice(0, 10), filetype: r.filetype || "", attribution: r.attribution || "", }; @@ -150,8 +172,12 @@ function cleanLicense(l) { if (!l || typeof l !== "object" || Array.isArray(l) || !l.code) return null; const out = {}; - for (const k of ["code", "label", "url", "title", "creator", "page", "source", "openverse", "attribution"]) - if (typeof l[k] === "string" && l[k]) out[k] = l[k].slice(0, k === "attribution" ? 1000 : 300); + for (const k of ["code", "label", "url", "title", "creator", "page", "source", "openverse", "attribution"]) { + if (typeof l[k] !== "string" || !l[k]) continue; + // links are kept whole or not at all: a cut URL would point somewhere else + if (k === "url" || k === "page") { const u = webUrl(l[k]); if (u && u.length <= 2000) out[k] = u; } + else out[k] = l[k].slice(0, k === "attribution" ? 1000 : 300); + } if (!out.label) out.label = licence(out.code).label; return out; } @@ -164,8 +190,9 @@ } /** The credits an edit needs: every licensed file the edit uses (a denoised - * copy counts as its original). uses: media id → placements (MediaLib.usageCounts). - * → [{mediaId, name, license, line, warnings}] */ + * copy counts as its original, and its credit says the sound was changed). + * uses: media id → placements (MediaLib.usageCounts). + * → [{mediaId, name, license, line, needsCredit, changes, warnings}] */ function credits(doc, uses) { const media = (doc && doc.media) || []; const byId = new Map(media.map((m) => [m.id, m])); @@ -173,26 +200,25 @@ for (let i = 0; m && !m.license && m.derivedFrom && i < 8; i++) m = byId.get(m.derivedFrom); return m && m.license ? m : null; }; - const out = [], seen = new Set(); + const byWork = new Map(); for (const m of media) { if (!(uses && uses.get ? uses.get(m.id) : 0)) continue; const o = origin(m); if (!o) continue; const key = o.license.openverse || o.id; - if (seen.has(key)) continue; - seen.add(key); - const lic = licence(o.license.code); - const warnings = []; - if (!lic.edits) warnings.push(lic.label + " allows no derivatives — music set to video counts as one"); - if (!lic.commercial) warnings.push(lic.label + " is non-commercial only"); - if (/-sa$/.test(lic.code)) warnings.push(lic.label + ": share the video under the same licence"); - out.push({ mediaId: o.id, name: o.name, license: o.license, needsCredit: lic.credit, line: creditLine(o.license), warnings }); + if (!byWork.has(key)) byWork.set(key, { o, changes: new Set() }); + if (m !== o && m.denoise) byWork.get(key).changes.add("noise reduced"); + else if (m !== o) byWork.get(key).changes.add("processed"); } - return out; + return [...byWork.values()].map(({ o, changes }) => { + const lic = licence(o.license.code), ch = [...changes]; + return { mediaId: o.id, name: o.name, license: o.license, needsCredit: lic.credit, changes: ch, + line: creditLine(o.license) + (ch.length ? ` — changed: ${ch.join(", ")}` : ""), warnings: warnings(lic) }; + }); } const ABOUT = "Music from Openverse (openverse.org) — made with Openverse, not endorsed or certified by it. Each track's licence is the artist's: check it before you publish."; return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, SFX_WORDS, LICENSES, ABOUT, - licence, flags, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; + licence, flags, warnings, webUrl, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; }); diff --git a/docs/docs/captions/index.html b/docs/docs/captions/index.html index 8852b00a4..6d1e7b9ff 100644 --- a/docs/docs/captions/index.html +++ b/docs/docs/captions/index.html @@ -82,7 +82,7 @@

Captions

Captions timed word by word from the transcript, in four styles, burned into the picture; SRT and WebVTT out and in.

Captions are made from a transcript (see Transcripts and text-based editing): the timeline's words are grouped into captions, and each caption is an ordinary text clip with wordTimes (each word's start and end), so its animation follows the speech word by word, and caption: true, so captions can be found, replaced and exported as a group. Because they are text clips they render the same way in preview and export (burned into the picture), and the Inspector restyles them like any title.

stylelook
subtitle (default)plain text on a dark bar, low on the frame, up to two lines
karaokebold outlined text; each word lights up as it is said
highlightbig uppercase outlined words, the one being said in a colour (highlightColor) - the short-video look; up to five words
popone to three big words at a time, each popping in as it is said

A new caption starts at a pause of 0.6 s or more, after a sentence, after a comma once it has three words, or when it would run too long (lines, words or seconds). Lines are as long as fit the canvas at the style's size: sizes follow the canvas's shorter side, so a 9:16 reel gets narrower captions than a 16:9 video. Each caption stays about a quarter of a second after its last word, never into the next one, and starts and ends on whole frames.

They go on the video lane captions are already on; otherwise on the top video lane when nothing is there while they run, else on a new lane above it. Making captions again replaces the ones there. Make them after the cutting is done: a cut through a caption shortens it but doesn't re-time its words, so make them again after you change the edit. The editor says so for a moment whenever an edit shortens a caption.

In the editor, the Captions row of the Transcript tab: pick a style, then Add captions (one undo step). SRT and VTT download the timeline's captions as a subtitle file; Import… places the captions of an SRT or WebVTT file instead, re-broken to the style's line length, with their words spread over each caption. Select a caption to restyle it in the Inspector: the Highlight colour sits under Animation, and a note says its words follow the speech.

Agents use fablecut_captions:

  • {} or {style:"highlight"} makes captions from every clip with sound (transcribing what has no transcript yet, as fablecut_transcribe does), and answers with where they went and the first few. clipIds, from / to limit it; lines, words and size (a scale on the style's size) adjust it; track picks the lane; replace:false keeps the captions already there.
  • {export:"srt"} or {export:"vtt"} writes the captions that show (not disabled, not on a disabled track) to exports/<project name>.srt or .vtt, adding a number when that name is taken (<project name> 2.srt), and returns the path: use that one.
  • {import:"<path to .srt or .vtt>"} places a file's captions (the file's text works too).
  • {remove:true} deletes every caption clip. Locked captions are left alone and refuse the call unless force:true.
  • Check one with fablecut_frame {time} while a word is being said. Restyle them all with updateClip (e.g. props:{highlightColor:"#22d3ee", y:500}) on each caption id from the compact view, which lists a caption as [5 words timed to speech] instead of its times.
diff --git a/docs/docs/color/index.html b/docs/docs/color/index.html index d3aa14f5d..2ddaa0af1 100644 --- a/docs/docs/color/index.html +++ b/docs/docs/color/index.html @@ -87,7 +87,7 @@

Color

"exposure": -0.6 } ]
keydoes
name · ona label; on:false turns the layer off
qualifier.hue[centre°, width°, soft°] - hues within ±width/2 of the centre, easing out over soft; wraps through red. Greys carry no hue, so a hue range leaves them out
qualifier.sat · qualifier.luma[low, high, soft] on 0…1 - saturation (HSV) / Rec.709 luma between low and high
qualifier.invertselect everything else
mask.shapeellipse · rect · poly · bezier (or freehand with a stroke, fitted into a bezier - see Masks)
mask.x · mask.ycentre, as fractions of the clip's picture (0…1, y down)
mask.w · mask.hsize, fractions of the picture's width / height (ellipse, rect)
mask.rotationdegrees, clockwise
mask.feathersoft edge, a fraction of the picture's height (0…0.5), centred on the outline
mask.pointspoly: 3–16 [dx, dy] corners around x, y (fractions of width / height); bezier: 3–24 anchors [dx, dy] or [dx, dy, inX, inY, outX, outY] with curve handles
mask.invertgrade outside the shape
mask.keysanimate it: [{t, x?, y?, w?, h?, rotation?, feather?, ease?}], t in seconds from the clip's start; each param eases between the keys that set it (ease on the arriving key, as for clip keyframes)

Masks live in the clip's own picture, so they follow the clip when it is moved, scaled, rotated, cropped or flipped. On an adjustment layer they are fractions of the canvas.

In the editor the strip under Copy / Paste lists Primary and the layers; + Layer adds one. With a layer picked, the wheels, sliders and curves edit that layer, and three more sections appear: the layer's name, On, Matte (the monitor shows what it selects, white = graded), ↑ ↓ to reorder, Delete; Qualifier - Pick then click a colour in the monitor to select its hue, saturation and luma, then tune the ranges; and Mask - pick a shape and drag it on the monitor (inside moves it, the handles resize it, the knob rotates it, Shift snaps to 15°; on a poly or bezier, Ctrl-click adds a point and double-click removes one), or Draw a free-hand outline on the monitor (it becomes a bezier). ◆ Key keys the shape at the playhead; once it has keys, every change to the shape keys.

Wheel colours. A wheel's r, g, b normally carry no brightness: they are a point on the vectorscope's Cb / Cr plane, so pushing a wheel toward a colour moves the picture's trace toward that colour's target. To tint shadows teal by about 0.03: lift: [-0.034, 0.008, 0.012, 0] (r = 1.5748·Cr, g = −0.1873·Cb − 0.4681·Cr, b = 1.8556·Cb, with Cb = 0.0065, Cr = −0.0216 here). Small values go a long way - ±0.02…0.05 on lift and offset, ±0.05…0.15 on gamma and gain.

Agents set a grade with the patch op setGrade and check it with fablecut_scopes:

  • {op:"setGrade", id:"c_a", grade:{exposure:0.3, temp:-15, contrast:1.15}} - merges into the clip's grade key by key; null on a key resets it; replace:true starts from neutral; grade:null clears it; ids:[…] grades several clips at once. curves merges per channel: grade:{curves:{r:[[0.5, 0.55]]}} keeps the other channels, curves:{y:null} removes the luma curve. layers replaces the whole layer list. Unknown keys or bad values refuse the whole patch. Locks apply (force:true as elsewhere).
  • {op:"setGradeLayer", id, layer, set:{…}} edits one layer: layer is an index (0 = first) or a name. A name that isn't there yet - or the index one past the end - adds a layer. set takes any layer key and merges like setGrade; qualifier and mask also merge key by key (mask:{x:0.6} moves it, qualifier:{luma:null} drops the luma range). replace:true starts the layer from scratch (keeping its name), remove:true deletes it. ids:[…] works too.
  • fablecut_scopes {time} renders the graded frame at time (default: the playhead) exactly as export would - an open editor tab, else headless - and returns numbers: luma min / 1st percentile / median / mean / 99th percentile / max (0–1), the % of pixels at pure black and pure white, mean R/G/B, average saturation, and the midtones' colour cast (hue name, hue angle, strength; "neutral" below 0.01), plus the clips on screen and their grades. With an exportFrame it measures the delivered crop.
  • fablecut_scopes {time, matte:{clip, layer}} also measures what one layer selects: the matte's coverage (% of that clip's own picture, measured alone - other clips and adjustment layers don't count) and the levels, mean RGB, saturation and cast of the selected pixels after grading. A coverage near 0 means the qualifier or mask misses; check it before trusting a secondary.

Reading the numbers: a normally exposed shot has its median near 0.35–0.5; whitePct above ~1 means clipped highlights (lower highlights / whites, or add highSoft); blackPct above ~2 means crushed shadows. A cast strength above ~0.03 on a scene that should be neutral wants white balance: move temp against the cast (orange / yellow → lower temp; blue / cyan → raise it) and tint against green / magenta, then measure again.

Secondary workflow: grade the whole shot first (primary), then add a layer for the one thing that needs its own correction - e.g. skin: {op:"setGradeLayer", id, layer:"Skin", set:{qualifier:{hue:[25, 40, 20], sat:[0.12, 0.7, 0.1]}, saturation:92}}, then fablecut_scopes {matte:{clip:id, layer:0}} - expect a coverage that matches how much of the frame is skin and a cast near orange (hue ~25–35°). A sky: qualifier:{hue:[210, 50, 25], luma:[0.45, 1, 0.1]} with hueSat:[[210, 1.25]]. A vignette or a relight: a feathered ellipse mask with invert:true and exposure:-0.5, or without invert and exposure:+0.3 on a face; give it keys to follow a move.

Workflow for matching shots: grade the hero shot, measure it, then grade every other shot of the scene until its median and cast land near the hero's. In the editor, Copy / Paste on the Color tab pastes one clip's grade onto every selected clip.

diff --git a/docs/docs/compositing/index.html b/docs/docs/compositing/index.html index 695e436e7..748d4d3f8 100644 --- a/docs/docs/compositing/index.html +++ b/docs/docs/compositing/index.html @@ -82,7 +82,7 @@

Track mattes and blending

Cut a clip with the picture on another track by its alpha or its brightness, and lay clips over each other with blend modes, from the Inspector or from an agent with setMatte.

A track matte cuts a clip with the picture on another track: where that picture is opaque (alpha) or bright (luma), the clip shows. Set it on the clip being cut, the fill:

propdoes
mattealpha · alpha-inverted · luma · luma-inverted. Alpha keeps the clip where the matte's pixels are opaque, luma where they are bright (white = shows, black = gone, Rec. 709 weights). The inverted modes keep the opposite
matteTrackthe video track the matte comes from. Default: the video track directly above the clip (V2 for a clip on V1)

The matte track does not draw into the frame while a clip on screen uses it; it only cuts. Its clips keep their own transform, keyframes, opacity, masks and effects, so the matte can move, scale and animate on its own. When the matte track has nothing at that moment, alpha / luma show nothing of the clip and the inverted modes show all of it. Track mattes and masks combine: the matte cuts the clip, then its masks cut what is left, then opacity and blend composite it. A clip used as a matte is drawn without its own track matte. Audio clips take neither.

blend is how a clip lays over what is under it: normal · multiply · screen · overlay · darken · lighten · color-dodge · color-burn · hard-light · soft-light · difference · exclusion · hue · saturation · color · luminosity · lighter (add). Blending happens after masks and mattes, so a masked clip only blends where it is kept.

In the editor, Track matte and Matte track sit under Blend in the Inspector's Transform section (the Adjustment layer section for an adjustment layer). The timeline marks a clip with a track matte ◐ and shows the clips that serve as its matte hatched, labelled Matte.

Agents: {op:"setMatte", id, matte:"luma"} (or ids:[…]; track:"V3" picks the matte track, track:null goes back to the one above; matte:null removes it). blend, matte and matteTrack written through addClip / updateClip are validated too. fablecut_scopes lists each clip on screen with its matte (e.g. luma from V2), blend, and whether it is a matte itself.

Recipes: text filled with video - the text on V2, the video on V1 with matte:"alpha"; a shape reveal - an svg or a masked solid on V2 whose scale keys up, the shot on V1 with matte:"alpha"; light leaks / film burn on V2 with blend:"screen"; a grade only in the bright areas - an adjustment layer with matte:"luma" over a copy of the shot; a cut-out through a texture - luma-inverted against a black-and-white texture.

diff --git a/docs/docs/compositions/index.html b/docs/docs/compositions/index.html index ed0eefe2e..7f602915f 100644 --- a/docs/docs/compositions/index.html +++ b/docs/docs/compositions/index.html @@ -95,7 +95,7 @@

Compositions (nested sequences)

"props": { "fit": "none", "y": 220 } } ]
keydefaultdoes
id · name- · the idhow clips and agents refer to it · the label shown on its clips and in the bin
width · heightthe project'sthe comp's frame, px (16…8192)
duration-seconds; what the comp shows past its clips is transparent (or its background)
backgroundnonea colour behind the comp's clips; leave it out for transparent
tracksV3…V1, A1, A2the comp's own lanes, like the project's tracks
clips[]ordinary clips of any kind (comp clips too), with times inside the comp
template-set on a placed template: {id, hold, fields} (see Presets and templates)

A comp clip (kind:"comp", compId, no mediaId) shows the comp from its in (comp seconds) for its duration, at speed 1. It draws like a picture of the comp's size: fit defaults to none (the comp's own pixels), and its transform, keyframes, opacity, transitions, masks, track matte, blend, grade and filters all apply to the comp's frame as a whole. Trims and splits move its in like a video clip's; the window can't run past the comp's length.

The media inside a comp plays and exports as if it were on the timeline: its video frames, and its audio, which goes through the main timeline's audio track of the same name (its fader, effects and bus). A comp clip that is disabled, or sits on a disabled track, silences the comp's audio too. Comps nest up to 4 deep, and a comp can never contain itself.

In the editor: the bin's Project tab lists the comps; drag one onto the timeline to place it, and double-click it (or a comp clip, or Open in the Inspector's Composition section) to open it. An open comp takes over the timeline: every tool, shortcut and inspector works on its clips, and the breadcrumb above the timeline (or Esc, once nothing is selected) goes back out. Right-click clips → Precompose moves them into a new comp and puts a comp clip in their place; right-click the Project tab → New composition starts an empty one. The Composition section also sets the comp's name, size, length and background.

Agents:

  • {op:"addComp", comp:{id?, name, duration, width?, height?, background?, tracks?, clips?:[…]}} adds one (its clips go through the same checks as addClip). {op:"updateComp", id, set:{name?, width?, height?, duration?, background?, tracks?}} changes it; {op:"removeComp", id} is refused while a clip still uses it.
  • Place it with addClip {kind:"comp", compId, track, start, duration, in?}.
  • {op:"inComp", comp, ops:[…]} runs clip and timeline ops on the comp's own clips: addClip, updateClip, removeClip, split, rippleDelete, the trims, setShape, setMask, setGrade, setParent, setMotionPath, setTextPath, clip setFx, precompose, and inComp for a comp inside it.
  • {op:"precompose", ids:[…], name?, id?} moves those clips (here, or in the comp an inComp is running in) into a new comp that starts at the earliest of them; a comp clip of the same length takes their place.
  • The compact view shows a comp clip as comp(lt in:1.5) and lists every comp under COMPS with its clips.

Recipes: reusable lower third - a template (next section) gives every speaker their own copy with their own name; a plain comp suits a graphic that is the same every time; logo sting - a draw-on logo comp at the head and tail of the edit; picture in picture of a whole scene - precompose the scene's clips, then scale the comp clip down and move it into a corner; one grade for a sequence - precompose it and grade the comp clip once.

diff --git a/docs/docs/editing/index.html b/docs/docs/editing/index.html index 10ea8177c..7f79780da 100644 --- a/docs/docs/editing/index.html +++ b/docs/docs/editing/index.html @@ -82,7 +82,7 @@

Editing rules

How tracks, links, locks, targeting and the trim tools behave, for people and agents alike.

  • Rendering order: V1 is drawn first, then V2, V3, … on top. SVG/image/text clips go on any V track (higher V lanes are handy overlay lanes). Add lanes with the timeline +V / +A buttons (or by listing them in tracks); up to 16 per kind. Right-click an empty track header → Remove track (disabled if the lane has clips or is the last video/audio track).
  • Audio tracks A1–An hold both standalone audio files and linked companions for imported video. Dropping a video creates the picture on a V track (props.volume: 0 so it isn't doubled) plus one kind:"audio" clip per source channel on consecutive A-tracks that share a linkGroup (and the same mediaId / timing). Each stem is mono-isolated then placed with pan (defaults preserve stereo: L −1, R +1). Standalone music/SFX also live on A-tracks. Linked partners move/trim/split together - edit timing on any member of the group; do not treat A-tracks as music-only.
  • Three track switches (Premiere-style), all in the track header and all persisted on project.json:
    • Enable (eye / speaker) → disabledTracks. Output only: a disabled lane is left out of preview, audio and export. It does not affect editing.
    • Target (click the track name - lit = targeted) → untargetedTracks. Decides which lanes an edit touches when nothing is selected: split at playhead (S), insert ripple (,), replace punches (.), ripple-delete shifting (⇧Del), close gap (⇧G), next gap (G), split / trim at IN/OUT (T / ⇧T) and jump to cut (↑ / ↓). Source placement follows targeting too: the picture lands on V1 if it is targeted, else the lowest targeted video lane (none → the edit lands audio-only); stems land on the first two targeted audio lanes. A selection is always edited wherever it sits.
    • Lock (padlock) → lockedTracks. Nothing on a locked lane can be moved, trimmed, split, deleted or edited in the inspector, and ripples leave it where it is while the other lanes shift. A locked lane is never an edit target. Typical use: lock the music bed, then ripple the picture freely.
  • Clip lock / enable - right-click a clip, or use the toggles at the top of the inspector. locked: true pins one clip the same way a locked lane does. disabled: true (⇧E) keeps the clip on the timeline but drops it from preview, audio and export - like a disabled lane, for a single clip. Both apply to the clip's whole linked group.
  • Locks and linked groups - a linked A/V group with any locked member (its own flag or its lane) counts as locked as a whole, so sync is never broken by a partial move.
  • Sync lock - edits that shift clips move the targeted lanes; linked AV partners always ride along, even on an untargeted lane, and locked groups stay put. On reload relinkClips rebuilds linkGroup from matching mediaId / start / in / duration.
  • Unlink / link (Ctrl/Cmd+L) - unlinking a group removes its linkGroup and stamps unlinked: true on each member, so the reload-time relink leaves them apart; picture and audio then move, trim and delete separately. Link (select one video clip plus its audio, Ctrl/Cmd+L) only joins clips of the same file that line up exactly - same start, in and duration - because a link here means identical timing.
  • Agents and locks - fablecut_patch_project refuses updateClip / removeClip on locked material (own flag, locked lane, or a linked partner of one) and addClip onto a locked lane. Treat locked clips as the user's finished work: leave them alone. Only when the user asks you to change one, pass force: true on that op, or unlock first with updateClip set:{locked:null} (always allowed). fablecut_set_project, REST PUT and direct file edits are not guarded - respect locks there too.
  • Media is fit-ted to the canvas (default "contain"), then crop → scale/x/y/ rotation → flips apply.
  • props keys are all optional - missing keys get the defaults above.
  • Video/audio clips must satisfy in + duration×speed ≤ media.duration.
  • Keyframes fully override the static prop value while present; they are clip-local and are re-based automatically when clips are split or trimmed.
  • Transitions modulate the evaluated props (fade also fades audio); they render on top of keyframes, so both can coexist.
  • Same-track overlap IS the crossfade idiom: overlap A and B by ~1 s and give B transitionIn: {type:"fade"} (for audio also A transitionOut, both with curve:"power" - see Audio mix).
  • A cut/split is just two clips: first with duration: t, second with start: +t, in: +t×speed, duration: rest.
  • Edit tools (timeline toolbar picker, or V / B / R / Y / U) change what a clip drag does. Agents run the same edits with the patch ops rippleTrim, roll, slip and slide (see Timeline edit ops).
    • Selection (V) - move and trim, as always.
    • Ripple edit (B) - drag a clip edge; everything after it on the targeted tracks (and the clip's own lanes) moves with it, so no gap opens or closes. Dragging a head keeps the clip's start and trims its source In.
    • Rolling edit (R) - drag a cut; the clip on one side lengthens by what the other loses, nothing else moves.
    • Slip (Y) - drag a clip to change its source In only (dragging left shows later source); position and length stay. Video / audio clips only.
    • Slide (U) - drag a clip along its track; the clip before it trims its tail and the clip after it its head, so the sequence length stays. All four are clamped to the available source media, MIN_DUR and the free room on the track, take linked partners with them, and refuse on locked clips; a readout by the pointer shows the offset while dragging.
  • Lift (;) / Extract (') - remove IN→OUT on the targeted tracks. Lift leaves the gap; Extract closes it. Linked partners are cut too, locked clips stay whole, and IN / OUT clear afterwards.
  • Jump to cut - ↑ / ↓ move the playhead to the previous / next clip In or Out. Selection first (that clip’s start then end); no selection walks targeted-track cuts. Source monitor: 0 / In / Out / duration. Does not change project.json.
  • bgRemove and chromaKey can combine with all filters; heavy pixel work is automatic (only runs when those props are set).
diff --git a/docs/docs/export/index.html b/docs/docs/export/index.html index b6d60700d..456013dc9 100644 --- a/docs/docs/export/index.html +++ b/docs/docs/export/index.html @@ -128,7 +128,7 @@

Export

} }

Export is one ffmpeg pass. The server owns the input side and the output path; args is everything in between (plus JPEG color conversion derived from color):

ffmpeg -y -f image2pipe -framerate <fps> -i - [-i audio.wav] <jpeg-color> <args…> exports/<name><extension>
  • There is no allow-list. Any codec, filter, container or flag your local ffmpeg supports works - ProRes, DNxHD, NVENC/QSV/VideoToolbox, VP9/AV1, 10-bit, HDR tags. See the shipped prores422, broadcast1080i50, nvenc-h264, nvenc-hevc, videotoolbox-h264 and videotoolbox-hevc profiles (the NVENC ones need an NVIDIA GPU; VideoToolbox requires macOS / Apple Silicon).
  • Args are validated by ffmpeg itself, not by a schema: when an export starts the server dry-runs the profile against a 0.1 s synthetic input (lavfi). A typo or an encoder your build lacks is rejected up front with ffmpeg's own message, instead of failing after every frame has been rendered.
  • Use the array form - each element is passed to spawn untouched, so no quoting is needed (["-vf", "drawtext=text='hi there'"] just works). A plain string is accepted and split on whitespace.
  • color controls JPEG→YUV conversion and stream tags (-colorspace / -color_primaries / -color_trc / -color_range). Default is BT.709 limited (range: "tv"). Use "range": "pc" for full-range masters. Do not put those flags in args - the engine strips them and applies color so vf and tags stay aligned. -pix_fmt stays in args (sampling / bit depth only).
  • Nothing else is injected for you: +faststart, -shortest, -strict -2 for Opus in MP4 and pixel-format choices are all yours to write.
  • Frames arrive as JPEG (4:2:0), so yuv422p/yuv444p cannot recover chroma the source never had; raise jpegQuality before reaching for a wider pixel format. Optional pixelFormat:"rgba" on /api/export/begin pipes uncompressed canvas frames instead (-f rawvideo) when a caller wants full chroma.
  • The audio mix is only present when the timeline has audio; with no audio there is a single input, so avoid hardcoded -map 1:a.

Note: Fast export pipes composited JPEG frames from the browser (-f image2pipe), not -i source.mp4. Filters and codec settings apply to that frame stream. To transcode an existing file verbatim, run ffmpeg directly - that is outside the compositor path.

Encoding profiles are listed at the bottom of the Export dialog's Preset list.

What the Export dialog opens on (priority):

  1. project.delivery, then project.encodeProfile - set with setProject
  2. The last preset or profile used in this browser
  3. The master delivery preset

MCP: fablecut_encode_profiles lists profiles; {detail:true} includes each args array; {profile:"hq"} returns one profile. fablecut_status shows the effective profile.

diff --git a/docs/docs/frames/index.html b/docs/docs/frames/index.html index 2eb82afbc..a55890fa7 100644 --- a/docs/docs/frames/index.html +++ b/docs/docs/frames/index.html @@ -82,7 +82,7 @@

Look at the footage

Show an agent what the footage holds: one frame, a contact sheet across a clip, or the composed timeline - as an image, or as text-only measurements for models without vision.

fablecut_analyze_reference gives you the ears - where the cuts are, how hard each shot hits. fablecut_frame gives you the eyes. It answers with a real image (an MCP image content block), so you can judge a shot instead of inferring it from an energy value.

callreturns
{path:"/media/x.mp4", t:3.2}that exact frame
{path:"/media/x.mp4", frames:12}a 4×3 contact sheet across the whole clip
{path:"/media/x.mp4", frames:12, from:30, to:90}a contact sheet across part of it
{time:8.5} (no path)the composed timeline at 8.5 s, graded, all tracks
{path} with an absolute paththe file is read in place without copying into media/
{path, text:true}text-only statistics (luma, colors, texture, saturation, motion) for non-vision agents

Each answer leads with a text line naming the source, the timestamp(s) and (in timeline mode) the clips on screen, so you always know what you are looking at. width sets the pixel width (default 768 for one frame, 320 per contact-sheet cell); text:true returns descriptive statistics instead of an image block, for agents without vision capability - luma levels (min, p1, median, mean, p99, max, all 0–1 like fablecut_scopes), dominant colors, texture, saturation and per-cell motion; where/timeout apply to timeline mode only.

The REST endpoint /api/frame accepts src, t, frames, from, to, w, q (JPEG quality 1–31) and text=1 (statistics mode) as query parameters.

When it pays. Before choosing a clip's in point, sample a few candidate moments - the blueprint tells you a shot spans 2.1 s–4.9 s and reads energy: 88, but only a frame tells you whether that is a car jump or a pan across a landscape. Contact sheets are the cheap survey: one call shows you what a whole 3-minute clip holds, then you grab single frames where it matters. Timeline mode answers "what did I actually build?" - the same picture the user sees and export renders, grades and transitions included.

Needs ffmpeg on PATH for the source modes. Timeline mode runs in the open editor tab, else a headless browser, like fablecut_export.

diff --git a/docs/docs/masks/index.html b/docs/docs/masks/index.html index 7244d8676..93535cc76 100644 --- a/docs/docs/masks/index.html +++ b/docs/docs/masks/index.html @@ -88,7 +88,7 @@

Masks

"keys": [{ "t": 0, "x": 0.3 }, { "t": 2, "x": 0.6, "ease": "linear" }] } ]
keydefaultdoes
shape-rect · ellipse · bezier (write freehand with a stroke to have one drawn for you)
x · y0.5centre, as fractions of the clip's picture (0…1, y down)
w · h0.5size, fractions of the picture's width / height (rect, ellipse)
points-bezier: 3–64 anchors around x, y, each [dx, dy] (a corner) or [dx, dy, inX, inY, outX, outY] (with curve handles relative to the anchor), all fractions of the picture's width / height
stroke-freehand only: [[u, v], …] picture fractions along an outline; it is simplified and stored as an editable bezier
scale · rotation1 · 0about the centre; degrees clockwise
modeaddhow this mask combines with the ones before it: add · subtract · intersect · difference
invertfalseuse everything outside the shape
opacity10…1, how strongly this mask counts
feather0soft edge, project pixels, centred on the outline
expand0grow (+) or shrink (−) the outline, project pixels
name · on-a label; on:false turns the mask off
keys-animate it: [{t, x?, y?, w?, h?, scale?, rotation?, feather?, expand?, opacity?, points?, ease?}], t in seconds from the clip's start; each param eases between the keys that set it (ease on the arriving key, as for clip keyframes). points keys morph the outline and need the shape's point count

Masks combine bottom-up (first in the list first). The first one starts from nothing when it adds and from the whole picture otherwise, so a lone subtract cuts a hole in a full picture. At most 8 masks per clip.

The picture a mask lives in is the clip's drawn rectangle for video, image and svg (after fit and crop), the text block for text, and the whole canvas for an adjustment layer. Masks follow the clip when it is moved, scaled, rotated or flipped, and keep the clip's keyframes.

In the editor, the Masks section of the Inspector has + Rect, + Ellipse, Pen (click points on the monitor, drag while placing one to pull curve handles, click the first point or press Enter to close) and Draw (drag a free-hand outline). Matte shows the clip's matte in the monitor (white = visible). Pick a mask's chip to edit it: mode, Invert, the sliders, ↑ ↓ to reorder, Copy, Delete, and on the monitor, drag inside to move it, the edge handles to resize it and the knob to rotate it (Shift snaps to 15°). On a bezier, drag a point to move it, drag its handles to curve it (Alt breaks the pair), Alt-drag a point to pull fresh handles, Ctrl-click the outline to add a point, and double-click a point to remove it. ◆ Key keys the whole mask at the playhead; once it has keys, every change keys. Esc steps back (point, then mask).

Agents edit masks with patch ops:

  • {op:"setMask", id, set:{shape:"ellipse", x:0.5, y:0.45, w:0.4, h:0.7, feather:40}} adds a mask (no mask, an index one past the end or a new name adds one; a new mask needs shape). {op:"setMask", id, mask:"Subject", set:{x:0.6}} edits one, by index (0 = first) or name, merging key by key (null resets a key). replace:true starts it over, keeping its name. ids:[…] edits several clips.
  • A drawn outline: set:{shape:"freehand", stroke:[[0.4, 0.3], [0.6, 0.32], …]}. It is stored as an editable bezier.
  • {op:"setMaskKeys", id, mask, keys:[{t:0, x:0.3}, {t:2, x:0.7}]} animates one (keys:null stops it); {op:"removeMask", id, mask} deletes one.
  • props.masks written through addClip / updateClip is validated the same way. Bad keys, shapes or values refuse the whole patch. Locks apply (force:true as elsewhere).
  • fablecut_scopes {time, mask:{clip}} measures them: the % of the clip's picture its masks keep (the feathered matte, measured alone) and the % of the frame the masked clip covers. The compact project view lists each clip's masks as [2 masks: ellipse feather 40, rect subtract].

Recipes: spotlight - a feathered ellipse on the clip; split screen - two clips on V1 / V2, a rect on the top one covering its half; cut a logo out of the background - a bezier around it, feather 2–4; reveal - a rect whose w (or x) keys from 0 to full; effects only on the face - an adjustment layer with a feathered ellipse, keyed to follow it; vignette through an adjustment layer - an inverted ellipse with feather:200 and the layer's brightness down.

diff --git a/docs/docs/media/index.html b/docs/docs/media/index.html index 6a17c3996..3d924a60b 100644 --- a/docs/docs/media/index.html +++ b/docs/docs/media/index.html @@ -82,7 +82,7 @@

Media management

File details, search, filters, sorting, tags and collections, where each file is used, relinking missing files, and proxies for heavy footage.

The Project bin knows each file's details and helps find, group and track footage. The bin's organizing (details, favorites, tags, collections, search) changes nothing that plays or exports; moving and trashing the files themselves ("Files on disk" below) does what it says.

Metadata. The editor reads every file in media/ and library/ with ffprobe (via GET /api/media-info) and writes what it finds onto the media entry. These fields are read-only - they describe the file:

keydoes
fpsvideo frame rate (29.97, 25, 59.94 …); absent for stills and audio
codecvideo codec (h264, hevc, prores, vp9 …), or the image format (png, mjpeg)
audioCodec · audioChannels · sampleRatefirst audio stream: codec, channel count (0 = the file has no audio), Hz
size · bitratefile size in bytes · overall bitrate, bits per second
width · height · durationas before; filled in when missing (phone footage shot rotated reports its upright size)

Without ffprobe on PATH only size is filled in; the browser still probes duration, width and height.

Organizing. favorite: true stars a file; tags is a list of free-form labels (at most 24, each up to 32 characters, matched without regard to case). collections at the top of the document group media across folders - a file can be in any number of them, while it sits in one folder (folderId).

Usage. A file's placements are the clips that show it, on the main timeline and inside every composition. A video and the audio stems linked to it count as one placement, so a shot used twice reads "used 2×".

In the editor, the Project tab has:

  • Search - every word must match the name, kind, extension, codec, resolution (3840x2160, 2160p) or a tag; #word matches tags only. Esc clears it.
  • Show - All media · ★ Favorites · Used in the edit · Unused · a kind · a collection · a tag. While searching or filtering, the bin lists the hits flat (each with its folder), with a count and Clear; a collection's view also has Rename and Delete (its media stay).
  • Sort - name (natural: shot 2 before shot 10), kind, duration, resolution, frame rate, codec, audio channels, file size or times used, with ↑ / ↓. Files missing a value sort last either way. Folders keep their tree; the sort applies inside each.
  • ☰ List view - one row per file with columns: name, duration, resolution, FPS, codec, audio, size and uses; click a column heading to sort by it. On a narrow bin the columns drop out right to left; widen the panel to see them all.
  • On each file: ☆ stars it, the uses badge opens its placements. Right-click a file → Open in Source, Find timeline instances (every placement, main timeline and comps, with track and time - click one to jump there, opening its comp if needed), Media info…, favorites, Tags…, Add to / Remove from a collection, New collection…, Remove from project.
  • Right-click a clip on the timeline → Reveal in project scrolls the bin to its file (or its comp), opening folders and clearing a search that hides it.

Offline media. A file is offline when its src names nothing under media/ or library/ - it was moved, renamed or deleted. The editor checks on load and whenever those folders change. An offline file's clips stay where they are: the timeline hatches them red (⚠ Offline), the monitor and the export draw a Media offline slate in the picture's place, and its audio is silent. The bin marks the file OFFLINE, says how many are missing, and the Show filter gains ⚠ Offline. The Export dialog warns before rendering one. Files under media/ may sit in subfolders (/media/archive/a.mp4).

  • Relink points a media entry at the same footage where it is now; clips keep their In points, edits and everything else. Right-click the file → Relink… (or Relink… on the offline banner for all of them). The dialog looks through media/ and library/ for each file - same name, the same name with another extension, a similar name, the same size - and picks a same-name match for you. Browse… picks one file and Choose folder… matches a whole folder by name; either copies the chosen files into media/. A relinked file whose length differs from the original gets a warning (is it really the same footage?).
  • Replace file… (right-click a file) puts a different file behind the media entry - a new render, a better take. Every clip using it switches; each keeps its In point and timing, trimmed to fit a shorter file. The name and details follow the new file; favorites, tags and collections stay. To swap the file of one clip only, use the Inspector's Source menu instead.
  • Relink and replace are one undo step each.

Proxies. Heavy footage - 4K, HEVC, ProRes, long phone clips - can stutter while you scrub and play. A proxy is a light copy the editor plays instead while you edit: H.264 at 540p (or 720p / 1080p, never larger than the source), a keyframe every 12 frames so seeking is quick, the source's own timestamps (frame for frame - no frames added or dropped) and its first audio stream. The edit always refers to the original: the timeline, project.json and every clip stay the same whether proxies are on or off.

Export always reads the originals, and so do fablecut_frame (timeline mode), fablecut_scopes, tracking and every other measurement - the players switch to the original files for the render and back afterwards. A proxy only changes how smoothly the preview runs, never the result.

  • Right-click a video in the bin → Create proxy (540p) / (720p); right-click the Project tab → Create proxies for N videos. ffmpeg makes them on the server one at a time in the background; the bin shows each file's progress (P 42%), then a green P once it is ready. Delete proxy removes one. The bin's list view has a Proxy column, Show has Has a proxy / Video without a proxy, and Media info says which file is playing.
  • The monitor's Proxy button turns proxy playback on and off (on by default; remembered in this browser). The Source monitor follows it too.
  • Proxies live in analysis/proxies/, a disposable cache: each is named after its source file and that file's size and modification time, so a re-rendered or replaced original simply has no proxy until you make a new one. Deleting the folder loses nothing but time. Proxies need ffmpeg.

Agents:

  • {op:"updateMedia", id | ids, set:{name?, favorite?, tags?, folderId?}, addTags?, removeTags?} - organize files (favorite:false unstars; tags:[] clears). Metadata keys are refused: they come from the file.
  • {op:"setCollection", id?, name?, media?, add?, remove?} creates a collection (a new id, or a name no collection has) or changes one: media replaces its list, add / remove edit it. {op:"removeCollection", id} deletes it; its media stay. removeMedia takes a file out of every collection.
  • The compact view lists each file with its metadata, ★, tags, folder and uses:N, and the collections on one line: m_abc video "intro.mp4" 12.4s 1920×1080 29.97 fps h264 stereo 48 kHz 45 MB ★ #interview uses:2.
  • fablecut_import_media probes the file as it imports it, so the entry it returns already has these fields.
  • fablecut_status lists offline media, and the compact view marks each OFFLINE (file missing — relinkMedia) and each video with a proxy proxy:540p.
  • fablecut_proxy {} reports every video's proxy; {create:true, mediaIds?, height?} makes them (waits until done unless wait:false); {delete:true, mediaIds?} removes them. Proxies never change what you measure or export, so an agent only needs them when the user asks for smoother playback.
  • {op:"relinkMedia", id, src:"/media/…", name?} - the same footage found elsewhere: put the file in media/ (copy it, or fablecut_import_media and removeMedia the extra entry it registers), then relink. The note warns when the new file's length differs.
  • {op:"replaceMedia", id, src, name?} - a different file behind the entry; clips keep their timing, trimmed to fit (the note says how many). src must be an existing file under /media/ or /library/ of the same kind (an audio entry may use a video container).

Files on disk. The bin's folders (folders, folderId) only organize entries in project.json; the files themselves sit in media/ and may live in subfolders. fablecut_files works on those (or POST /api/files):

  • {action:"list", dir?} (an empty call to the MCP tool lists too) lists one folder: its subfolders and files with sizes and srcs. Dot-folders (media/.trash/) are left out.
  • {action:"mkdir", dir:"b-roll/day 1"} makes a folder (and its parents).
  • {action:"move", from, to} moves a file or folder into an existing folder, or to a new path (a rename); to is required ("/media/" is the top of media/). Every project's media entries that point at a moved file are repointed (the open project gets a new revision, so the editor reloads), a media name that was the old file name follows it, and the file's transcript goes with it (a warning says when one couldn't be). The move is refused while a project can't be read (force:true moves anyway, and the file goes offline there), and a project edited meanwhile stops it (CONFLICT, try again). If a project can't be written, the move is undone; if undoing fails too, the error says where the files are and which project couldn't be put back: check them there and relink. A name that is taken (also one taken while the move runs), and links inside media/, are refused, never replaced.
  • {action:"trash", paths:[…]} moves files or folders into media/.trash/<id>/files/ with a note of where they were; nothing is deleted. A file a project still uses is refused (the reply names the project and how many clips place it): removeMedia it first, or force:true to trash it anyway, and it shows as offline there until it is restored. A project whose project.json can't be read counts as possibly using it, so the same applies. One call can't list a folder and something inside it. When one of several fails, the reply lists the ones already trashed, with their ids, and the path it stopped at. {action:"trash-list"} lists the trash, {action:"restore", id} puts one back where it was (refused while something else has that name; a warning says when its trash entry couldn't be cleaned up).
  • Move, rename and trash only when the user asked: they change the user's folder. Versions keep the paths they were saved with, so restoring an old version after a move may need Relink.
diff --git a/docs/docs/motion-paths/index.html b/docs/docs/motion-paths/index.html index fb743128a..79cf67ac5 100644 --- a/docs/docs/motion-paths/index.html +++ b/docs/docs/motion-paths/index.html @@ -87,7 +87,7 @@

Motion paths, motion blur and text on a path

"textPath": { "type": "ellipse", "w": 300, "h": 300 }, "pathAlign": "start" }, "keyframes": { "pathOffset": [ { "t": 0, "v": 0 }, { "t": 6, "v": 100, "ease": "linear" } ] } }

In the editor: when the selected clip has two or more position keys, its path shows on the monitor: the curve, a dot per frame (their spacing is the speed), a square per key and the keys' handles. Drag a key to move it, drag a handle to bend the path (Alt breaks the pair), Alt-drag a key to pull new handles, and double-click a key to make it a corner again. Moving the clip on the monitor or typing X / Y keys both channels together. The Inspector's Motion section has Smooth (handles through every position key), Straight, Auto-orient, Motion blur and Blur samples. A title's Text path section sets it on a Line, Arc, Circle, Wave or a Pen path (click points, drag to curve, Enter to finish, click the first point to close it). Edit path shows the path's points on the monitor, and Offset and Align place the text along it.

Agents:

Recipes: fly-in on a curve - two position keys, setMotionPath smooth, autoOrient:true, motionBlur:180; orbiting label - circle textPath, pathOffset keyed 0 → 100 linear; stamp along a road - an open path textPath that follows the shape in the footage, pathAlign:"center", textAnim:"letter-pop"; whip without the transition - a fast x move over 4–6 frames with motionBlur:360.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/motion/index.html b/docs/docs/motion/index.html index 3bf6fb35f..40180d0a5 100644 --- a/docs/docs/motion/index.html +++ b/docs/docs/motion/index.html @@ -92,7 +92,7 @@

Shapes, nulls and parenting

"keys": [ { "t": 0, "rotation": 0 }, { "t": 5, "rotation": 360, "ease": "linear" } ] } ] } }
keydefaultdoes
typerectrect · ellipse · polygon · star · line · path · group
x · y0position in layer px, from the layer's origin (the clip's x/y, y down)
rotation · scale · opacity0 · 1 · 1about the item's own x, y
w · h200size, px (rect, ellipse, polygon, star)
radius0rect corner radius, px
sides · inner6 / 5 · 0.5polygon / star point count (3–64); a star's inner radius as a fraction of the outer
points-line: exactly 2 · path: 2–128 points [x, y] or [x, y, inX, inY, outX, outY] (curve handles relative to the point), px around the item's x, y
closedtruepath only; false leaves it open (lines are always open)
fill · stroke#ffffff · none"#rrggbb", "#rrggbbaa" or "none"; lines and open paths default to a white stroke and no fill
strokeWidth6 (8 open)px; set with stroke
lineCap · lineJoinround · roundbutt · round · square / miter · round · bevel
dash-[on, off, …] px, e.g. [24, 12]
trimStart · trimEnd0 · 100the part of the outline drawn, % - key trimEnd 0→100 to draw a path on
trimOffset0% of the outline the drawn part is shifted round by (key it to make a dash run round a loop)
items-group only: its items. A group moves, turns, scales, fades and trims them together (groups nest 4 deep)
name · on-a label (agents address items by it); on:false hides it
keys-[{t, ease?, …}], t in seconds from the clip's start. Keyable: x y rotation scale opacity w h radius inner strokeWidth trimStart trimEnd trimOffset fill stroke points. Each value eases between the keys that set it (ease on the arriving key); colours blend; points keys morph the path and need its point count

At most 64 items per layer (group children included). The layer itself is a normal visual clip: its x, y, scale, rotation, opacity, blend, masks, transitions and keyframes all work, as do blur and shake. Its own trimStart / trimEnd / trimOffset (clip props, keyframable) trim every path in it at once. A trimmed shape fills the part that is drawn.

Null objects. kind:"null" (no mediaId) is a clip that never renders. Give it x, y, rotation, scale (and keyframes), and parent clips to it to move them as one. The monitor shows it as a red square while it is on screen.

Parenting. "parent": "<clip id>" (top-level, next to track) makes a clip move, turn and scale with that clip. Its own x/y are then measured in the parent's space: from the parent's centre, turned and scaled with it. Parents chain (a parent can have a parent), and loops are refused. Only the transform follows: the parent's opacity, transitions, shake and effects do not, and the parent's keyframes are read even outside its time range (held at its first or last value). Splitting a parent leaves the children on the left half.

Anchor point. anchorX / anchorY (px from the picture's centre, for any visual clip) pick the point that x/y place and that rotation and scale turn around: anchorY: 200 on a 400 px tall shape spins it about its bottom edge. Moving the anchor without moving the picture means changing x/y with it (the editor's anchor tool does that).

In the editor: the bin's Shapes tab adds a rectangle, ellipse, polygon, star, line or pen-path layer, or a null object, at the playhead. The Shape layer section lists the items; pick one to edit it - the sliders, Fill / Stroke (colour or None), ends and joins, trim, Group / Ungroup / Out, ↑ ↓, Copy, Delete - and on the monitor drag it to move, the knob to turn it (Shift: 15°) and the corners to resize it. On a line or path, drag points and their handles (Alt breaks the pair, Alt-drag pulls new handles); on a path, Ctrl-click the outline to add a point and double-click one to remove it. Pen draws a new path: click points (drag to curve), click the first point to close it or press Enter to keep it open. Each value has its own ◆: key it at the playhead, and from then on changing it keys it. Every visual clip's Transform section has Anchor (✥ Move: drag on the monitor to move the anchor point while the picture stays put, Shift snaps to the centre; Centre puts it back) and Parent. Right-click clips → Parent to a new null groups them under a fresh null at their centre.

Agents:

Recipes: draw-on logo - the logo as path items with a stroke and no fill, trimEnd keyed 0→100 (stagger the items' keys), then fill keyed from "#ffffff00" to "#ffffff"; lower third - a rect bar whose w keys from 0, a line drawn on under it, a title on the track above parented to the shape layer so they slide out together; loading ring - an ellipse with a stroke, trimEnd: 25, trimOffset keyed 0→100 with ease:"linear"; orbit - a null at the centre with rotation keyed 0→360, a shape parented to it with x: 300; swing from the top - anchorY at the top edge (minus half the height) and rotation keyed −10↔10; burst - a group of lines at different rotations with scale keyed 0→1 and opacity 1→0.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/music/index.html b/docs/docs/music/index.html index 8728de56f..c130dd923 100644 --- a/docs/docs/music/index.html +++ b/docs/docs/music/index.html @@ -80,10 +80,10 @@

Music

Openly licensed music and sound effects from Openverse, each with its licence spelled out; import a track and FableCut keeps its credit for the video's description.

-

The bin's Music tab and fablecut_music find music and sound effects that may be used in a video: openly licensed tracks from Openverse (openverse.org), which indexes Jamendo, Freesound, ccMixter, Wikimedia Commons and more. Results show every licence, not only the free ones, and each result says what its licence allows. FableCut is made with Openverse but isn't endorsed or certified by it. The licence is the artist's, and Openverse doesn't check it, so the person publishing the video is the one who must respect it.

licencelabelmay it go in a video?
cc0 · pdmfree to useyes, any use; no credit needed
bycredityes, any use; credit the artist
by-sacredit · share alikeyes; credit, and the video is shared under CC BY-SA too
by-nc · by-nc-sacredit · non-commercialnot in ads, sponsored or monetized videos; credit (NC-SA: share alike too)
by-nd · by-nc-ndno editsno: Creative Commons counts music set to video as a derivative
sampling+ · nc-sampling+credit · non-commercialparts may be sampled and remixed; the whole track only non-commercially

Search with words about the music (mood, genre, instrument: "chill lo-fi piano"); leave the words out to see the newest tracks. Music comes from the music category, sound effects from Freesound. Lengths are Openverse's: under 30 s, 30 s – 2 min, 2 – 10 min, over 10 min. Without an account Openverse answers 20 results a page, 240 per search and about 20 searches a minute and 200 a day per address. The search runs from the editor tab (or the MCP server) straight to Openverse, and the file goes through the editor server's URL import into media/.

An imported track keeps its licence on its media entry, so the credits can be listed later:

{ "id": "m_x", "name": "Cinematic — Jahzzar", "kind": "audio", "src": "/media/Cinematic%20-%20Jahzzar.mp3",
+    

The bin's Music tab and fablecut_music find music and sound effects that may be used in a video: openly licensed tracks from Openverse (openverse.org), which indexes Jamendo, Freesound, ccMixter, Wikimedia Commons and more. Results show every licence, not only the free ones, and each result says what its licence allows. FableCut is made with Openverse but isn't endorsed or certified by it. The licence is the artist's, and Openverse doesn't check it, so the person publishing the video is the one who must respect it.

licencelabelmay it go in a video?
cc0 · pdmfree to useyes, any use; no credit needed
bycredityes, any use; credit the artist
by-sacredit · share alikeyes; credit, and the video is shared under CC BY-SA too
by-nc · by-nc-sacredit · non-commercialnot in ads, sponsored or monetized videos; credit (NC-SA: share alike too)
by-nd · by-nc-ndno editsno: Creative Commons counts music set to video as a derivative
sampling+credit · non-commercial · samples onlyparts may be sampled and transformed, also commercially (not in ads); the whole track as it is can't be set under a video
nc-sampling+credit · non-commercial · samples onlyparts may be sampled and transformed, non-commercially only; the whole track as it is can't be set under a video

Search with words about the music (mood, genre, instrument: "chill lo-fi piano"); leave the words out to see the newest tracks. Music comes from the music category, sound effects from Freesound. Lengths are Openverse's: under 30 s, 30 s – 2 min, 2 – 10 min, over 10 min. Without an account Openverse answers 20 results a page, 240 per search and about 20 searches a minute and 200 a day per address. The search runs from the editor tab (or the MCP server) straight to Openverse, and the file goes through the editor server's URL import into media/.

An imported track keeps its licence on its media entry, so the credits can be listed later:

{ "id": "m_x", "name": "Cinematic — Jahzzar", "kind": "audio", "src": "/media/Cinematic%20-%20Jahzzar.mp3",
   "license": { "code": "by-sa", "label": "CC BY-SA 3.0", "url": "https://creativecommons.org/licenses/by-sa/3.0/",
     "title": "Cinematic", "creator": "Jahzzar", "page": "https://www.jamendo.com/track/918921",
-    "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } }

The credits are every licensed file the edit uses (main timeline, comps and other sequences; a denoised copy counts as its original), one line each: "Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921, with a warning for a licence that limits the video (non-commercial, share alike, no derivatives). They go in the video's description.

In the editor: the bin's Music tab has the search box, a length, OK to monetize (only licences that allow commercial use and edits), and mood chips to start from. The SFX tab has the same search for sound effects (with chips such as whoosh, impact, riser) above the files in library/sfx/. Each result shows its artist, length, genres, source, a licence badge (green: free to use, blue: credit, amber: non-commercial, red: no edits; hover for what it allows, click for the licence) and a link to its page. ▶ previews it, ⬇ imports it into the Project bin, + (or a double-click) imports it and adds it at the playhead. More results loads the next page. A file's Media info shows its licence and credit with Copy credit, and the Export dialog lists the edit's music credits with Copy. Importing needs the editor server (or Studio).

Agents use fablecut_music:

  • {query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?} searches: 20 tracks a page, each id "title" — artist · m:ss · licence [flags] · genres · source. commercial:true keeps licences that allow commercial use, edits:true leaves out ND; pass both when the video will be monetized.
  • {import:"<track id>"} downloads it into media/ (named "Title - Artist") and registers it with its license; the reply gives the licence, the credit and an addClip to place it. Then fablecut_beats {clipId} finds its tempo, retime cuts to it, and fablecut_auto_duck dips it under speech.
  • {credits:true} lists the edit's credits and licence warnings. fablecut_export adds them to its reply when the edit uses licensed music.
  • Say which licence a track has before the user publishes, and search with commercial:true, edits:true when they plan to monetize. Import what the user picked, or the best fit when they asked you to choose. The compact view shows an imported file's licence:"CC BY 3.0".

Recipes: music under a reel - search the mood with length:"short", import one, place it on A1, fablecut_beats {clipId, retime:{every:2}}; a whoosh on every cut - kind:"sfx", query:"whoosh", import a CC0 one, place it just before each cut; music for a sponsored video - commercial:true, edits:true, and give the user the credits from the reply.

+ "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } }

The credits are every licensed file the edit uses (main timeline, comps and other sequences; a denoised copy counts as its original), one line each: "Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921, with a warning for a licence that limits the video (non-commercial, share alike, no derivatives, samples only), and — changed: noise reduced when the edit plays a denoised copy. They go in the video's description. Replacing a file (Replace file…, replaceMedia) drops its licence; a relink keeps it.

In the editor: the bin's Music tab has the search box, a length, OK to monetize (only licences that allow commercial use and edits), and mood chips to start from. The SFX tab has the same search for sound effects (with chips such as whoosh, impact, riser) above the files in library/sfx/. Each result shows its artist, length, genres, source, a licence badge (green: free to use, blue: credit, amber: non-commercial, red: no edits; hover for what it allows, click for the licence) and a link to its page. ▶ previews it, ⬇ imports it into the Project bin, + (or a double-click) imports it and adds it at the playhead. More results loads the next page. A file's Media info shows its licence and credit with Copy credit, and the Export dialog lists the edit's music credits with Copy. Importing needs the editor server (or Studio).

Agents use fablecut_music:

Recipes: music under a reel - search the mood with length:"short", import one, place it on A1, fablecut_beats {clipId, retime:{every:2}}; a whoosh on every cut - kind:"sfx", query:"whoosh", import a CC0 one, place it just before each cut; music for a sponsored video - commercial:true, edits:true, and give the user the credits from the reply.

Edit this in CLAUDE.md The whole manual as Markdown diff --git a/docs/docs/presets-templates/index.html b/docs/docs/presets-templates/index.html index 701cf3882..ae4b22f30 100644 --- a/docs/docs/presets-templates/index.html +++ b/docs/docs/presets-templates/index.html @@ -88,7 +88,7 @@

Animation presets and templates

{ "key": "name", "label": "Name", "type": "text", "targets": [ "name:props.text" ], "value": "Ava Moreno" }, { "key": "accent", "label": "Accent", "type": "color", "targets": [ "bar:props.shapes.1.fill" ], "value": "#ffd166" } ] } }
templatenamesizelengthfields
lower-third-barLower third - Bar1920×10805 sname title accent panel
lower-third-underlineLower third - Underline1920×10805 sname title accent
lower-third-boxesLower third - Boxes1920×10805 sname title accent box
logo-ringLogo - Ring reveal1920×10804 slogo brand accent
logo-slamLogo - Slam1920×10803.5 slogo accent
logo-linesLogo - Lines1920×10804 slogo tagline lines
social-storyStory - Headline (9:16)1080×19206 sheadline subline button accent background
social-quotePost - Quote (1:1)1080×10806 squote author accent background
social-end-cardEnd card - Follow (16:9)1920×10806 sheading button accent background

Field types: text (a string), color (#rgb, #rrggbb or #rrggbbaa) and media (a media id of a picture: image, svg or video; the clip's kind follows it). A target is "<clip id>:<path>" inside the comp (props.text, props.shapes.1.fill, mediaId, …) or "comp:background"; one field can set several. The logo templates start with a placeholder, /library/elements/logo-placeholder.svg, until the logo field gets a picture. hold is when the exit starts: changing a template's length keeps everything after it at the same distance from the end, so a longer lower third just holds longer (it can't get shorter than its entrance needs).

A saved template (library/templates/<id>.json) is a template object: {id, name, group, width, height, duration, hold, background?, tracks?, clips, media?, fields}; media lists the {id, name, kind, src} entries its clips use (/library/… or /media/…), matched by src when it is placed. A saved preset or template whose name a built-in already has is saved as "<name> (saved)".

In the editor: the bin's Templates tab lists them by group (Lower thirds, Logo animations, Social, then Saved); drag one onto the timeline or click +. The Inspector's Template section on its clip edits the fields, its Length, and offers Use W×H canvas when the template was made for another shape. Right-click a comp in the Project tab → Save as template keeps it (every title's text and every picture become fields). The Motion section's Presets menus (In, Out, At playhead, Loop) put a preset on the selected clips, and Save as preset keeps this clip's keyframes (In: from its start to its last key; Out: from its first key to its end; Loop: the whole clip).

Agents:

Recipes: name every speaker - addTemplate lower-third-bar once per speaker with fields:{name, title}; branded intro - addTemplate logo-ring with fields:{logo:"<your logo's media id>", brand, accent} at 0; vertical teaser - set the canvas to 1080×1920, addTemplate social-story; house style - build a comp the way you like it, saveTemplate, then place it in every project; titles that arrive and leave the same way - applyPreset an In and an Out on every title in one patch.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/projects/index.html b/docs/docs/projects/index.html index 557bd4507..56b5964e3 100644 --- a/docs/docs/projects/index.html +++ b/docs/docs/projects/index.html @@ -82,7 +82,7 @@

Projects

Keep many projects in one FableCut: a dashboard to open, create from a canvas or template, duplicate, rename, take notes on, tag, archive and delete them, and fablecut_projects for agents.

One FableCut keeps any number of projects. ./project.json is always the open project: the editor, every MCP tool, the REST API and scripts read and edit that file as before. The others wait in projects/, and opening one swaps it in:

pathholds
projects/index.json{active} - the open project's id
projects/<id>/meta.json{id, created, opened, archived, notes, tags, template?}
projects/<id>/project.jsonthe document (while that project is open, ./project.json is the live copy)
projects/<id>/thumb.jpgthe editor's last picture of it
library/project-templates/<id>.jsona saved project template {name, created, project}

media/, exports/, analysis/ and library/ are shared by every project, so a duplicate or a project made from a template copies no footage. The first time projects are used, the existing ./project.json becomes the first project, unchanged. Ids look like p_3f9a01c2de.

Opening a project saves the open one into its folder, then copies the chosen one to ./project.json with a revision above both. A save based on the project that was open before (an editor tab, an agent's fablecut_set_project, a baseRevision patch) is therefore refused as a CONFLICT instead of landing in the wrong project. Editor tabs reload, clear their undo history and close an open composition. GET /api/project names the open project in the X-FableCut-Project header, and the editor sends it back on every save, so an edit made for one project can never be written into another.

In the editor: Projects in the top bar (Ctrl/Cmd+O, or a click on the project name) opens the dashboard: cards with a picture, size, frame rate and length; search by name, notes or #tag; sort by last opened, last modified, created or name. Pick one to rename it, write notes, tag it, Open (or double-click / Enter on its card), Duplicate, Save as template or Archive it. Archived lists archived projects, where Unarchive brings one back and Delete… (click twice) removes it; only archived projects can be deleted, and the open one can be neither archived nor deleted. + New project starts one from a canvas (Landscape 16:9 1080p, Vertical 9:16, Square 1:1, Portrait 4:5, 4K UHD, Landscape 720p) or a saved template, with its own frame rate. Import… adds a project file from elsewhere (an old backup, another machine); its media must be in media/, and Relink finds files that moved.

Agents use fablecut_projects (or GET /api/projects, POST /api/projects):

Recipes: one edit, three versions - duplicate the project per client cut, put the brief in notes; house canvas - build an empty project with your tracks, intro and outro, save_template, then new from it for every episode; park finished work - archive delivered projects to keep the list short without deleting anything.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/recipes/index.html b/docs/docs/recipes/index.html index 247c2c39f..770945b92 100644 --- a/docs/docs/recipes/index.html +++ b/docs/docs/recipes/index.html @@ -82,7 +82,7 @@

Recipes

Short answers for common edits: grades, captions, speed ramps, transitions and more, each one a few props away.

Assemble a rough cut#

Clips back-to-back on V1; each start = running sum of previous durations.

Insert / replace at playhead 3-point editing#

Load media into the Source monitor (double-click a bin item or timeline clip), mark the window with I/O, then , (insert icon) splits straddling clips on targeted tracks at the playhead, ripples everything later to the right by the window length, and drops the Source window in - video brings its linked audio stems. . (replace icon) overwrites instead: punches the placement tracks (V1 + linked stems) over [playhead, +window) with no ripple. Placement lanes are resolved against the live track list and follow targeting - if V1 / A1 / A2 were removed or untargeted, the lowest remaining targeted lanes of the right kind are used instead. Locked clips are never punched or split. A locked clip loaded into Source can't be retargeted with . (toast) until it is unlocked. When Source was loaded from a timeline clip, . instead retargets that clip's In/Out (and its linked stems) and ripples later clips on its tracks if the duration changed.

Ripple delete#

Select clip(s), then ⇧Del or the timeline-toolbar Ripple delete - removes the selection (linked partners included) and pulls later clips left on each targeted track to close the gap. Plain Del lifts (leaves a gap). Sync lock applies: linked partners on untargeted tracks move with the ripple, and locked clips are neither deleted nor moved. An unselected clip that merely overlaps the deleted range stays put - its overlap ends up bridging the shifted-in clip, so a crossfade across the cut survives.

Tighten a cut without breaking the rest#

Ripple edit (B) on the tail of the shot that runs long - the rest of the edit follows. To change where a cut falls between two shots without shifting anything else, Rolling edit (R) the cut. To keep a shot's timing but use a better take of the same moment, Slip (Y) it. To pull a whole segment out of the middle: set IN / OUT around it and Extract (').

Jump to cut#

Select a clip, then ↑ / ↓ - playhead snaps to its In, then Out (further taps walk neighboring cuts). No selection → previous / next cut on targeted tracks. Source monitor: same keys jump among 0 / In / Out / duration.

Protect finished work#

Lock the lanes you are done with (lockedTracks, or the padlock), e.g. setProject {lockedTracks:["A3"]} for a music bed. Now insert, ripple delete and close gap re-time the picture without touching it. To try an alternative without deleting a clip, disable it (⇧E / disabled:true).

Title card#

{kind:"text", mediaId:null, track:"V2", props:{text,fontSize,color}}.

Music bed#

Audio file on A1, props.volume: 0.3, trim with in/duration.

Level a voice-over edit#

fablecut_normalize_audio {clipIds:[…every VO clip…], target:-16} so all takes sit at one loudness, then keep the music on its own lane and pull that lane down: {op:"setTrack", id:"A3", set:{gain:-14}}. Then dip it under the voice: fablecut_auto_duck {clipIds:[<music clip>], under:["A1"], amount:-10}.

Cut a montage to the music#

Put the shots on V1 in the order you want (rough lengths are fine) and the music on an audio lane, then fablecut_beats {clipId:<the music>, retime:{every:2}} - each shot gets two beats where its footage allows (fewer when it runs out; clips past the music keep their length; one with less than a beat of footage refuses the re-cut), the cuts land on the beat. every:1 for a fast reel, 4 for a calm one; re-cut the part after the drop separately with retime:{from:<the drop>, every:1}. For an edit whose cuts are already chosen, snap:true just nudges each one onto the nearest beat (cuts on untargeted tracks, beside locked clips, or without spare footage to reach it stay where they are; the reply counts them). Check a cut with fablecut_frame before exporting.

Tighten a talking-head take#

Lock the music lane (setProject {lockedTracks:["A3"]}), then fablecut_silence {clipIds:[<the take>]} to see the pauses (it does the listening; fablecut_frame only shows the picture, handy to check a cut won't land mid-gesture), and fablecut_silence {clipIds:[<the take>], cut:true}. Add {op:"crossfade", ids:[…]} on the new audio cuts if a breath clicks.

Cut an interview down by text#

Lock the music lane, fablecut_transcribe {clipIds:[<the interview>]} to read what was said (name the speech clips, or the music bed is transcribed too), decide what stays, then fablecut_transcribe {clipIds:[<the interview>], find:["the sentence to drop", "and this one"], cut:true}. Then fablecut_silence {clipIds:[…], cut:true} for the pauses that are left.

Caption a talking-head reel#

Finish the cut first, then fablecut_captions {style:"highlight", clipIds:[<the talking-head clips>]} (name the speech clips, or a music bed with vocals gets captioned too), fablecut_frame {time:<mid-sentence>} to check the size and placement, and fablecut_captions {export:"srt"} for the platform's own subtitle upload.

Center a mono stem#

Linked or standalone audio clip with props.pan: 0 (inspector Pan slider, −1…+1). Stereo video stems default to L −1 / R +1; set A1 to 0 to center that channel in the mix.

Cinematic grade#

props.filterPreset: "teal-orange" (tweak with temperature/vignette on top).

Balanced, contrasty base grade then measure with fablecut_scopes#

{op:"setGrade", id, grade:{contrast:1.15, pivot:0.42, shadows:-10, highlights:-20, highSoft:30, saturation:108}}. Teal shadows / warm highlights: add lift:[-0.034, 0.008, 0.012, 0] and gain:[0.04, 0, -0.06, 0]. Film-style S-curve, muted greens, yellows pushed toward orange: grade:{curves:{y:[[0.25, 0.2], [0.75, 0.82]]}, hueSat:[[115, 0.7]], hueHue:[[60, -12]]} - then fablecut_scopes to check the blacks didn't crush. A grade on an adjustment layer over the whole edit = one look for every shot.

Green-screen composite#

Subject clip on V2 with props: {chromaKey:"#00ff00", chromaTolerance:30, chromaSoftness:15}, background footage on V1.

Remove background without a green screen people#

props: {bgRemove:true} - then put anything behind it on V1.

Picture-in-picture#

Clip on V3 with props: {scale:0.35, x:380, y:-200, cornerRadius:24} - add transitionIn: {type:"slide-right", duration:0.5} to fly it in.

Slow motion / timelapse#

props.speed: 0.5 (half speed) or 4 (4×). Remember the source window is duration × speed.

Speed ramp the reel move - fast into slow on the beat#

keyframes: { speed: [ {t:0, v:3}, {t:1.1, v:3}, {t:1.3, v:0.4, "ease":"ease-out"} ] } - sync the drop (t:1.3) to a marker; add transitionIn:{type:"whip",duration:0.2} before it.

Impact hit#

Adjustment layer, 0.25–0.4 s at the hit: {kind:"adjust", track:"V3", props:{shake:20, rgbSplit:8}} + impact-hit.mp3 from library/sfx on A2.

VHS / glitch look#

props: {rgbSplit:4, grain:35, saturation:120} + library/elements/vhs-scanlines.svg on V3 with blend:"soft-light", fit:"stretch". Cut between shots with transitionIn:{type:"glitch",duration:0.3}.

Film look#

Adjustment layer across the whole edit: props: {filterPreset:"cinematic", grain:18} - one clip grades every shot.

Neon caption#

props: {glow:60, glowColor:"#22d3ee", color:"#ffffff", font:"Bebas Neue", textAnim:"wave"} on a dark shot.

Light leak accent#

library/elements/light-leak-warm.svg on V3, props:{blend:"screen", fit:"cover", opacity:0.7}, 1–2 s at scene changes, transitionIn/Out: fade.

Light-leak / dust overlay#

Element from library/elements on V3 with props: {blend:"screen", opacity:0.6, fit:"cover"}.

Reel caption#

Text clip with props: {textAnim:"word-pop", wordRate:0.15, strokeWidth:6, bgColor:"#000000", bgOpacity:0.45, fontSize:88}. karaoke dims words until "spoken"; typewriter for terminal vibes.

RTL / Hebrew / Arabic caption#

Omit direction (defaults to "auto") or set direction:"rtl" explicitly; pick a font with the script's glyphs (Google Fonts work). Animations wipe and stagger in reading order automatically. letter-pop / wave animate whole words on Arabic/Indic lines (not isolated letters) so cursive joining stays correct.

Branded title#

props: {font:"Bebas Neue", weight:700, letterSpacing:6, uppercase:true, color:"#ffffff", color2:"#7b6cff", textShadow:20} - any Google Font name just works.

Kinetic font-cut title rhythmic typeface cuts on the beat, then settle#

props: {font:"Bebas Neue", fontSize:120, uppercase:true, color:"#ffd166", textAnim:"font-cut", fontCutSet:["Anton","Bebas Neue","Archivo Black","Oswald"]}.

Elegant clip-on title letters wipe in#

props: {font:"Playfair Display", fontSize:88, color:"#ffffff", color2:"#ffd166", letterSpacing:2, textAnim:"clip-reveal"} - centered, one clean sweep.

Lower-third reveal#

props: {font:"Archivo Black", fontSize:92, uppercase:true, textAnim:"rise-mask", y:<height*0.30>} - the line rises from behind its baseline. Pair with a serifDrop/zoom-in kicker above it.

Custom font#

Drop MyBrand.ttf into library/fonts/, then props.font: "MyBrand".

Animated sticker#

Author an SVG (convention above) into library/svg/, register {kind:"svg", src:"/library/svg/foo.svg"}, clip on V2/V3. Scale/move/ rotate with normal props & keyframes; the SVG's own CSS animation plays on top, frame-accurately.

Whoosh on a cut#

0.4 s sfx clip from library/sfx on A2 aligned to the cut.

Ken Burns slow push on a photo#

keyframes: { scale:[{t:0,v:1},{t:D,v:1.2,ease:"linear"}], x:[{t:0,v:0},{t:D,v:-40,ease:"linear"}] }.

Crossfade#

Overlap two clips on the same track by ~1 s; later clip gets transitionIn: {type:"fade", duration:1}. For audio give the earlier clip the matching transitionOut and both curve:"power" (or select a clip and press Shift+D in the editor).

Whip-pan cut#

A gets transitionOut:{type:"whip",duration:0.25}, B gets transitionIn:{type:"whip",duration:0.25}.

Beat-synced cut#

Write beat times into markers, then align clip starts to them (the UI also snaps drags to markers).

Label the structure#

Write named, coloured markers for sections the user can jump between (⇧M / Alt+⇧M, or the Markers list): setProject {markers:[{t:0,label:"intro",color:"blue"},{t:8.5,label:"drop",color:"red"},{t:24,label:"outro",color:"purple"}]}. setProject replaces the whole list - include the existing markers you want to keep.

Music fade-out#

Audio clip keyframes: { volume:[{t:D-3,v:0.8},{t:D,v:0}] } or simply transitionOut: {type:"fade", duration:3, curve:"exp"}.

Pulse / emphasis#

keyframes: { scale:[{t:0,v:1},{t:0.3,v:1.12},{t:0.6,v:1}] }.

Reframe horizontal → vertical#

Keep a wide composition canvas and crop for delivery - e.g. width:1920, height:1080 with exportFrame:{x:656,y:0,w:608,h:1080} (9:16 fitted to canvas height). Position footage with clip x/y/scale; the export frame can be dragged in the UI. Omit exportFrame to export the full canvas.

Vertical reel#

Set project width:1080, height:1920; use the UI's safe-area guides (▦) to keep captions out of platform UI zones.

Project frame rate#

Set fps in project.json (or the Program Monitor FPS dropdown - 24 / 25 / 30 / 50 / 60). Preview stepping, timecode frames, Fast / WebCodecs / Realtime export, and /api/export/begin all use this value; pass the same fps when starting an export via the API.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/remake/index.html b/docs/docs/remake/index.html index 4103fd296..df700d0b9 100644 --- a/docs/docs/remake/index.html +++ b/docs/docs/remake/index.html @@ -93,7 +93,7 @@

Remake a reference video

"music": { "name": "ref-music.m4a", "src": "/media/…", "mediaId": "m_x" } } // ^ extracted + registered by the MCP tool

threshold tunes cut sensitivity (default adapts 0.30→0.20→0.12): lower it if obvious cuts were missed, raise it if motion is being misread as cuts.

Rebuild recipe - the analysis is deterministic; the creative mapping is yours:

  1. setProject: copy the reference's width/height/fps; write beats (or the cuts) into markers so the user sees the grid.
  2. Music: the extracted track on A1, in:0, duration:<ref duration>.
  3. Structure: one clip per shots[] entry on V1 at the same start/duration (hard cuts by default - that's what shot detection saw). Pick source footage whose motion matches each shot's energy (calm ≤40, action ≥70), and choose each clip's in so something interesting happens inside the window. Then look: fablecut_frame {path, frames:12} to survey a candidate clip, {path, t} at the exact moment you want, before committing to an in.
  4. The drop: put the hero shot there; classic garnish = a speed ramp landing on it, an impact adjust layer (shake+rgbSplit), or a whip transition.
  5. Pacing garnish to taste: shots shorter than ~0.6 s read as beat-flashes; avgShotLen tells you the reference's overall pace. Captions/grade/SFX per the Recipes section - the blueprint gives structure, not style.
- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/rest-api/index.html b/docs/docs/rest-api/index.html index d9bdf4cce..c597e605d 100644 --- a/docs/docs/rest-api/index.html +++ b/docs/docs/rest-api/index.html @@ -82,7 +82,7 @@

REST API

The HTTP endpoints behind the editor, for scripts and tools that don't speak MCP.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/sequences/index.html b/docs/docs/sequences/index.html index e8cd4468a..129250c8b 100644 --- a/docs/docs/sequences/index.html +++ b/docs/docs/sequences/index.html @@ -87,7 +87,7 @@

Sequences

"clips": [ /* … */ ], "tracks": [ /* … */ ], "markers": [ /* … */ ], "delivery": { "preset": "instagram-reels" } } ]

Opening another sequence parks the top-level keys in the open one's entry and brings the other's up, with a new revision - like any edit. A clip in a sequence that isn't open still counts: its media shows "used" in the bin, can't be removed while it is there (removeMedia and Remove from project refuse and name the sequence), and Replace file… trims it too; a comp it places can't be removed either. A project with one sequence named Main has neither key.

In the editor: the sequence menu at the left of the timeline toolbar (it shows the open sequence's name, and how many there are) lists them - click one to open it - and has New sequence… (a name, a canvas - the same as the open one, or 16:9, 9:16, 4:5, 1:1 - and, optionally, a copy of the open sequence's timeline to start from), Duplicate, Rename… and Delete… (click twice; the project is first kept as a version, so a deleted sequence can be restored from Projects → Versions). For the session each sequence keeps its own undo history, playhead and selection. The Export dialog, the Mixer, IN / OUT and the canvas settings all belong to the open sequence. Find timeline instances lists placements in other sequences too; clicking one opens its sequence.

Agents (fablecut_patch_project):

Reframe - fablecut_reframe {aspect?:"9:16"|"1:1"|"4:5"|"16:9"|"4:3"|"2:3", name?, clipIds?, follow?, smooth?, force?} makes a copy of the open sequence on that canvas shape and opens it (the project's shorter side kept: 1920×1080 → 1080×1920 for 9:16, 1080×1080 for 1:1), so the original cut stays as it was; without aspect it reframes the open sequence on its own canvas. Each full-frame shot - a video or still that isn't moved, scaled, cropped or keyed by hand - gets fit:"cover" and an x (or y) that keeps its subject in view. Frames are sampled 5 times a second at 96 px; the subject is where motion (against the shot's own movement, so a pan or a flicker doesn't count), detail and colour gather, pulled gently toward the centre. A virtual camera operator then holds still while the subject stays inside a dead zone and eases after it no faster than a pan speed, and the path becomes ordinary keyframes (thinned to within ~2 px), or one steady position. Shots with no clear subject are centred. Titles, picture-in-picture, clips placed or animated by hand and locked clips (unless force:true) are left alone and listed in the reply - check them on the new canvas with fablecut_frame {time}. follow:false only fits and centres; smooth 0…1 (default 0.5) holds longer and pans slower as it rises. props.reframe marks what Reframe did, so running it again replaces its own keys. A version is kept first. In the editor: New sequence… with a copy of the open sequence on another shape has Follow the subject in each shot; the Inspector's Reframe section on a video or picture of another shape than the canvas has Follow subject, Centre and Lively / Balanced / Steady (the selected clips, one undo step, with Cancel).

Highlights - fablecut_highlights {duration?, shot?, clipIds?, mediaIds?, name?, aspect?} finds the best moments of long footage and cuts them into a short edit: a new sequence (Highlights 30 s, or name), opened, so the timeline it came from stays as it was. It reads the video clips on the open timeline (clipIds limits them; mediaIds reads whole files instead), up to an hour of footage at a time: frames twice a second at 64 px, and the sound. Every half second is scored for movement, sound louder than the 20 s around it (a cheer, a laugh, a hit), its overall level, and a clear picture; black frames and flat colour count for little. Cuts already in the footage are found, and a moment never crosses one. It then takes the best moments of shot seconds (default duration / 8, kept within 1.5–4 s), apart in the same footage (by half a moment, at least a second) and spread over its shots, until the edit is duration seconds (default 30; 5…600), trims the last ones to fit exactly, and nudges each end up to 0.3 s to the quietest point near it, so no word or hit is cut through. The moments go back to back on V1 in story order, each a clip of its source with its props (a reframed clip's framing isn't carried over) and its linked sound clips beside it (their own tracks, linked again); their keyframes aren't carried over. A moment from a whole file (mediaIds) is one video clip that plays its own sound, with no separate audio clips. A clip played faster or slower counts by its length on the timeline: duration and shot are always seconds of the edit. In the editor (and Studio) the sound of a file longer than 30 minutes isn't read, so as not to decode it whole in the browser; its picture decides. Disabled clips and clips with a speed ramp are not read. aspect makes the new sequence 9:16, 1:1 or 4:5: the shots are then letterboxed, and fablecut_reframe {} fits them and follows the subject. The reply lists each moment (its source, times, length, why it was picked and its score). A version is kept first. In the editor: the sequence menu's Highlights… (15, 30, 60 or 90 s; a canvas, and Follow the subject in each shot on another shape) reads the selected video clips, else every video clip on the timeline, with progress and Cancel.

Recipes: vertical cut of a finished edit - fablecut_reframe {aspect:"9:16"}, then check the titles with fablecut_frame; by hand, addSequence {name:"Reel 9:16", from:"open", width:1080, height:1920}, then inSequence ops to re-position or re-scale the shots and setProject {delivery:"instagram-reels"} in it; reel from a long video - fablecut_highlights {duration:30, aspect:"9:16"}, then fablecut_reframe {}, music on an audio track and fablecut_beats {clipId:<the music>, retime:{every:2}}, then captions; cut-downs - duplicate the edit as "30 s" and "15 s" and tighten each with the trim ops inside inSequence; selects reel - an empty sequence the user drops favourite takes on, cut into the edit from the Source monitor.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/tracking/index.html b/docs/docs/tracking/index.html index 470c4701b..c1a73bf97 100644 --- a/docs/docs/tracking/index.html +++ b/docs/docs/tracking/index.html @@ -85,7 +85,7 @@

Motion tracking

"samples": [[0, 0.31, 0.42, 1, 0, 1], [0.0333, 0.312, 0.421, 1, 0, 0.98]] } ]
keydoes
namehow masks, clips and agents refer to it (default Track n, or the mask's name)
kindpoint (position) or box (position, size and rotation were followed)
w · hthe region that was matched, fractions of the clip's picture
samplesone per frame: [t, x, y, s, r, q]. t is seconds from the clip's start, x, y is the centre (fractions of the picture, like masks), s is the scale and r the rotation (°) relative to the first sample, q is the match quality 0…1

The tracker matches a small greyscale template of the region (normalized cross-correlation, sub-pixel, optionally over scale and rotation) and keeps the template fresh while anchoring it to the first frame so it does not drift. It stops where the match quality drops below 0.45 (the region was covered, left the frame or changed too much) and keeps what it tracked up to there. Pick regions with detail: corners, text, edges. Flat sky or a blank wall can't be tracked. A track without scale follows position only: if the thing grows, shrinks or turns noticeably, turn on Scale / Rotate (scale / rotation), or the match fades and the track stops early. Tracks are stored in clip time, so they move with the clip and follow trims and splits (re-track after changing its speed).

In the editor:

Agents: fablecut_track runs the tracker in the editor (an open tab, else headless Chrome / Edge) and saves the result:

Recipes: a title that follows a car - track a point on the car, attach the title; blur a face or a plate - an ellipse mask on a blurred copy of the shot on the track above, then apply:{mask:"Face"}; a screen replacement - track the screen with Scale and Rotate on and attach the new picture, cropped to fit; a highlight that stays on a UI element in a screen recording - track the button, attach a rect svg.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/transcripts/index.html b/docs/docs/transcripts/index.html index 7f4d114e9..2913145c1 100644 --- a/docs/docs/transcripts/index.html +++ b/docs/docs/transcripts/index.html @@ -82,7 +82,7 @@

Transcripts and text-based editing

Turn speech into words with times, in the browser, then read, search and cut the edit like text: in the Transcript tab, or from an agent with fablecut_transcribe.

FableCut turns the speech in a clip into words with times, so an edit can be read, searched and cut like text. Transcription runs in the browser: Whisper (OpenAI's speech model, through transformers.js) in a background worker of the editor tab. The library and the model are fetched from a CDN the first time and kept by the browser after that; the audio never leaves the machine.

modeldownload
base (default)77 MBquick: about 15 s per minute of speech on a fast desktop
small250 MBoften more accurate (accents, noisy rooms, numbers); about twice as slow

Whisper detects the language by itself; give it one (en, es, hi, ja, … any Whisper code) when a clip is short or mixes languages. Long files are split at their quietest moments into pieces of at most 28 s, and stretches of silence are skipped (Whisper invents words in silence).

One transcript per file, kept by the server in analysis/transcripts/: {v, src, model, language, duration, created, words:[[text, start, end], …]}, times in seconds of the file. Like a proxy it belongs to the file's size and modification time, so a replaced or re-rendered file has none until it is transcribed again. It is not stored in project.json, so it never bloats the timeline, and every clip and sequence that uses the file reads the same one.

On the timeline a clip shows the words its window of the file holds, placed through its in point and speed (a word counts when its middle is inside the clip). A clip with a speed ramp is left out, and so are disabled clips and pictures whose sound is off.

Cutting words extracts on the targeted tracks, from just before the first word to just before the word after the last one: the pause after the cut goes too, the pause before it stays. Cuts land on whole frames, never in a neighbouring word or past the clip. Several cuts go last first, as one undo step (one revision for an agent): later material moves up, linked stems stay in step, and locked clips stay put - lock the music bed first if it should keep running under the tightened edit. Find matches whole words and ignores case, accents, punctuation and spacing: "ai powered" finds "A.I.-powered", and "cat" doesn't find "category".

In the editor, the Transcript tab beside the Inspector:

Agents use fablecut_transcribe. It transcribes in an open editor tab, else in headless Chrome / Edge, whose profile is kept in analysis/browser-profile/ so the model downloads once:

Whisper writes clean text: it often leaves out fillers ("um", "uh") and false starts, so find those by ear (fablecut_silence for the pauses), not by text. Word times are good to about a tenth of a second; listen to a cut that matters, or check it with fablecut_frame.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/versions/index.html b/docs/docs/versions/index.html index 0242d9833..63b1ca2e4 100644 --- a/docs/docs/versions/index.html +++ b/docs/docs/versions/index.html @@ -82,7 +82,7 @@

Versions

Saved copies of a project you can compare and go back to, made by you, every few minutes, and before an agent edits; restoring is never destructive, and a backup carries them all.

Every edit is saved as it happens, and undo covers the session. An edit that reaches the open editor from outside (an agent, another tab) is one undo step of its own there: Ctrl+Z takes it back first, then the user's own edits. Versions are what you come back to later: full copies of a project, kept beside it, that are never overwritten. Restoring one is not destructive either - what is there is saved as a version first, so a restore can be undone by restoring that.

pathholds
projects/<id>/history/v0007.jsonthe project as it was
projects/<id>/history/v0007.meta.json{v, name, note, kind, created, revision, clips, duration, final}

A version's kind says where it came from:

kindmade
manualby you (Save version, Ctrl/Cmd+S) or an agent (fablecut_versions {action:"save"})
autoevery 10 minutes while the open project changes, whoever changes it (FABLECUT_AUTO_VERSION_MIN sets the minutes); the newest 30 are kept
agentbefore an agent's first edit of a session (again after 10 quiet minutes), and before every fablecut_set_project rewrite
restorewhat was there just before a restore

One version per project can be marked final (the cut that went out); a final version can't be deleted until it is unmarked. Manual, agent and restore versions are never pruned.

Compare tells what changed between a version and now (or two versions): clips added, removed and changed (timing, which props, keyframes, effects, transitions, source, track), media added and removed, the length, and project settings (name, canvas, frame rate, IN / OUT, tracks, markers, comps, mix, delivery, …).

Backup and recovery. Download backup saves a project with all its versions as one .fablecut-backup.json file; Import… in the dashboard brings it back, versions included. When project.json can't be read as the server starts (another tool crashed mid-write, a bad hand edit), the server keeps the broken file as project.corrupt-<time>.json and puts back the newest good copy: the latest version, or the project's last parked copy.

In the editor: Ctrl/Cmd+S saves a version of the open project. In the Projects dashboard, a project's Versions… lists its versions, newest first, with Save version (name and note), and per version Compare with now, Restore… (click twice), Mark final, Rename, Download and Delete… (click twice). Esc goes back to the projects.

Agents use fablecut_versions (or GET / POST /api/versions):

Recipes: try a bold alternative - save a version, make the change, compare, and restore if the user prefers the old one; client rounds - save "Round 1", "Round 2", … with the feedback in the note, mark the approved one final; what did the agent do? - diff against the "Before agent edits" version.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/docs/docs/workflows/index.html b/docs/docs/workflows/index.html index 096e5324f..bb6828abd 100644 --- a/docs/docs/workflows/index.html +++ b/docs/docs/workflows/index.html @@ -91,7 +91,7 @@

Workflows

{ "text": "Export for YouTube Shorts.", "call": { "tool": "fablecut_export", "args": { "preset": "youtube-shorts" } } } ], "created": "…", "updated": "…" }
keydoes
name · idup to 80 characters; the id is made from the name, and saving the same name again updates that workflow (it keeps its created)
description · tagswhat it is for (up to 600 characters) · up to 12 labels
steps1–50, each {text, call?} (a plain string is a step with only text); text up to 1000 characters
call{tool, args}: a FableCut tool (not fablecut_workflows) and the arguments it was given, up to 20 000 characters

Following one is a job for judgement, not a replay. The new project has other clips, ids and times, so a step's call is a worked example: read what the step says, look at the project (fablecut_get_project {compact:true}, fablecut_frame), and make the call that does that here. A step with no call is one only the agent's judgement can do ("pick the three strongest shots").

Agents use fablecut_workflows (or the REST endpoints below):

Recipes: "do what you did last week" - {}, then show the one that matches and do its steps; a house style for every episode - after the first episode is right, save its loudness, captions, grade and export steps as one workflow; hand a routine to another agent - the file in library/workflows/ is plain JSON any agent can read.

- Edit this in CLAUDE.md + Edit this in CLAUDE.md The whole manual as Markdown
diff --git a/import-url.js b/import-url.js index 0664e2989..9ff6f5dd7 100644 --- a/import-url.js +++ b/import-url.js @@ -185,7 +185,9 @@ function saveResponse(res, u, destDir, { signal, maxBytes, name: wanted }) { // a caller's name (e.g. "Title - Artist.mp3") keeps the served file's extension when it has a known one if (wanted) { const ext = kindFromName(name) ? path.extname(name) : path.extname(String(wanted)); - name = safeName(path.basename(String(wanted), path.extname(String(wanted))).trim() + ext); + // no dotfile, and the stem is cut (not the extension) so the type is still known + const stem = safeName(path.basename(String(wanted), path.extname(String(wanted))).trim().replace(/^\.+/, "")).replace(/^\.+/, "").slice(0, 100); + name = (stem || "download") + ext.slice(0, 10); } const kind = kindFromName(name); // /media/*.svg is served same-origin as image/svg+xml. A remote file with diff --git a/mcp-server.js b/mcp-server.js index 1f269d7a2..dd1176877 100644 --- a/mcp-server.js +++ b/mcp-server.js @@ -1318,7 +1318,9 @@ async function projectsTool(args) { if (out.from) return `Opened ${describeProject(out.project)}\nThe editor switched to it (${out.from} was saved first). Read it with fablecut_get_project {compact:true} before editing.`; return describeProject(out.project); } -/** Register a file already in media/ as project media (probed) → the entry. extra: more keys (license). */ +/** Register a file already in media/ as project media (probed) → the entry. extra: more keys + * (license, name); extra.keepRead: leave lastReadRevision alone, so a set_project after this + * needs a fresh read (the caller never handed the new document back). */ async function registerFile(target, kind, extra = {}) { const entry = { id: "m_" + uid(), @@ -1337,7 +1339,7 @@ async function registerFile(target, kind, extra = {}) { proj.media.push(entry); proj.revision = (proj.revision || 0) + 1; writeProject(proj); - if (wasCurrent) lastReadRevision = proj.revision; + if (wasCurrent && !extra.keepRead) lastReadRevision = proj.revision; return entry; } @@ -1355,6 +1357,7 @@ async function openverse(url) { if (r.status === 404) throw new Error("Openverse has no such track"); const body = await r.json().catch(() => null); if (!r.ok) throw new Error("Openverse answered " + r.status + (body && body.detail ? ": " + body.detail : "")); + if (!body || typeof body !== "object") throw new Error("Openverse's answer couldn't be read — try again"); return body; } const fmtLen = (s) => s == null ? "?:??" : Music.fmtLen(s); @@ -1373,14 +1376,25 @@ async function musicTool(args) { if (args.import) { const t = Music.track(await openverse(Music.trackUrl(args.import))); if (!t.url) throw new Error("Openverse lists no file for this track"); + // a new file every time (the downloader never reuses a name), so a failed registration removes it const got = await downloadImportUrl(t.url, MEDIA_DIR, { name: Music.fileName(t), allowLoopback: !!process.env.FABLECUT_TEST_OPENVERSE }); - const kind = kindFromName(got.name); - if (kind !== "audio" && kind !== "video") throw new Error("the track's file isn't audio: " + got.name); - const entry = await registerFile(got.target, kind, { name: `${t.title} — ${t.creator}`, license: Music.mediaLicense(t) }); + let entry; + try { + const kind = kindFromName(got.name); + if (kind !== "audio" && kind !== "video") throw new Error("the track's file isn't audio: " + got.name); + entry = await registerFile(got.target, kind, { name: `${t.title} — ${t.creator}`, license: Music.mediaLicense(t), keepRead: true }); + } catch (e) { + try { fs.rmSync(got.target, { force: true }); } catch {} + throw e; + } + const lic = t.license, limits = Music.warnings(lic); return [`Imported "${t.title}" by ${t.creator} → ${entry.id} (${fmtLen(entry.duration)}, ${entry.src})`, - `Licence: ${t.license.label} — ${t.license.note}.`, - t.license.credit ? `Credit: ${Music.creditLine(entry.license)}` : "", - `Place it: {op:"addClip", clip:{mediaId:"${entry.id}", kind:"audio", track:"A1", start:0, in:0, duration:<≤ ${entry.duration || "its length"}>}} — then fablecut_beats {clipId} for its tempo.`, + `Licence: ${lic.label} — ${lic.note}.`, + lic.credit ? `Credit: ${Music.creditLine(entry.license)}` : "", + ...limits.map((w) => `⚠ ${w}`), + !lic.edits || lic.sampling + ? `Don't set this track under the video as it is: its licence doesn't allow that. Search again for one whose licence allows edits (edits:true).` + : `Place it: {op:"addClip", clip:{mediaId:"${entry.id}", kind:"audio", track:"A1", start:0, in:0, duration:<≤ ${entry.duration || "its length"}>}} — then fablecut_beats {clipId} for its tempo.`, ].filter(Boolean).join("\n"); } if (args.page != null && !(Number.isInteger(args.page) && args.page >= 1 && args.page <= Music.MAX_PAGE)) throw new Error(`page is 1–${Music.MAX_PAGE}`); @@ -1572,6 +1586,8 @@ async function exportTool(args) { const r = await apiJSON("POST", "/api/export/request", { range: args.range, profile: args.profile, preset: args.preset, delivery: args.delivery, outputs: args.outputs, name, where: args.where || "auto" }); if (r.status !== 200) throw new Error(r.body?.error || `export request failed (${r.status})`); job = r.body; + // the credits of the timeline this job renders, kept with the job for later polls + try { const cr = creditsText(readProject()); if (cr) jobCredits.set(job.id, cr); } catch {} if (job.notes && job.notes.length) startNote = `Settings adjusted: ${job.notes.join("; ")}\n`; if (args.wait === false) return (job.delivery ? `Output: ${job.delivery}\n` : "") + startNote + describeExportJob(job); } @@ -1585,9 +1601,10 @@ async function exportTool(args) { job = r.body; } // licensed music the edit uses: the credits belong in the video's description - const credits = job.status === "done" ? creditsText(readProject()) : ""; + const credits = job.status === "done" ? jobCredits.get(job.id) : ""; return startNote + describeExportJob(job) + (credits ? "\n" + credits : ""); } +const jobCredits = new Map(); // export job id → the credits of the timeline it rendered /* ── Frames (fablecut_frame) ── The tool is the only one that answers with an image, so it returns content diff --git a/music.js b/music.js index 46bcc6d33..2878efe8c 100644 --- a/music.js +++ b/music.js @@ -47,8 +47,9 @@ "by-nc-sa": { label: "CC BY-NC-SA", commercial: false, edits: true, credit: true, note: "non-commercial only, credit the artist; the video must be shared under CC BY-NC-SA too" }, "by-nd": { label: "CC BY-ND", commercial: true, edits: false, credit: true, note: "no derivatives: music set to video counts as one, so it can't go into an edit" }, "by-nc-nd": { label: "CC BY-NC-ND", commercial: false, edits: false, credit: true, note: "non-commercial and no derivatives: music set to video counts as one, so it can't go into an edit" }, - "sampling+": { label: "Sampling+", commercial: false, edits: true, credit: true, note: "parts may be sampled and remixed, also commercially (not for ads); the whole track only non-commercially; credit the artist" }, - "nc-sampling+": { label: "NC Sampling+", commercial: false, edits: true, credit: true, note: "parts may be sampled and remixed non-commercially; credit the artist" }, + // Sampling licences allow transforming parts of a track, not setting the whole track to video as it is + "sampling+": { label: "Sampling+", commercial: false, edits: true, sampling: true, credit: true, note: "parts may be sampled and transformed, also commercially (not in ads); the whole track as it is only shared non-commercially, not set to video; credit the artist" }, + "nc-sampling+": { label: "NC Sampling+", commercial: false, edits: true, sampling: true, credit: true, note: "parts may be sampled and transformed, non-commercially only; the whole track as it is can't be set to video; credit the artist" }, }; /** What a licence allows: {code, label ("CC BY 4.0"), commercial, edits, credit, note, url}. */ @@ -57,20 +58,37 @@ const base = LICENSES[c] || { label: c ? c.toUpperCase() : "Unknown licence", commercial: false, edits: false, credit: true, note: "unknown licence — check the track's page before using it" }; const v = version && !/^(cc0|pdm)$/.test(c) ? String(version) : ""; return { code: c, label: base.label + (v ? " " + v : ""), commercial: base.commercial, edits: base.edits, - credit: base.credit, note: base.note, url: url || "" }; + sampling: !!base.sampling, credit: base.credit, note: base.note, url: url || "" }; } - /** The words that sum a licence up for a badge: "free to use", "credit", "non-commercial", "no edits", "share alike". */ + /** The words that sum a licence up for a badge: "free to use", "credit", "non-commercial", "no edits", "samples only", "share alike". */ function flags(lic) { const out = []; if (!lic.credit && lic.commercial && lic.edits) out.push("free to use"); if (lic.credit) out.push("credit"); if (!lic.commercial) out.push("non-commercial"); if (!lic.edits) out.push("no edits"); + if (lic.sampling) out.push("samples only"); if (/-sa$/.test(lic.code)) out.push("share alike"); return out; } + /** Why a licence limits a video, one line each (credits and the import reply). */ + function warnings(lic) { + const out = []; + if (!lic.edits) out.push(lic.label + " allows no derivatives — music set to video counts as one"); + if (lic.sampling) out.push(lic.label + " allows only sampled, transformed parts — not the whole track under a video"); + if (!lic.commercial) out.push(lic.label + " is non-commercial only"); + if (/-sa$/.test(lic.code)) out.push(lic.label + ": share the video under the same licence"); + return out; + } + + /** Only http(s) links reach a page's href; anything else becomes "". */ + function webUrl(u) { + try { const x = new URL(String(u || "")); return x.protocol === "https:" || x.protocol === "http:" ? x.href : ""; } + catch (_) { return ""; } + } + /** The Openverse search URL. opts: {query, kind:'music'|'sfx', length:'shortest'|'short'|'medium'|'long', * commercial:true (only licences that allow commercial use), edits:true (only ones that allow * edits), licenses:[codes], page}. */ @@ -82,11 +100,15 @@ const kind = KINDS[opts.kind] || KINDS.music; for (const k of Object.keys(kind)) p.set(k, kind[k]); if (opts.length && LENGTHS[opts.length]) p.set("length", opts.length); - const types = []; - if (opts.commercial) types.push("commercial"); - if (opts.edits) types.push("modification"); - if (types.length) p.set("license_type", types.join(",")); - const lic = (opts.licenses || []).map((l) => String(l).toLowerCase()).filter((l) => LICENSES[l]); + // commercial / edits pick licence codes by FableCut's own table: Openverse's "commercial" group + // includes Sampling+, which FableCut labels non-commercial for a whole track + let lic = (opts.licenses || []).map((l) => String(l).toLowerCase()).filter((l) => LICENSES[l]); + if (opts.commercial || opts.edits) { + const ok = (c) => (!opts.commercial || LICENSES[c].commercial) && (!opts.edits || LICENSES[c].edits); + const picked = (lic.length ? lic : Object.keys(LICENSES)).filter(ok); + if (!picked.length) throw new Error("none of those licences allow " + [opts.commercial && "commercial use", opts.edits && "edits"].filter(Boolean).join(" and ")); + lic = picked; + } if (lic.length) p.set("license", lic.join(",")); p.set("mature", "false"); p.set("page_size", String(PAGE_SIZE)); @@ -108,12 +130,12 @@ /** An Openverse result as a plain track. */ function track(r) { r = r || {}; - const lic = licence(r.license, r.license_version, r.license_url); + const lic = licence(r.license, r.license_version, webUrl(r.license_url)); return { id: r.id, title: unescape(r.title || "Untitled"), creator: unescape(r.creator || "Unknown artist"), - creatorUrl: r.creator_url || "", duration: r.duration ? Math.round(r.duration / 100) / 10 : null, + creatorUrl: webUrl(r.creator_url), duration: r.duration ? Math.round(r.duration / 100) / 10 : null, license: lic, flags: flags(lic), - url: r.url || "", page: r.foreign_landing_url || "", source: r.source || r.provider || "", + url: webUrl(r.url), page: webUrl(r.foreign_landing_url), source: r.source || r.provider || "", genres: (r.genres || []).slice(0, 6), tags: (r.tags || []).map((t) => t && t.name).filter(Boolean).slice(0, 10), filetype: r.filetype || "", attribution: r.attribution || "", }; @@ -150,8 +172,12 @@ function cleanLicense(l) { if (!l || typeof l !== "object" || Array.isArray(l) || !l.code) return null; const out = {}; - for (const k of ["code", "label", "url", "title", "creator", "page", "source", "openverse", "attribution"]) - if (typeof l[k] === "string" && l[k]) out[k] = l[k].slice(0, k === "attribution" ? 1000 : 300); + for (const k of ["code", "label", "url", "title", "creator", "page", "source", "openverse", "attribution"]) { + if (typeof l[k] !== "string" || !l[k]) continue; + // links are kept whole or not at all: a cut URL would point somewhere else + if (k === "url" || k === "page") { const u = webUrl(l[k]); if (u && u.length <= 2000) out[k] = u; } + else out[k] = l[k].slice(0, k === "attribution" ? 1000 : 300); + } if (!out.label) out.label = licence(out.code).label; return out; } @@ -164,8 +190,9 @@ } /** The credits an edit needs: every licensed file the edit uses (a denoised - * copy counts as its original). uses: media id → placements (MediaLib.usageCounts). - * → [{mediaId, name, license, line, warnings}] */ + * copy counts as its original, and its credit says the sound was changed). + * uses: media id → placements (MediaLib.usageCounts). + * → [{mediaId, name, license, line, needsCredit, changes, warnings}] */ function credits(doc, uses) { const media = (doc && doc.media) || []; const byId = new Map(media.map((m) => [m.id, m])); @@ -173,26 +200,25 @@ for (let i = 0; m && !m.license && m.derivedFrom && i < 8; i++) m = byId.get(m.derivedFrom); return m && m.license ? m : null; }; - const out = [], seen = new Set(); + const byWork = new Map(); for (const m of media) { if (!(uses && uses.get ? uses.get(m.id) : 0)) continue; const o = origin(m); if (!o) continue; const key = o.license.openverse || o.id; - if (seen.has(key)) continue; - seen.add(key); - const lic = licence(o.license.code); - const warnings = []; - if (!lic.edits) warnings.push(lic.label + " allows no derivatives — music set to video counts as one"); - if (!lic.commercial) warnings.push(lic.label + " is non-commercial only"); - if (/-sa$/.test(lic.code)) warnings.push(lic.label + ": share the video under the same licence"); - out.push({ mediaId: o.id, name: o.name, license: o.license, needsCredit: lic.credit, line: creditLine(o.license), warnings }); + if (!byWork.has(key)) byWork.set(key, { o, changes: new Set() }); + if (m !== o && m.denoise) byWork.get(key).changes.add("noise reduced"); + else if (m !== o) byWork.get(key).changes.add("processed"); } - return out; + return [...byWork.values()].map(({ o, changes }) => { + const lic = licence(o.license.code), ch = [...changes]; + return { mediaId: o.id, name: o.name, license: o.license, needsCredit: lic.credit, changes: ch, + line: creditLine(o.license) + (ch.length ? ` — changed: ${ch.join(", ")}` : ""), warnings: warnings(lic) }; + }); } const ABOUT = "Music from Openverse (openverse.org) — made with Openverse, not endorsed or certified by it. Each track's licence is the artist's: check it before you publish."; return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, SFX_WORDS, LICENSES, ABOUT, - licence, flags, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; + licence, flags, warnings, webUrl, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; }); diff --git a/project-ops.js b/project-ops.js index a7c09056f..5f3126623 100644 --- a/project-ops.js +++ b/project-ops.js @@ -455,6 +455,7 @@ if (name === "replaceMedia") { m.name = op.name ? String(op.name).trim().slice(0, 200) : MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; + delete m.license; // another file: the old track's licence and credit don't apply (relinkMedia keeps it) } else if (op.name) m.name = String(op.name).trim().slice(0, 200); if (info) { for (const k of MediaLib.INFO_KEYS) if (info[k] != null) m[k] = info[k]; diff --git a/skills/remake-reel/SKILL.md b/skills/remake-reel/SKILL.md index 65323f03b..f388f2c90 100644 --- a/skills/remake-reel/SKILL.md +++ b/skills/remake-reel/SKILL.md @@ -41,7 +41,8 @@ as cuts, raise it. 6. No music of their own? `fablecut_music {query:"", length:"short"}` finds openly licensed tracks (say each one's licence; add `commercial:true, edits:true` when the reel will be monetized), and - `{import:""}` brings one in with its credit. + `{import:""}` brings one in with its credit. It replaces the reference's + music: `removeClip` the extracted track on A1, then place the new one there at 0. With the user's own music instead of the reference's, `fablecut_beats {clipId}` finds its tempo, beat and drop; `snap:true` rolls the cuts onto the beat, `retime:{every:2}` re-cuts V1 so each shot lasts 2 beats. diff --git a/test/music.test.js b/test/music.test.js index 7bbcb3397..77a91ec72 100644 --- a/test/music.test.js +++ b/test/music.test.js @@ -29,6 +29,9 @@ test("licences say what a video editor may do with a track", () => { assert.deepEqual(M.flags(M.licence("by-nc-nd")), ["credit", "non-commercial", "no edits"]); assert.deepEqual(M.flags(M.licence("by-sa")), ["credit", "share alike"]); assert.equal(M.licence("by-nd").edits, false, "music set to video is a derivative"); + assert.deepEqual(M.flags(M.licence("sampling+", "1.0")), ["credit", "non-commercial", "samples only"]); + assert.deepEqual(M.warnings(M.licence("nc-sampling+", "1.0")), + ["NC Sampling+ 1.0 allows only sampled, transformed parts — not the whole track under a video", "NC Sampling+ 1.0 is non-commercial only"]); const odd = M.licence("mystery"); assert.equal(odd.commercial, false); assert.match(odd.note, /unknown licence/); @@ -40,7 +43,11 @@ test("searchUrl builds the Openverse query", () => { assert.equal(u.searchParams.get("q"), "chill lo-fi"); assert.equal(u.searchParams.get("category"), "music"); assert.equal(u.searchParams.get("length"), "short"); - assert.equal(u.searchParams.get("license_type"), "commercial,modification"); + assert.equal(u.searchParams.get("license"), "cc0,pdm,by,by-sa", "FableCut's own table, never Openverse's commercial group (it has Sampling+)"); + assert.equal(u.searchParams.get("license_type"), null); + assert.equal(new URL(M.searchUrl({ commercial: true })).searchParams.get("license"), "cc0,pdm,by,by-sa,by-nd"); + assert.equal(new URL(M.searchUrl({ commercial: true, licenses: ["by-nc", "by", "sampling+"] })).searchParams.get("license"), "by", "a choice is narrowed, never widened"); + assert.throws(() => M.searchUrl({ commercial: true, licenses: ["by-nc", "sampling+"] }), /none of those licences allow commercial use/); assert.equal(u.searchParams.get("page_size"), "20"); assert.equal(u.searchParams.get("page"), "3"); assert.equal(u.searchParams.get("mature"), "false"); @@ -69,6 +76,10 @@ test("results become plain tracks", () => { assert.equal(M.fmtLen(0.43), "0.4 s"); const r = M.results({ result_count: 999, page_count: 50, results: [result(), result({ url: "" })] }, 2); assert.equal(r.tracks.length, 1, "a result without a file is dropped"); + const bad = M.track(result({ foreign_landing_url: "javascript:alert(1)", license_url: "data:text/html,x", url: "file:///etc/passwd" })); + assert.equal(bad.page, "", "only http(s) links reach an href"); + assert.equal(bad.license.url, ""); + assert.equal(bad.url, ""); assert.equal(r.pages, 12); assert.equal(r.page, 2); }); @@ -80,11 +91,15 @@ test("a media entry keeps its licence, and the edit lists its credits", () => { assert.equal(kept.title, undefined, "only text fields are kept"); assert.equal(kept.extra, undefined, "unknown keys are dropped"); assert.equal(M.cleanLicense({ label: "x" }), null, "no code, no licence"); + const long = "https://example.com/" + "a".repeat(600); + assert.equal(M.cleanLicense({ ...lic, page: long }).page, long, "a link is kept whole"); + assert.equal(M.cleanLicense({ ...lic, page: "https://e.com/" + "a".repeat(2100) }).page, undefined, "or not at all"); + assert.equal(M.cleanLicense({ ...lic, url: "javascript:x" }).url, undefined); assert.equal(M.cleanLicense("CC BY"), null); const doc = seedProject({ media: [ { id: "m_song", name: "song", kind: "audio", src: "/media/s.mp3", license: lic }, - { id: "m_den", name: "song (denoised)", kind: "audio", src: "/media/s.flac", derivedFrom: "m_song" }, + { id: "m_den", name: "song (denoised)", kind: "audio", src: "/media/s.flac", derivedFrom: "m_song", denoise: "medium" }, { id: "m_fx", name: "fx", kind: "audio", src: "/media/fx.mp3", license: M.mediaLicense(M.track(result({ id: "eab8a6e2-0ac8-4615-9e0d-ebde30523783", license: "cc0", license_version: "1.0", title: "Whoosh" }))) }, { id: "m_nd", name: "nd", kind: "audio", src: "/media/nd.mp3", license: M.mediaLicense(M.track(result({ id: "bb6de945-d963-4f8e-9c60-3a786fa9aab2", license: "by-nc-nd" }))) }, ], @@ -97,7 +112,9 @@ test("a media entry keeps its licence, and the edit lists its credits", () => { const list = M.credits(doc, MediaLib.usageCounts(doc)); assert.equal(list.length, 2, "the denoised copy is the same song; the unused ND track isn't listed"); assert.equal(list[0].mediaId, "m_song"); - assert.match(list[0].line, /^"Night & Day" by Jahzzar \(jamendo\) — CC BY-SA 3\.0 \(https:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0\/\) — https:\/\/www\.jamendo\.com\/track\/918921$/); + assert.match(list[0].line, /^"Night & Day" by Jahzzar \(jamendo\) — CC BY-SA 3\.0 \(https:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0\/\) — https:\/\/www\.jamendo\.com\/track\/918921 — changed: noise reduced$/, + "the edit plays a denoised copy, so the credit says it was changed"); + assert.deepEqual(list[0].changes, ["noise reduced"]); assert.deepEqual(list[0].warnings, ["CC BY-SA: share the video under the same licence"]); assert.equal(list[1].needsCredit, false, "CC0 needs no credit"); doc.clips.push({ id: "c4", mediaId: "m_nd", kind: "audio", track: "A4", start: 0, in: 0, duration: 2 }); @@ -121,6 +138,10 @@ async function fakeOpenverse(t, { limited = false } = {}) { if (req.url === "/file.wav") { res.writeHead(200, { "Content-Type": "audio/wav" }); return res.end(wav); } if (req.url.startsWith("/v1/audio/?")) { res.writeHead(200, { "Content-Type": "application/json" }); return res.end(JSON.stringify({ result_count: 1, page_count: 1, results: [track] })); } if (req.url === `/v1/audio/${track.id}/`) { res.writeHead(200, { "Content-Type": "application/json" }); return res.end(JSON.stringify(track)); } + if (req.url === "/v1/audio/bb6de945-d963-4f8e-9c60-3a786fa9aab2/") { // a no-derivatives track + res.writeHead(200, { "Content-Type": "application/json" }); + return res.end(JSON.stringify({ ...track, id: "bb6de945-d963-4f8e-9c60-3a786fa9aab2", title: "Golden Peaks", license: "by-nc-nd" })); + } res.writeHead(404, { "Content-Type": "application/json" }); res.end("{}"); }); await new Promise((r) => srv.listen(0, "127.0.0.1", r)); @@ -138,7 +159,7 @@ test("fablecut_music searches, imports a track with its licence, and lists the c assert.match(found, /^1 result\(s\), page 1\/1 for "calm night"/); assert.match(found, /1\. c14c7353-1688-4204-9af0-64c0a5e8ccc3 "Night & Day" — Jahzzar · 1 s · CC BY-SA 3\.0 \[credit, share alike\] · ambient · jamendo/); assert.match(found, /made with Openverse, not endorsed/); - assert.match(ov.seen[0], /q=calm\+night&category=music&license_type=commercial/); + assert.match(ov.seen[0], /q=calm\+night&category=music&license=cc0%2Cpdm%2Cby%2Cby-sa%2Cby-nd/); assert.match(await text({ page: 0 }), /ERROR .*page is 1–12/); const got = await text({ import: "c14c7353-1688-4204-9af0-64c0a5e8ccc3" }); @@ -157,6 +178,34 @@ test("fablecut_music searches, imports a track with its licence, and lists the c assert.match(credits, /^CREDITS — licensed music in this edit/); assert.match(credits, /"Night & Day" by Jahzzar \(jamendo\) — CC BY-SA 3\.0/); assert.match(credits, /⚠ CC BY-SA: share the video under the same licence/); + + const nd = await text({ import: "bb6de945-d963-4f8e-9c60-3a786fa9aab2" }); + assert.match(nd, /^Imported "Golden Peaks"/); + assert.match(nd, /⚠ CC BY-NC-ND 3\.0 allows no derivatives/); + assert.match(nd, /Don't set this track under the video as it is/); + assert.doesNotMatch(nd, /Place it/, "no placement recipe for a track that can't go under video"); + + // a file replaced by another one loses the old track's licence; a relink keeps it + const before = readProject(dir).media.find((x) => x.id === m.id); + fs.copyFileSync(path.join(dir, "media", "Night Day - Jahzzar.wav"), path.join(dir, "media", "other.wav")); + await mcp.callTool("fablecut_patch_project", { ops: [{ op: "relinkMedia", id: m.id, src: "/media/other.wav" }] }); + assert.deepEqual(readProject(dir).media.find((x) => x.id === m.id).license, before.license); + await mcp.callTool("fablecut_patch_project", { ops: [{ op: "replaceMedia", id: m.id, src: "/media/Night%20Day%20-%20Jahzzar.wav" }] }); + assert.equal(readProject(dir).media.find((x) => x.id === m.id).license, undefined); +}); + +test("a requested file name keeps its extension and never makes a dotfile", async (t) => { + const http2 = require("node:http"); + const srv = http2.createServer((req, res) => { res.writeHead(200, { "Content-Type": "audio/mpeg" }); res.end(Buffer.alloc(64)); }); + await new Promise((r) => srv.listen(0, "127.0.0.1", r)); + t.after(() => srv.close()); + const { downloadImportUrl } = require("../import-url"); + const dir = makeDataDir(t); + const url = `http://127.0.0.1:${srv.address().port}/`; + const a = await downloadImportUrl(url, dir, { name: "...hidden.mp3", allowLoopback: true }); + assert.equal(a.name, "hidden.mp3"); + const b = await downloadImportUrl(url, dir, { name: "x".repeat(300) + ".mp3", allowLoopback: true }); + assert.match(b.name, /^x{100}\.mp3$/, "the stem is cut, not the extension"); }); test("fablecut_music explains Openverse's rate limit", async (t) => { @@ -172,6 +221,7 @@ test("the editor keeps a media entry's licence when it saves", () => { const src = fs.readFileSync(path.join(__dirname, "..", "app.js"), "utf8"); assert.match(src, /const lic = FableCutMusic\.cleanLicense\(m\.license\);\s*if \(lic\) mo\.license = lic;/); const html = fs.readFileSync(path.join(__dirname, "..", "index.html"), "utf8"); - assert.ok(html.indexOf('src="music.js"') < html.indexOf('src="app.js"'), "music.js loads before app.js"); + const mi = html.indexOf('src="music.js"'), ai = html.indexOf('src="app.js"'); + assert.ok(mi !== -1 && ai !== -1 && mi < ai, "music.js loads, before app.js"); assert.match(html, /data-tab="music"/); }); From f8cc31f8eb87a71d3b6a9687878aef9f4126d039 Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:12:30 +0530 Subject: [PATCH 5/9] =?UTF-8?q?Music:=20review=20round=202=20=E2=80=94=20e?= =?UTF-8?q?dits=20excludes=20Sampling,=20edit-scoped=20credits,=20one=20pl?= =?UTF-8?q?acement=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - edits:true means "may go under a video": no ND, no Sampling licences - Credits count only the open sequence and the comps placed in it (editUsage) - Export credits from the agent tool say when the timeline's music changed during the render - Music imports are always audio entries (no linked stems from a video container) - An already imported track goes through the same placement checks as a new one - replaceMedia / Replace file take the new file's licence when another entry has it - The search box keeps its focus and selection across a redraw - Skills: pick tracks with edits:true; replace the reference music only when the import gives a placement --- CLAUDE.md | 19 +++++---- app.js | 53 +++++++++++++++++--------- docs/demo/app.js | 53 +++++++++++++++++--------- docs/demo/music.js | 28 ++++++++++++-- docs/docs/captions/index.html | 2 +- docs/docs/color/index.html | 2 +- docs/docs/compositing/index.html | 2 +- docs/docs/compositions/index.html | 2 +- docs/docs/editing/index.html | 2 +- docs/docs/export/index.html | 2 +- docs/docs/frames/index.html | 2 +- docs/docs/masks/index.html | 2 +- docs/docs/media/index.html | 2 +- docs/docs/motion-paths/index.html | 2 +- docs/docs/motion/index.html | 2 +- docs/docs/music/index.html | 2 +- docs/docs/presets-templates/index.html | 2 +- docs/docs/projects/index.html | 2 +- docs/docs/recipes/index.html | 2 +- docs/docs/remake/index.html | 2 +- docs/docs/rest-api/index.html | 2 +- docs/docs/sequences/index.html | 2 +- docs/docs/tracking/index.html | 2 +- docs/docs/transcripts/index.html | 2 +- docs/docs/versions/index.html | 2 +- docs/docs/workflows/index.html | 2 +- mcp-server.js | 22 ++++++++--- music.js | 28 ++++++++++++-- project-ops.js | 5 ++- skills/edit-video/SKILL.md | 8 ++-- skills/remake-reel/SKILL.md | 11 +++--- test/music.test.js | 19 ++++++++- 32 files changed, 200 insertions(+), 90 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a011a04aa..2d42080a8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -739,13 +739,14 @@ be listed later: "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } } ``` -The **credits** are every licensed file the edit uses (main timeline, comps -and other sequences; a denoised copy counts as its original), one line each: +The **credits** are every licensed file the edit uses (the open sequence and +the compositions placed in it; a denoised copy counts as its original), one line each: `"Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921`, with a warning for a licence that limits the video (non-commercial, share alike, no derivatives, samples only), and `— changed: noise reduced` when the edit plays a denoised copy. They go in the video's description. Replacing a -file (**Replace file…**, `replaceMedia`) drops its licence; a relink keeps it. +file (**Replace file…**, `replaceMedia`) drops the old licence and takes the new +file's, when another entry imported that file with one; a relink keeps it. In the editor: the bin's **Music** tab has the search box, a length, **OK to monetize** (only licences that allow commercial use and edits), and mood chips @@ -764,17 +765,19 @@ music credits with **Copy**. Importing needs the editor server (or Studio). - `{query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?}` searches: 20 tracks a page, each `id "title" — artist · m:ss · licence [flags] · genres · source`. `commercial:true` keeps licences that allow commercial use (CC0, public domain, BY, - BY-SA, BY-ND), `edits:true` those that allow edits (it leaves out ND); pass both when - the video will be monetized. With `licenses`, only the ones among them that pass. + BY-SA, BY-ND), `edits:true` those that let a track go under a video as it is (it + leaves out ND and the Sampling licences); pass both when the video will be + monetized. With `licenses`, only the ones among them that pass. - `{import:""}` downloads it into `media/` (named "Title - Artist") and registers it with its `license`; the reply gives the licence, the credit, any limits, and an `addClip` to place it (not for an ND or Sampling track, which can't go under a video as it is). Then `fablecut_beats {clipId}` finds its tempo, `retime` cuts to it, and `fablecut_auto_duck` dips it under speech. - `{credits:true}` lists the edit's credits and licence warnings. `fablecut_export` - adds them to its reply when the edit uses licensed music. -- Say which licence a track has before the user publishes, and search with - `commercial:true, edits:true` when they plan to monetize. Import what the user + adds them to its reply when the edit uses licensed music, and says so if the + timeline's licensed music changed while it exported. +- Say which licence a track has before the user publishes. Search with `edits:true` + for music to put under a video, plus `commercial:true` when they plan to monetize. Import what the user picked, or the best fit when they asked you to choose. The compact view shows an imported file's `licence:"CC BY 3.0"`. diff --git a/app.js b/app.js index 8b20f60cf..cc776537a 100644 --- a/app.js +++ b/app.js @@ -2766,7 +2766,10 @@ async function setMediaSource(m, src, mode, name) { if (mode === "replace") { m.name = name || MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; - delete m.license; // another file: the old track's licence and credit don't apply (a relink keeps it) + // another file: the old track's licence doesn't apply (a relink keeps it); the new file's + // does, when another entry imported it with one (Music / SFX tab) + const same = project.media.find((x) => x !== m && x.license && x.src === src); + if (same) m.license = { ...same.license }; else delete m.license; } mediaOffline.delete(m.id); reloadMediaSource(m, oldSrc); @@ -3200,10 +3203,11 @@ function renderLibrary() { // a library listing that arrives after the user moved to a tab drawn elsewhere must not replace it if (dir === "project" || dir === "music" || dir === "shapes" || dir === "templates") return; const files = runtime.library[dir] || []; + const focus = searchFocus(); els.libList.innerHTML = ""; if (dir === "sfx") { // online sound effects (Openverse) first, then the library's own files - appendOnlineSearch("sfx"); + appendOnlineSearch("sfx", focus); const head = document.createElement("div"); head.className = "music-status lib-head"; head.textContent = files.length ? `Your library — library/sfx (${files.length})` : "Your library — drop files into library/sfx/ to keep them here."; @@ -3347,19 +3351,29 @@ function musicTogglePreview(t, btn) { musicPreview = { id: t.id, audio: a }; } /** Download a track into media/ and register it with its licence; place = add at the playhead too. */ +/** Put an imported track at `at` (the timeline and playhead of the click) → "" when placed, + * else why not. Never on another timeline, during an export, without a known length or on a locked track. */ +function placeImported(m, at) { + if (!(m.duration > 0 && isFinite(m.duration))) return "its length couldn't be read, so it's in the Project bin but not on the timeline"; + if ((project.sequence || null) !== at.seq || compCtxId() !== at.comp) return "another timeline is open now, so it's in the Project bin but not placed"; + if (exportBusy()) return "an export is running, so it's in the Project bin but not placed"; + if (!addClipFromMedia(m, null, at.t)) return "it's in the Project bin, but the audio track is locked, so it wasn't placed"; + return ""; +} async function musicImport(t, place, kind) { if (!state.connected) { toast("Importing needs the editor server"); return; } if (musicImporting.has(t.id)) return; + // + places it where the user clicked: that timeline (sequence / comp) and playhead + const at = { seq: project.sequence || null, comp: compCtxId(), t: state.time }; const have = project.media.find((m) => m.license && m.license.openverse === t.id); if (have) { - if (place) addClipFromMedia(have, null, state.time); - else toast(`“${have.name}” is already in the project`); + const why = place ? placeImported(have, at) : ""; + toast(`“${have.name}” is already in the project` + (why ? " — " + why : "")); return; } musicImporting.add(t.id); renderOnlineTab(kind); - // + places it where the user clicked: that timeline (sequence / comp) and playhead - const gen = runtime.projectGen, at = { seq: project.sequence || null, comp: compCtxId(), t: state.time }; + const gen = runtime.projectGen; try { const res = await fetch("/api/import-url", { method: "POST", headers: { "Content-Type": "application/json" }, @@ -3369,7 +3383,8 @@ async function musicImport(t, place, kind) { if (!res.ok) throw new Error(body.error || "import failed (" + res.status + ")"); const fileKind = libKind(body.name); if (fileKind !== "audio" && fileKind !== "video") throw new Error("the file isn't audio: " + (body.name || "")); - const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind: fileKind, src: body.src, folderId: null, + // always an audio entry, even in a video container: a music track goes on an A track, with no linked stems + const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind: "audio", src: body.src, folderId: null, license: FableCutMusic.mediaLicense(t) }; try { await loadMediaMetadata(m); ensureWave(m); } catch { /* probeMissingMeta retries */ } if (gen !== runtime.projectGen) throw new Error("another project was opened — the file is in media/"); @@ -3377,13 +3392,7 @@ async function musicImport(t, place, kind) { renderBin(); scheduleSave(); const what = `Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`; const limit = FableCutMusic.warnings(t.license).find((w) => /derivatives|sampled/.test(w)); - let unplaced = ""; - if (place) { - if (!(m.duration > 0 && isFinite(m.duration))) unplaced = "its length couldn't be read, so it's in the Project bin but not on the timeline"; - else if ((project.sequence || null) !== at.seq || compCtxId() !== at.comp) unplaced = "another timeline is open now, so it's in the Project bin but not placed"; - else if (exportBusy()) unplaced = "an export is running, so it's in the Project bin but not placed"; - else if (!addClipFromMedia(m, null, at.t)) unplaced = "it's in the Project bin, but the audio track is locked, so it wasn't placed"; - } + const unplaced = place ? placeImported(m, at) : ""; toast(what + (unplaced ? " — " + unplaced : "") + (limit ? " ⚠ " + limit : "")); } catch (e) { toast(e && e.message ? e.message : "Couldn't import it"); @@ -3402,7 +3411,8 @@ function copyCredits(lines) { function syncExportCredits() { const box = $("exportCredits"); if (!box) return; - const list = FableCutMusic.credits(usageDoc(), MediaLib.usageCounts(usageDoc())); + // the edit being exported: the open sequence and the comps it places, not other sequences + const list = FableCutMusic.credits(project, FableCutMusic.editUsage(project)); box.classList.toggle("hidden", !list.length); box.innerHTML = ""; if (!list.length) return; @@ -3425,10 +3435,14 @@ function syncExportCredits() { } } /** The online search (box, filters, chips, results) for one kind, appended to the bin's list. */ -function appendOnlineSearch(kind) { +/** The online search box's focus and selection, read before the list is cleared. */ +function searchFocus() { + const a = document.activeElement; + return a && (a.id === "musicQuery" || a.id === "sfxQuery") ? { start: a.selectionStart, end: a.selectionEnd } : null; +} +function appendOnlineSearch(kind, focus) { const s = onlineSearch[kind], list = els.libList, sfx = kind === "sfx"; const qid = sfx ? "sfxQuery" : "musicQuery"; - const focused = document.activeElement && document.activeElement.id === qid; const form = document.createElement("form"); form.className = "music-search"; form.innerHTML = ` @@ -3453,7 +3467,7 @@ function appendOnlineSearch(kind) { musicSearch(kind, false); }); list.appendChild(form); - if (focused) { q.focus(); q.setSelectionRange(q.value.length, q.value.length); } + if (focus) { q.focus(); try { q.setSelectionRange(focus.start ?? q.value.length, focus.end ?? q.value.length); } catch { } } if (!s.tracks.length && !s.busy) { const moods = document.createElement("div"); @@ -3534,8 +3548,9 @@ function appendOnlineSearch(kind) { } function renderMusicTab() { if (state.binTab !== "music") return; + const focus = searchFocus(); els.libList.innerHTML = ""; - appendOnlineSearch("music"); + appendOnlineSearch("music", focus); } /* ═══════════════════════════ PROJECTS (dashboard) ═══════════════════════════ */ diff --git a/docs/demo/app.js b/docs/demo/app.js index 8b20f60cf..cc776537a 100644 --- a/docs/demo/app.js +++ b/docs/demo/app.js @@ -2766,7 +2766,10 @@ async function setMediaSource(m, src, mode, name) { if (mode === "replace") { m.name = name || MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; - delete m.license; // another file: the old track's licence and credit don't apply (a relink keeps it) + // another file: the old track's licence doesn't apply (a relink keeps it); the new file's + // does, when another entry imported it with one (Music / SFX tab) + const same = project.media.find((x) => x !== m && x.license && x.src === src); + if (same) m.license = { ...same.license }; else delete m.license; } mediaOffline.delete(m.id); reloadMediaSource(m, oldSrc); @@ -3200,10 +3203,11 @@ function renderLibrary() { // a library listing that arrives after the user moved to a tab drawn elsewhere must not replace it if (dir === "project" || dir === "music" || dir === "shapes" || dir === "templates") return; const files = runtime.library[dir] || []; + const focus = searchFocus(); els.libList.innerHTML = ""; if (dir === "sfx") { // online sound effects (Openverse) first, then the library's own files - appendOnlineSearch("sfx"); + appendOnlineSearch("sfx", focus); const head = document.createElement("div"); head.className = "music-status lib-head"; head.textContent = files.length ? `Your library — library/sfx (${files.length})` : "Your library — drop files into library/sfx/ to keep them here."; @@ -3347,19 +3351,29 @@ function musicTogglePreview(t, btn) { musicPreview = { id: t.id, audio: a }; } /** Download a track into media/ and register it with its licence; place = add at the playhead too. */ +/** Put an imported track at `at` (the timeline and playhead of the click) → "" when placed, + * else why not. Never on another timeline, during an export, without a known length or on a locked track. */ +function placeImported(m, at) { + if (!(m.duration > 0 && isFinite(m.duration))) return "its length couldn't be read, so it's in the Project bin but not on the timeline"; + if ((project.sequence || null) !== at.seq || compCtxId() !== at.comp) return "another timeline is open now, so it's in the Project bin but not placed"; + if (exportBusy()) return "an export is running, so it's in the Project bin but not placed"; + if (!addClipFromMedia(m, null, at.t)) return "it's in the Project bin, but the audio track is locked, so it wasn't placed"; + return ""; +} async function musicImport(t, place, kind) { if (!state.connected) { toast("Importing needs the editor server"); return; } if (musicImporting.has(t.id)) return; + // + places it where the user clicked: that timeline (sequence / comp) and playhead + const at = { seq: project.sequence || null, comp: compCtxId(), t: state.time }; const have = project.media.find((m) => m.license && m.license.openverse === t.id); if (have) { - if (place) addClipFromMedia(have, null, state.time); - else toast(`“${have.name}” is already in the project`); + const why = place ? placeImported(have, at) : ""; + toast(`“${have.name}” is already in the project` + (why ? " — " + why : "")); return; } musicImporting.add(t.id); renderOnlineTab(kind); - // + places it where the user clicked: that timeline (sequence / comp) and playhead - const gen = runtime.projectGen, at = { seq: project.sequence || null, comp: compCtxId(), t: state.time }; + const gen = runtime.projectGen; try { const res = await fetch("/api/import-url", { method: "POST", headers: { "Content-Type": "application/json" }, @@ -3369,7 +3383,8 @@ async function musicImport(t, place, kind) { if (!res.ok) throw new Error(body.error || "import failed (" + res.status + ")"); const fileKind = libKind(body.name); if (fileKind !== "audio" && fileKind !== "video") throw new Error("the file isn't audio: " + (body.name || "")); - const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind: fileKind, src: body.src, folderId: null, + // always an audio entry, even in a video container: a music track goes on an A track, with no linked stems + const m = { id: "m_" + uid(), name: `${t.title} — ${t.creator}`, kind: "audio", src: body.src, folderId: null, license: FableCutMusic.mediaLicense(t) }; try { await loadMediaMetadata(m); ensureWave(m); } catch { /* probeMissingMeta retries */ } if (gen !== runtime.projectGen) throw new Error("another project was opened — the file is in media/"); @@ -3377,13 +3392,7 @@ async function musicImport(t, place, kind) { renderBin(); scheduleSave(); const what = `Imported “${t.title}” — ${t.license.label}: ${t.flags.join(", ")}`; const limit = FableCutMusic.warnings(t.license).find((w) => /derivatives|sampled/.test(w)); - let unplaced = ""; - if (place) { - if (!(m.duration > 0 && isFinite(m.duration))) unplaced = "its length couldn't be read, so it's in the Project bin but not on the timeline"; - else if ((project.sequence || null) !== at.seq || compCtxId() !== at.comp) unplaced = "another timeline is open now, so it's in the Project bin but not placed"; - else if (exportBusy()) unplaced = "an export is running, so it's in the Project bin but not placed"; - else if (!addClipFromMedia(m, null, at.t)) unplaced = "it's in the Project bin, but the audio track is locked, so it wasn't placed"; - } + const unplaced = place ? placeImported(m, at) : ""; toast(what + (unplaced ? " — " + unplaced : "") + (limit ? " ⚠ " + limit : "")); } catch (e) { toast(e && e.message ? e.message : "Couldn't import it"); @@ -3402,7 +3411,8 @@ function copyCredits(lines) { function syncExportCredits() { const box = $("exportCredits"); if (!box) return; - const list = FableCutMusic.credits(usageDoc(), MediaLib.usageCounts(usageDoc())); + // the edit being exported: the open sequence and the comps it places, not other sequences + const list = FableCutMusic.credits(project, FableCutMusic.editUsage(project)); box.classList.toggle("hidden", !list.length); box.innerHTML = ""; if (!list.length) return; @@ -3425,10 +3435,14 @@ function syncExportCredits() { } } /** The online search (box, filters, chips, results) for one kind, appended to the bin's list. */ -function appendOnlineSearch(kind) { +/** The online search box's focus and selection, read before the list is cleared. */ +function searchFocus() { + const a = document.activeElement; + return a && (a.id === "musicQuery" || a.id === "sfxQuery") ? { start: a.selectionStart, end: a.selectionEnd } : null; +} +function appendOnlineSearch(kind, focus) { const s = onlineSearch[kind], list = els.libList, sfx = kind === "sfx"; const qid = sfx ? "sfxQuery" : "musicQuery"; - const focused = document.activeElement && document.activeElement.id === qid; const form = document.createElement("form"); form.className = "music-search"; form.innerHTML = ` @@ -3453,7 +3467,7 @@ function appendOnlineSearch(kind) { musicSearch(kind, false); }); list.appendChild(form); - if (focused) { q.focus(); q.setSelectionRange(q.value.length, q.value.length); } + if (focus) { q.focus(); try { q.setSelectionRange(focus.start ?? q.value.length, focus.end ?? q.value.length); } catch { } } if (!s.tracks.length && !s.busy) { const moods = document.createElement("div"); @@ -3534,8 +3548,9 @@ function appendOnlineSearch(kind) { } function renderMusicTab() { if (state.binTab !== "music") return; + const focus = searchFocus(); els.libList.innerHTML = ""; - appendOnlineSearch("music"); + appendOnlineSearch("music", focus); } /* ═══════════════════════════ PROJECTS (dashboard) ═══════════════════════════ */ diff --git a/docs/demo/music.js b/docs/demo/music.js index 2878efe8c..6fc2e1e06 100644 --- a/docs/demo/music.js +++ b/docs/demo/music.js @@ -101,10 +101,11 @@ for (const k of Object.keys(kind)) p.set(k, kind[k]); if (opts.length && LENGTHS[opts.length]) p.set("length", opts.length); // commercial / edits pick licence codes by FableCut's own table: Openverse's "commercial" group - // includes Sampling+, which FableCut labels non-commercial for a whole track + // includes Sampling+, which FableCut labels non-commercial for a whole track. edits means "may + // go under a video as it is", so it leaves out ND and the Sampling licences. let lic = (opts.licenses || []).map((l) => String(l).toLowerCase()).filter((l) => LICENSES[l]); if (opts.commercial || opts.edits) { - const ok = (c) => (!opts.commercial || LICENSES[c].commercial) && (!opts.edits || LICENSES[c].edits); + const ok = (c) => (!opts.commercial || LICENSES[c].commercial) && (!opts.edits || (LICENSES[c].edits && !LICENSES[c].sampling)); const picked = (lic.length ? lic : Object.keys(LICENSES)).filter(ok); if (!picked.length) throw new Error("none of those licences allow " + [opts.commercial && "commercial use", opts.edits && "edits"].filter(Boolean).join(" and ")); lic = picked; @@ -189,6 +190,27 @@ (l.url ? ` (${l.url})` : "") + (l.page ? ` — ${l.page}` : ""); } + /** How often each media file is placed in the edit itself: the open sequence's clips and the + * compositions placed in it (nested ones too) — not other sequences or comps nothing places. + * A linked group counts once. → Map(media id → placements) for `credits`. */ + function editUsage(doc) { + const n = new Map(), comps = new Map(((doc && doc.comps) || []).map((c) => [c.id, c])); + const scan = (clips, depth, inComps) => { + const seen = new Set(); + for (const c of clips || []) { + if (c.kind === "comp" && comps.has(c.compId) && depth < 8 && !inComps.has(c.compId)) + scan(comps.get(c.compId).clips, depth + 1, new Set([...inComps, c.compId])); + if (!c.mediaId) continue; + const key = (c.linkGroup ? "g:" + c.linkGroup : "c:" + c.id) + "|" + c.mediaId; + if (seen.has(key)) continue; + seen.add(key); + n.set(c.mediaId, (n.get(c.mediaId) || 0) + 1); + } + }; + scan(doc && doc.clips, 0, new Set()); + return n; + } + /** The credits an edit needs: every licensed file the edit uses (a denoised * copy counts as its original, and its credit says the sound was changed). * uses: media id → placements (MediaLib.usageCounts). @@ -220,5 +242,5 @@ const ABOUT = "Music from Openverse (openverse.org) — made with Openverse, not endorsed or certified by it. Each track's licence is the artist's: check it before you publish."; return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, SFX_WORDS, LICENSES, ABOUT, - licence, flags, warnings, webUrl, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; + licence, flags, warnings, webUrl, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, editUsage, credits }; }); diff --git a/docs/docs/captions/index.html b/docs/docs/captions/index.html index 6d1e7b9ff..033a7b4e9 100644 --- a/docs/docs/captions/index.html +++ b/docs/docs/captions/index.html @@ -82,7 +82,7 @@

Captions

Captions timed word by word from the transcript, in four styles, burned into the picture; SRT and WebVTT out and in.

Captions are made from a transcript (see Transcripts and text-based editing): the timeline's words are grouped into captions, and each caption is an ordinary text clip with wordTimes (each word's start and end), so its animation follows the speech word by word, and caption: true, so captions can be found, replaced and exported as a group. Because they are text clips they render the same way in preview and export (burned into the picture), and the Inspector restyles them like any title.

stylelook
subtitle (default)plain text on a dark bar, low on the frame, up to two lines
karaokebold outlined text; each word lights up as it is said
highlightbig uppercase outlined words, the one being said in a colour (highlightColor) - the short-video look; up to five words
popone to three big words at a time, each popping in as it is said

A new caption starts at a pause of 0.6 s or more, after a sentence, after a comma once it has three words, or when it would run too long (lines, words or seconds). Lines are as long as fit the canvas at the style's size: sizes follow the canvas's shorter side, so a 9:16 reel gets narrower captions than a 16:9 video. Each caption stays about a quarter of a second after its last word, never into the next one, and starts and ends on whole frames.

They go on the video lane captions are already on; otherwise on the top video lane when nothing is there while they run, else on a new lane above it. Making captions again replaces the ones there. Make them after the cutting is done: a cut through a caption shortens it but doesn't re-time its words, so make them again after you change the edit. The editor says so for a moment whenever an edit shortens a caption.

In the editor, the Captions row of the Transcript tab: pick a style, then Add captions (one undo step). SRT and VTT download the timeline's captions as a subtitle file; Import… places the captions of an SRT or WebVTT file instead, re-broken to the style's line length, with their words spread over each caption. Select a caption to restyle it in the Inspector: the Highlight colour sits under Animation, and a note says its words follow the speech.

Agents use fablecut_captions:

  • {} or {style:"highlight"} makes captions from every clip with sound (transcribing what has no transcript yet, as fablecut_transcribe does), and answers with where they went and the first few. clipIds, from / to limit it; lines, words and size (a scale on the style's size) adjust it; track picks the lane; replace:false keeps the captions already there.
  • {export:"srt"} or {export:"vtt"} writes the captions that show (not disabled, not on a disabled track) to exports/<project name>.srt or .vtt, adding a number when that name is taken (<project name> 2.srt), and returns the path: use that one.
  • {import:"<path to .srt or .vtt>"} places a file's captions (the file's text works too).
  • {remove:true} deletes every caption clip. Locked captions are left alone and refuse the call unless force:true.
  • Check one with fablecut_frame {time} while a word is being said. Restyle them all with updateClip (e.g. props:{highlightColor:"#22d3ee", y:500}) on each caption id from the compact view, which lists a caption as [5 words timed to speech] instead of its times.
diff --git a/docs/docs/color/index.html b/docs/docs/color/index.html index 2ddaa0af1..b58f5cef1 100644 --- a/docs/docs/color/index.html +++ b/docs/docs/color/index.html @@ -87,7 +87,7 @@

Color

"exposure": -0.6 } ]
keydoes
name · ona label; on:false turns the layer off
qualifier.hue[centre°, width°, soft°] - hues within ±width/2 of the centre, easing out over soft; wraps through red. Greys carry no hue, so a hue range leaves them out
qualifier.sat · qualifier.luma[low, high, soft] on 0…1 - saturation (HSV) / Rec.709 luma between low and high
qualifier.invertselect everything else
mask.shapeellipse · rect · poly · bezier (or freehand with a stroke, fitted into a bezier - see Masks)
mask.x · mask.ycentre, as fractions of the clip's picture (0…1, y down)
mask.w · mask.hsize, fractions of the picture's width / height (ellipse, rect)
mask.rotationdegrees, clockwise
mask.feathersoft edge, a fraction of the picture's height (0…0.5), centred on the outline
mask.pointspoly: 3–16 [dx, dy] corners around x, y (fractions of width / height); bezier: 3–24 anchors [dx, dy] or [dx, dy, inX, inY, outX, outY] with curve handles
mask.invertgrade outside the shape
mask.keysanimate it: [{t, x?, y?, w?, h?, rotation?, feather?, ease?}], t in seconds from the clip's start; each param eases between the keys that set it (ease on the arriving key, as for clip keyframes)

Masks live in the clip's own picture, so they follow the clip when it is moved, scaled, rotated, cropped or flipped. On an adjustment layer they are fractions of the canvas.

In the editor the strip under Copy / Paste lists Primary and the layers; + Layer adds one. With a layer picked, the wheels, sliders and curves edit that layer, and three more sections appear: the layer's name, On, Matte (the monitor shows what it selects, white = graded), ↑ ↓ to reorder, Delete; Qualifier - Pick then click a colour in the monitor to select its hue, saturation and luma, then tune the ranges; and Mask - pick a shape and drag it on the monitor (inside moves it, the handles resize it, the knob rotates it, Shift snaps to 15°; on a poly or bezier, Ctrl-click adds a point and double-click removes one), or Draw a free-hand outline on the monitor (it becomes a bezier). ◆ Key keys the shape at the playhead; once it has keys, every change to the shape keys.

Wheel colours. A wheel's r, g, b normally carry no brightness: they are a point on the vectorscope's Cb / Cr plane, so pushing a wheel toward a colour moves the picture's trace toward that colour's target. To tint shadows teal by about 0.03: lift: [-0.034, 0.008, 0.012, 0] (r = 1.5748·Cr, g = −0.1873·Cb − 0.4681·Cr, b = 1.8556·Cb, with Cb = 0.0065, Cr = −0.0216 here). Small values go a long way - ±0.02…0.05 on lift and offset, ±0.05…0.15 on gamma and gain.

Agents set a grade with the patch op setGrade and check it with fablecut_scopes:

  • {op:"setGrade", id:"c_a", grade:{exposure:0.3, temp:-15, contrast:1.15}} - merges into the clip's grade key by key; null on a key resets it; replace:true starts from neutral; grade:null clears it; ids:[…] grades several clips at once. curves merges per channel: grade:{curves:{r:[[0.5, 0.55]]}} keeps the other channels, curves:{y:null} removes the luma curve. layers replaces the whole layer list. Unknown keys or bad values refuse the whole patch. Locks apply (force:true as elsewhere).
  • {op:"setGradeLayer", id, layer, set:{…}} edits one layer: layer is an index (0 = first) or a name. A name that isn't there yet - or the index one past the end - adds a layer. set takes any layer key and merges like setGrade; qualifier and mask also merge key by key (mask:{x:0.6} moves it, qualifier:{luma:null} drops the luma range). replace:true starts the layer from scratch (keeping its name), remove:true deletes it. ids:[…] works too.
  • fablecut_scopes {time} renders the graded frame at time (default: the playhead) exactly as export would - an open editor tab, else headless - and returns numbers: luma min / 1st percentile / median / mean / 99th percentile / max (0–1), the % of pixels at pure black and pure white, mean R/G/B, average saturation, and the midtones' colour cast (hue name, hue angle, strength; "neutral" below 0.01), plus the clips on screen and their grades. With an exportFrame it measures the delivered crop.
  • fablecut_scopes {time, matte:{clip, layer}} also measures what one layer selects: the matte's coverage (% of that clip's own picture, measured alone - other clips and adjustment layers don't count) and the levels, mean RGB, saturation and cast of the selected pixels after grading. A coverage near 0 means the qualifier or mask misses; check it before trusting a secondary.

Reading the numbers: a normally exposed shot has its median near 0.35–0.5; whitePct above ~1 means clipped highlights (lower highlights / whites, or add highSoft); blackPct above ~2 means crushed shadows. A cast strength above ~0.03 on a scene that should be neutral wants white balance: move temp against the cast (orange / yellow → lower temp; blue / cyan → raise it) and tint against green / magenta, then measure again.

Secondary workflow: grade the whole shot first (primary), then add a layer for the one thing that needs its own correction - e.g. skin: {op:"setGradeLayer", id, layer:"Skin", set:{qualifier:{hue:[25, 40, 20], sat:[0.12, 0.7, 0.1]}, saturation:92}}, then fablecut_scopes {matte:{clip:id, layer:0}} - expect a coverage that matches how much of the frame is skin and a cast near orange (hue ~25–35°). A sky: qualifier:{hue:[210, 50, 25], luma:[0.45, 1, 0.1]} with hueSat:[[210, 1.25]]. A vignette or a relight: a feathered ellipse mask with invert:true and exposure:-0.5, or without invert and exposure:+0.3 on a face; give it keys to follow a move.

Workflow for matching shots: grade the hero shot, measure it, then grade every other shot of the scene until its median and cast land near the hero's. In the editor, Copy / Paste on the Color tab pastes one clip's grade onto every selected clip.

diff --git a/docs/docs/compositing/index.html b/docs/docs/compositing/index.html index 748d4d3f8..02e57d3cb 100644 --- a/docs/docs/compositing/index.html +++ b/docs/docs/compositing/index.html @@ -82,7 +82,7 @@

Track mattes and blending

Cut a clip with the picture on another track by its alpha or its brightness, and lay clips over each other with blend modes, from the Inspector or from an agent with setMatte.

A track matte cuts a clip with the picture on another track: where that picture is opaque (alpha) or bright (luma), the clip shows. Set it on the clip being cut, the fill:

propdoes
mattealpha · alpha-inverted · luma · luma-inverted. Alpha keeps the clip where the matte's pixels are opaque, luma where they are bright (white = shows, black = gone, Rec. 709 weights). The inverted modes keep the opposite
matteTrackthe video track the matte comes from. Default: the video track directly above the clip (V2 for a clip on V1)

The matte track does not draw into the frame while a clip on screen uses it; it only cuts. Its clips keep their own transform, keyframes, opacity, masks and effects, so the matte can move, scale and animate on its own. When the matte track has nothing at that moment, alpha / luma show nothing of the clip and the inverted modes show all of it. Track mattes and masks combine: the matte cuts the clip, then its masks cut what is left, then opacity and blend composite it. A clip used as a matte is drawn without its own track matte. Audio clips take neither.

blend is how a clip lays over what is under it: normal · multiply · screen · overlay · darken · lighten · color-dodge · color-burn · hard-light · soft-light · difference · exclusion · hue · saturation · color · luminosity · lighter (add). Blending happens after masks and mattes, so a masked clip only blends where it is kept.

In the editor, Track matte and Matte track sit under Blend in the Inspector's Transform section (the Adjustment layer section for an adjustment layer). The timeline marks a clip with a track matte ◐ and shows the clips that serve as its matte hatched, labelled Matte.

Agents: {op:"setMatte", id, matte:"luma"} (or ids:[…]; track:"V3" picks the matte track, track:null goes back to the one above; matte:null removes it). blend, matte and matteTrack written through addClip / updateClip are validated too. fablecut_scopes lists each clip on screen with its matte (e.g. luma from V2), blend, and whether it is a matte itself.

Recipes: text filled with video - the text on V2, the video on V1 with matte:"alpha"; a shape reveal - an svg or a masked solid on V2 whose scale keys up, the shot on V1 with matte:"alpha"; light leaks / film burn on V2 with blend:"screen"; a grade only in the bright areas - an adjustment layer with matte:"luma" over a copy of the shot; a cut-out through a texture - luma-inverted against a black-and-white texture.

diff --git a/docs/docs/compositions/index.html b/docs/docs/compositions/index.html index 7f602915f..126364cde 100644 --- a/docs/docs/compositions/index.html +++ b/docs/docs/compositions/index.html @@ -95,7 +95,7 @@

Compositions (nested sequences)

"props": { "fit": "none", "y": 220 } } ]
keydefaultdoes
id · name- · the idhow clips and agents refer to it · the label shown on its clips and in the bin
width · heightthe project'sthe comp's frame, px (16…8192)
duration-seconds; what the comp shows past its clips is transparent (or its background)
backgroundnonea colour behind the comp's clips; leave it out for transparent
tracksV3…V1, A1, A2the comp's own lanes, like the project's tracks
clips[]ordinary clips of any kind (comp clips too), with times inside the comp
template-set on a placed template: {id, hold, fields} (see Presets and templates)

A comp clip (kind:"comp", compId, no mediaId) shows the comp from its in (comp seconds) for its duration, at speed 1. It draws like a picture of the comp's size: fit defaults to none (the comp's own pixels), and its transform, keyframes, opacity, transitions, masks, track matte, blend, grade and filters all apply to the comp's frame as a whole. Trims and splits move its in like a video clip's; the window can't run past the comp's length.

The media inside a comp plays and exports as if it were on the timeline: its video frames, and its audio, which goes through the main timeline's audio track of the same name (its fader, effects and bus). A comp clip that is disabled, or sits on a disabled track, silences the comp's audio too. Comps nest up to 4 deep, and a comp can never contain itself.

In the editor: the bin's Project tab lists the comps; drag one onto the timeline to place it, and double-click it (or a comp clip, or Open in the Inspector's Composition section) to open it. An open comp takes over the timeline: every tool, shortcut and inspector works on its clips, and the breadcrumb above the timeline (or Esc, once nothing is selected) goes back out. Right-click clips → Precompose moves them into a new comp and puts a comp clip in their place; right-click the Project tab → New composition starts an empty one. The Composition section also sets the comp's name, size, length and background.

Agents:

  • {op:"addComp", comp:{id?, name, duration, width?, height?, background?, tracks?, clips?:[…]}} adds one (its clips go through the same checks as addClip). {op:"updateComp", id, set:{name?, width?, height?, duration?, background?, tracks?}} changes it; {op:"removeComp", id} is refused while a clip still uses it.
  • Place it with addClip {kind:"comp", compId, track, start, duration, in?}.
  • {op:"inComp", comp, ops:[…]} runs clip and timeline ops on the comp's own clips: addClip, updateClip, removeClip, split, rippleDelete, the trims, setShape, setMask, setGrade, setParent, setMotionPath, setTextPath, clip setFx, precompose, and inComp for a comp inside it.
  • {op:"precompose", ids:[…], name?, id?} moves those clips (here, or in the comp an inComp is running in) into a new comp that starts at the earliest of them; a comp clip of the same length takes their place.
  • The compact view shows a comp clip as comp(lt in:1.5) and lists every comp under COMPS with its clips.

Recipes: reusable lower third - a template (next section) gives every speaker their own copy with their own name; a plain comp suits a graphic that is the same every time; logo sting - a draw-on logo comp at the head and tail of the edit; picture in picture of a whole scene - precompose the scene's clips, then scale the comp clip down and move it into a corner; one grade for a sequence - precompose it and grade the comp clip once.

diff --git a/docs/docs/editing/index.html b/docs/docs/editing/index.html index 7f79780da..f7068aff7 100644 --- a/docs/docs/editing/index.html +++ b/docs/docs/editing/index.html @@ -82,7 +82,7 @@

Editing rules

How tracks, links, locks, targeting and the trim tools behave, for people and agents alike.

  • Rendering order: V1 is drawn first, then V2, V3, … on top. SVG/image/text clips go on any V track (higher V lanes are handy overlay lanes). Add lanes with the timeline +V / +A buttons (or by listing them in tracks); up to 16 per kind. Right-click an empty track header → Remove track (disabled if the lane has clips or is the last video/audio track).
  • Audio tracks A1–An hold both standalone audio files and linked companions for imported video. Dropping a video creates the picture on a V track (props.volume: 0 so it isn't doubled) plus one kind:"audio" clip per source channel on consecutive A-tracks that share a linkGroup (and the same mediaId / timing). Each stem is mono-isolated then placed with pan (defaults preserve stereo: L −1, R +1). Standalone music/SFX also live on A-tracks. Linked partners move/trim/split together - edit timing on any member of the group; do not treat A-tracks as music-only.
  • Three track switches (Premiere-style), all in the track header and all persisted on project.json:
    • Enable (eye / speaker) → disabledTracks. Output only: a disabled lane is left out of preview, audio and export. It does not affect editing.
    • Target (click the track name - lit = targeted) → untargetedTracks. Decides which lanes an edit touches when nothing is selected: split at playhead (S), insert ripple (,), replace punches (.), ripple-delete shifting (⇧Del), close gap (⇧G), next gap (G), split / trim at IN/OUT (T / ⇧T) and jump to cut (↑ / ↓). Source placement follows targeting too: the picture lands on V1 if it is targeted, else the lowest targeted video lane (none → the edit lands audio-only); stems land on the first two targeted audio lanes. A selection is always edited wherever it sits.
    • Lock (padlock) → lockedTracks. Nothing on a locked lane can be moved, trimmed, split, deleted or edited in the inspector, and ripples leave it where it is while the other lanes shift. A locked lane is never an edit target. Typical use: lock the music bed, then ripple the picture freely.
  • Clip lock / enable - right-click a clip, or use the toggles at the top of the inspector. locked: true pins one clip the same way a locked lane does. disabled: true (⇧E) keeps the clip on the timeline but drops it from preview, audio and export - like a disabled lane, for a single clip. Both apply to the clip's whole linked group.
  • Locks and linked groups - a linked A/V group with any locked member (its own flag or its lane) counts as locked as a whole, so sync is never broken by a partial move.
  • Sync lock - edits that shift clips move the targeted lanes; linked AV partners always ride along, even on an untargeted lane, and locked groups stay put. On reload relinkClips rebuilds linkGroup from matching mediaId / start / in / duration.
  • Unlink / link (Ctrl/Cmd+L) - unlinking a group removes its linkGroup and stamps unlinked: true on each member, so the reload-time relink leaves them apart; picture and audio then move, trim and delete separately. Link (select one video clip plus its audio, Ctrl/Cmd+L) only joins clips of the same file that line up exactly - same start, in and duration - because a link here means identical timing.
  • Agents and locks - fablecut_patch_project refuses updateClip / removeClip on locked material (own flag, locked lane, or a linked partner of one) and addClip onto a locked lane. Treat locked clips as the user's finished work: leave them alone. Only when the user asks you to change one, pass force: true on that op, or unlock first with updateClip set:{locked:null} (always allowed). fablecut_set_project, REST PUT and direct file edits are not guarded - respect locks there too.
  • Media is fit-ted to the canvas (default "contain"), then crop → scale/x/y/ rotation → flips apply.
  • props keys are all optional - missing keys get the defaults above.
  • Video/audio clips must satisfy in + duration×speed ≤ media.duration.
  • Keyframes fully override the static prop value while present; they are clip-local and are re-based automatically when clips are split or trimmed.
  • Transitions modulate the evaluated props (fade also fades audio); they render on top of keyframes, so both can coexist.
  • Same-track overlap IS the crossfade idiom: overlap A and B by ~1 s and give B transitionIn: {type:"fade"} (for audio also A transitionOut, both with curve:"power" - see Audio mix).
  • A cut/split is just two clips: first with duration: t, second with start: +t, in: +t×speed, duration: rest.
  • Edit tools (timeline toolbar picker, or V / B / R / Y / U) change what a clip drag does. Agents run the same edits with the patch ops rippleTrim, roll, slip and slide (see Timeline edit ops).
    • Selection (V) - move and trim, as always.
    • Ripple edit (B) - drag a clip edge; everything after it on the targeted tracks (and the clip's own lanes) moves with it, so no gap opens or closes. Dragging a head keeps the clip's start and trims its source In.
    • Rolling edit (R) - drag a cut; the clip on one side lengthens by what the other loses, nothing else moves.
    • Slip (Y) - drag a clip to change its source In only (dragging left shows later source); position and length stay. Video / audio clips only.
    • Slide (U) - drag a clip along its track; the clip before it trims its tail and the clip after it its head, so the sequence length stays. All four are clamped to the available source media, MIN_DUR and the free room on the track, take linked partners with them, and refuse on locked clips; a readout by the pointer shows the offset while dragging.
  • Lift (;) / Extract (') - remove IN→OUT on the targeted tracks. Lift leaves the gap; Extract closes it. Linked partners are cut too, locked clips stay whole, and IN / OUT clear afterwards.
  • Jump to cut - ↑ / ↓ move the playhead to the previous / next clip In or Out. Selection first (that clip’s start then end); no selection walks targeted-track cuts. Source monitor: 0 / In / Out / duration. Does not change project.json.
  • bgRemove and chromaKey can combine with all filters; heavy pixel work is automatic (only runs when those props are set).
diff --git a/docs/docs/export/index.html b/docs/docs/export/index.html index 456013dc9..eb5ff85bb 100644 --- a/docs/docs/export/index.html +++ b/docs/docs/export/index.html @@ -128,7 +128,7 @@

Export

} }

Export is one ffmpeg pass. The server owns the input side and the output path; args is everything in between (plus JPEG color conversion derived from color):

ffmpeg -y -f image2pipe -framerate <fps> -i - [-i audio.wav] <jpeg-color> <args…> exports/<name><extension>
  • There is no allow-list. Any codec, filter, container or flag your local ffmpeg supports works - ProRes, DNxHD, NVENC/QSV/VideoToolbox, VP9/AV1, 10-bit, HDR tags. See the shipped prores422, broadcast1080i50, nvenc-h264, nvenc-hevc, videotoolbox-h264 and videotoolbox-hevc profiles (the NVENC ones need an NVIDIA GPU; VideoToolbox requires macOS / Apple Silicon).
  • Args are validated by ffmpeg itself, not by a schema: when an export starts the server dry-runs the profile against a 0.1 s synthetic input (lavfi). A typo or an encoder your build lacks is rejected up front with ffmpeg's own message, instead of failing after every frame has been rendered.
  • Use the array form - each element is passed to spawn untouched, so no quoting is needed (["-vf", "drawtext=text='hi there'"] just works). A plain string is accepted and split on whitespace.
  • color controls JPEG→YUV conversion and stream tags (-colorspace / -color_primaries / -color_trc / -color_range). Default is BT.709 limited (range: "tv"). Use "range": "pc" for full-range masters. Do not put those flags in args - the engine strips them and applies color so vf and tags stay aligned. -pix_fmt stays in args (sampling / bit depth only).
  • Nothing else is injected for you: +faststart, -shortest, -strict -2 for Opus in MP4 and pixel-format choices are all yours to write.
  • Frames arrive as JPEG (4:2:0), so yuv422p/yuv444p cannot recover chroma the source never had; raise jpegQuality before reaching for a wider pixel format. Optional pixelFormat:"rgba" on /api/export/begin pipes uncompressed canvas frames instead (-f rawvideo) when a caller wants full chroma.
  • The audio mix is only present when the timeline has audio; with no audio there is a single input, so avoid hardcoded -map 1:a.

Note: Fast export pipes composited JPEG frames from the browser (-f image2pipe), not -i source.mp4. Filters and codec settings apply to that frame stream. To transcode an existing file verbatim, run ffmpeg directly - that is outside the compositor path.

Encoding profiles are listed at the bottom of the Export dialog's Preset list.

What the Export dialog opens on (priority):

  1. project.delivery, then project.encodeProfile - set with setProject
  2. The last preset or profile used in this browser
  3. The master delivery preset

MCP: fablecut_encode_profiles lists profiles; {detail:true} includes each args array; {profile:"hq"} returns one profile. fablecut_status shows the effective profile.

diff --git a/docs/docs/frames/index.html b/docs/docs/frames/index.html index a55890fa7..3ac6b25b8 100644 --- a/docs/docs/frames/index.html +++ b/docs/docs/frames/index.html @@ -82,7 +82,7 @@

Look at the footage

Show an agent what the footage holds: one frame, a contact sheet across a clip, or the composed timeline - as an image, or as text-only measurements for models without vision.

fablecut_analyze_reference gives you the ears - where the cuts are, how hard each shot hits. fablecut_frame gives you the eyes. It answers with a real image (an MCP image content block), so you can judge a shot instead of inferring it from an energy value.

callreturns
{path:"/media/x.mp4", t:3.2}that exact frame
{path:"/media/x.mp4", frames:12}a 4×3 contact sheet across the whole clip
{path:"/media/x.mp4", frames:12, from:30, to:90}a contact sheet across part of it
{time:8.5} (no path)the composed timeline at 8.5 s, graded, all tracks
{path} with an absolute paththe file is read in place without copying into media/
{path, text:true}text-only statistics (luma, colors, texture, saturation, motion) for non-vision agents

Each answer leads with a text line naming the source, the timestamp(s) and (in timeline mode) the clips on screen, so you always know what you are looking at. width sets the pixel width (default 768 for one frame, 320 per contact-sheet cell); text:true returns descriptive statistics instead of an image block, for agents without vision capability - luma levels (min, p1, median, mean, p99, max, all 0–1 like fablecut_scopes), dominant colors, texture, saturation and per-cell motion; where/timeout apply to timeline mode only.

The REST endpoint /api/frame accepts src, t, frames, from, to, w, q (JPEG quality 1–31) and text=1 (statistics mode) as query parameters.

When it pays. Before choosing a clip's in point, sample a few candidate moments - the blueprint tells you a shot spans 2.1 s–4.9 s and reads energy: 88, but only a frame tells you whether that is a car jump or a pan across a landscape. Contact sheets are the cheap survey: one call shows you what a whole 3-minute clip holds, then you grab single frames where it matters. Timeline mode answers "what did I actually build?" - the same picture the user sees and export renders, grades and transitions included.

Needs ffmpeg on PATH for the source modes. Timeline mode runs in the open editor tab, else a headless browser, like fablecut_export.

diff --git a/docs/docs/masks/index.html b/docs/docs/masks/index.html index 93535cc76..0d3fce460 100644 --- a/docs/docs/masks/index.html +++ b/docs/docs/masks/index.html @@ -88,7 +88,7 @@

Masks

"keys": [{ "t": 0, "x": 0.3 }, { "t": 2, "x": 0.6, "ease": "linear" }] } ]
keydefaultdoes
shape-rect · ellipse · bezier (write freehand with a stroke to have one drawn for you)
x · y0.5centre, as fractions of the clip's picture (0…1, y down)
w · h0.5size, fractions of the picture's width / height (rect, ellipse)
points-bezier: 3–64 anchors around x, y, each [dx, dy] (a corner) or [dx, dy, inX, inY, outX, outY] (with curve handles relative to the anchor), all fractions of the picture's width / height
stroke-freehand only: [[u, v], …] picture fractions along an outline; it is simplified and stored as an editable bezier
scale · rotation1 · 0about the centre; degrees clockwise
modeaddhow this mask combines with the ones before it: add · subtract · intersect · difference
invertfalseuse everything outside the shape
opacity10…1, how strongly this mask counts
feather0soft edge, project pixels, centred on the outline
expand0grow (+) or shrink (−) the outline, project pixels
name · on-a label; on:false turns the mask off
keys-animate it: [{t, x?, y?, w?, h?, scale?, rotation?, feather?, expand?, opacity?, points?, ease?}], t in seconds from the clip's start; each param eases between the keys that set it (ease on the arriving key, as for clip keyframes). points keys morph the outline and need the shape's point count

Masks combine bottom-up (first in the list first). The first one starts from nothing when it adds and from the whole picture otherwise, so a lone subtract cuts a hole in a full picture. At most 8 masks per clip.

The picture a mask lives in is the clip's drawn rectangle for video, image and svg (after fit and crop), the text block for text, and the whole canvas for an adjustment layer. Masks follow the clip when it is moved, scaled, rotated or flipped, and keep the clip's keyframes.

In the editor, the Masks section of the Inspector has + Rect, + Ellipse, Pen (click points on the monitor, drag while placing one to pull curve handles, click the first point or press Enter to close) and Draw (drag a free-hand outline). Matte shows the clip's matte in the monitor (white = visible). Pick a mask's chip to edit it: mode, Invert, the sliders, ↑ ↓ to reorder, Copy, Delete, and on the monitor, drag inside to move it, the edge handles to resize it and the knob to rotate it (Shift snaps to 15°). On a bezier, drag a point to move it, drag its handles to curve it (Alt breaks the pair), Alt-drag a point to pull fresh handles, Ctrl-click the outline to add a point, and double-click a point to remove it. ◆ Key keys the whole mask at the playhead; once it has keys, every change keys. Esc steps back (point, then mask).

Agents edit masks with patch ops:

  • {op:"setMask", id, set:{shape:"ellipse", x:0.5, y:0.45, w:0.4, h:0.7, feather:40}} adds a mask (no mask, an index one past the end or a new name adds one; a new mask needs shape). {op:"setMask", id, mask:"Subject", set:{x:0.6}} edits one, by index (0 = first) or name, merging key by key (null resets a key). replace:true starts it over, keeping its name. ids:[…] edits several clips.
  • A drawn outline: set:{shape:"freehand", stroke:[[0.4, 0.3], [0.6, 0.32], …]}. It is stored as an editable bezier.
  • {op:"setMaskKeys", id, mask, keys:[{t:0, x:0.3}, {t:2, x:0.7}]} animates one (keys:null stops it); {op:"removeMask", id, mask} deletes one.
  • props.masks written through addClip / updateClip is validated the same way. Bad keys, shapes or values refuse the whole patch. Locks apply (force:true as elsewhere).
  • fablecut_scopes {time, mask:{clip}} measures them: the % of the clip's picture its masks keep (the feathered matte, measured alone) and the % of the frame the masked clip covers. The compact project view lists each clip's masks as [2 masks: ellipse feather 40, rect subtract].

Recipes: spotlight - a feathered ellipse on the clip; split screen - two clips on V1 / V2, a rect on the top one covering its half; cut a logo out of the background - a bezier around it, feather 2–4; reveal - a rect whose w (or x) keys from 0 to full; effects only on the face - an adjustment layer with a feathered ellipse, keyed to follow it; vignette through an adjustment layer - an inverted ellipse with feather:200 and the layer's brightness down.

diff --git a/docs/docs/media/index.html b/docs/docs/media/index.html index 3d924a60b..8bc2573fa 100644 --- a/docs/docs/media/index.html +++ b/docs/docs/media/index.html @@ -82,7 +82,7 @@

Media management

File details, search, filters, sorting, tags and collections, where each file is used, relinking missing files, and proxies for heavy footage.

The Project bin knows each file's details and helps find, group and track footage. The bin's organizing (details, favorites, tags, collections, search) changes nothing that plays or exports; moving and trashing the files themselves ("Files on disk" below) does what it says.

Metadata. The editor reads every file in media/ and library/ with ffprobe (via GET /api/media-info) and writes what it finds onto the media entry. These fields are read-only - they describe the file:

keydoes
fpsvideo frame rate (29.97, 25, 59.94 …); absent for stills and audio
codecvideo codec (h264, hevc, prores, vp9 …), or the image format (png, mjpeg)
audioCodec · audioChannels · sampleRatefirst audio stream: codec, channel count (0 = the file has no audio), Hz
size · bitratefile size in bytes · overall bitrate, bits per second
width · height · durationas before; filled in when missing (phone footage shot rotated reports its upright size)

Without ffprobe on PATH only size is filled in; the browser still probes duration, width and height.

Organizing. favorite: true stars a file; tags is a list of free-form labels (at most 24, each up to 32 characters, matched without regard to case). collections at the top of the document group media across folders - a file can be in any number of them, while it sits in one folder (folderId).

Usage. A file's placements are the clips that show it, on the main timeline and inside every composition. A video and the audio stems linked to it count as one placement, so a shot used twice reads "used 2×".

In the editor, the Project tab has:

  • Search - every word must match the name, kind, extension, codec, resolution (3840x2160, 2160p) or a tag; #word matches tags only. Esc clears it.
  • Show - All media · ★ Favorites · Used in the edit · Unused · a kind · a collection · a tag. While searching or filtering, the bin lists the hits flat (each with its folder), with a count and Clear; a collection's view also has Rename and Delete (its media stay).
  • Sort - name (natural: shot 2 before shot 10), kind, duration, resolution, frame rate, codec, audio channels, file size or times used, with ↑ / ↓. Files missing a value sort last either way. Folders keep their tree; the sort applies inside each.
  • ☰ List view - one row per file with columns: name, duration, resolution, FPS, codec, audio, size and uses; click a column heading to sort by it. On a narrow bin the columns drop out right to left; widen the panel to see them all.
  • On each file: ☆ stars it, the uses badge opens its placements. Right-click a file → Open in Source, Find timeline instances (every placement, main timeline and comps, with track and time - click one to jump there, opening its comp if needed), Media info…, favorites, Tags…, Add to / Remove from a collection, New collection…, Remove from project.
  • Right-click a clip on the timeline → Reveal in project scrolls the bin to its file (or its comp), opening folders and clearing a search that hides it.

Offline media. A file is offline when its src names nothing under media/ or library/ - it was moved, renamed or deleted. The editor checks on load and whenever those folders change. An offline file's clips stay where they are: the timeline hatches them red (⚠ Offline), the monitor and the export draw a Media offline slate in the picture's place, and its audio is silent. The bin marks the file OFFLINE, says how many are missing, and the Show filter gains ⚠ Offline. The Export dialog warns before rendering one. Files under media/ may sit in subfolders (/media/archive/a.mp4).

  • Relink points a media entry at the same footage where it is now; clips keep their In points, edits and everything else. Right-click the file → Relink… (or Relink… on the offline banner for all of them). The dialog looks through media/ and library/ for each file - same name, the same name with another extension, a similar name, the same size - and picks a same-name match for you. Browse… picks one file and Choose folder… matches a whole folder by name; either copies the chosen files into media/. A relinked file whose length differs from the original gets a warning (is it really the same footage?).
  • Replace file… (right-click a file) puts a different file behind the media entry - a new render, a better take. Every clip using it switches; each keeps its In point and timing, trimmed to fit a shorter file. The name and details follow the new file; favorites, tags and collections stay. To swap the file of one clip only, use the Inspector's Source menu instead.
  • Relink and replace are one undo step each.

Proxies. Heavy footage - 4K, HEVC, ProRes, long phone clips - can stutter while you scrub and play. A proxy is a light copy the editor plays instead while you edit: H.264 at 540p (or 720p / 1080p, never larger than the source), a keyframe every 12 frames so seeking is quick, the source's own timestamps (frame for frame - no frames added or dropped) and its first audio stream. The edit always refers to the original: the timeline, project.json and every clip stay the same whether proxies are on or off.

Export always reads the originals, and so do fablecut_frame (timeline mode), fablecut_scopes, tracking and every other measurement - the players switch to the original files for the render and back afterwards. A proxy only changes how smoothly the preview runs, never the result.

  • Right-click a video in the bin → Create proxy (540p) / (720p); right-click the Project tab → Create proxies for N videos. ffmpeg makes them on the server one at a time in the background; the bin shows each file's progress (P 42%), then a green P once it is ready. Delete proxy removes one. The bin's list view has a Proxy column, Show has Has a proxy / Video without a proxy, and Media info says which file is playing.
  • The monitor's Proxy button turns proxy playback on and off (on by default; remembered in this browser). The Source monitor follows it too.
  • Proxies live in analysis/proxies/, a disposable cache: each is named after its source file and that file's size and modification time, so a re-rendered or replaced original simply has no proxy until you make a new one. Deleting the folder loses nothing but time. Proxies need ffmpeg.

Agents:

  • {op:"updateMedia", id | ids, set:{name?, favorite?, tags?, folderId?}, addTags?, removeTags?} - organize files (favorite:false unstars; tags:[] clears). Metadata keys are refused: they come from the file.
  • {op:"setCollection", id?, name?, media?, add?, remove?} creates a collection (a new id, or a name no collection has) or changes one: media replaces its list, add / remove edit it. {op:"removeCollection", id} deletes it; its media stay. removeMedia takes a file out of every collection.
  • The compact view lists each file with its metadata, ★, tags, folder and uses:N, and the collections on one line: m_abc video "intro.mp4" 12.4s 1920×1080 29.97 fps h264 stereo 48 kHz 45 MB ★ #interview uses:2.
  • fablecut_import_media probes the file as it imports it, so the entry it returns already has these fields.
  • fablecut_status lists offline media, and the compact view marks each OFFLINE (file missing — relinkMedia) and each video with a proxy proxy:540p.
  • fablecut_proxy {} reports every video's proxy; {create:true, mediaIds?, height?} makes them (waits until done unless wait:false); {delete:true, mediaIds?} removes them. Proxies never change what you measure or export, so an agent only needs them when the user asks for smoother playback.
  • {op:"relinkMedia", id, src:"/media/…", name?} - the same footage found elsewhere: put the file in media/ (copy it, or fablecut_import_media and removeMedia the extra entry it registers), then relink. The note warns when the new file's length differs.
  • {op:"replaceMedia", id, src, name?} - a different file behind the entry; clips keep their timing, trimmed to fit (the note says how many). src must be an existing file under /media/ or /library/ of the same kind (an audio entry may use a video container).

Files on disk. The bin's folders (folders, folderId) only organize entries in project.json; the files themselves sit in media/ and may live in subfolders. fablecut_files works on those (or POST /api/files):

  • {action:"list", dir?} (an empty call to the MCP tool lists too) lists one folder: its subfolders and files with sizes and srcs. Dot-folders (media/.trash/) are left out.
  • {action:"mkdir", dir:"b-roll/day 1"} makes a folder (and its parents).
  • {action:"move", from, to} moves a file or folder into an existing folder, or to a new path (a rename); to is required ("/media/" is the top of media/). Every project's media entries that point at a moved file are repointed (the open project gets a new revision, so the editor reloads), a media name that was the old file name follows it, and the file's transcript goes with it (a warning says when one couldn't be). The move is refused while a project can't be read (force:true moves anyway, and the file goes offline there), and a project edited meanwhile stops it (CONFLICT, try again). If a project can't be written, the move is undone; if undoing fails too, the error says where the files are and which project couldn't be put back: check them there and relink. A name that is taken (also one taken while the move runs), and links inside media/, are refused, never replaced.
  • {action:"trash", paths:[…]} moves files or folders into media/.trash/<id>/files/ with a note of where they were; nothing is deleted. A file a project still uses is refused (the reply names the project and how many clips place it): removeMedia it first, or force:true to trash it anyway, and it shows as offline there until it is restored. A project whose project.json can't be read counts as possibly using it, so the same applies. One call can't list a folder and something inside it. When one of several fails, the reply lists the ones already trashed, with their ids, and the path it stopped at. {action:"trash-list"} lists the trash, {action:"restore", id} puts one back where it was (refused while something else has that name; a warning says when its trash entry couldn't be cleaned up).
  • Move, rename and trash only when the user asked: they change the user's folder. Versions keep the paths they were saved with, so restoring an old version after a move may need Relink.
diff --git a/docs/docs/motion-paths/index.html b/docs/docs/motion-paths/index.html index 79cf67ac5..92aea61ae 100644 --- a/docs/docs/motion-paths/index.html +++ b/docs/docs/motion-paths/index.html @@ -87,7 +87,7 @@

Motion paths, motion blur and text on a path

"textPath": { "type": "ellipse", "w": 300, "h": 300 }, "pathAlign": "start" }, "keyframes": { "pathOffset": [ { "t": 0, "v": 0 }, { "t": 6, "v": 100, "ease": "linear" } ] } }

In the editor: when the selected clip has two or more position keys, its path shows on the monitor: the curve, a dot per frame (their spacing is the speed), a square per key and the keys' handles. Drag a key to move it, drag a handle to bend the path (Alt breaks the pair), Alt-drag a key to pull new handles, and double-click a key to make it a corner again. Moving the clip on the monitor or typing X / Y keys both channels together. The Inspector's Motion section has Smooth (handles through every position key), Straight, Auto-orient, Motion blur and Blur samples. A title's Text path section sets it on a Line, Arc, Circle, Wave or a Pen path (click points, drag to curve, Enter to finish, click the first point to close it). Edit path shows the path's points on the monitor, and Offset and Align place the text along it.

Agents:

  • Write pin / pout on x / y keys directly, or {op:"setMotionPath", id | ids, path:"smooth" | "straight", autoOrient?: true}. "smooth" needs the position keys first (x and y keyed together at two or more times).
  • Motion blur: updateClip with props:{motionBlur:180, motionBlurSamples:12}.
  • {op:"setTextPath", id | ids, path:"line" | "arc" | "circle" | "wave" | {type:"path", points:[…], closed:false, …} | null, offset?, align?} sets, replaces or removes (null) a title's path; animate pathOffset with keyframes.
  • These are validated on addClip / updateClip too. The compact view shows path:curved after a clip's keyframes, and a title's "textPath":"ellipse 300×300".

Recipes: fly-in on a curve - two position keys, setMotionPath smooth, autoOrient:true, motionBlur:180; orbiting label - circle textPath, pathOffset keyed 0 → 100 linear; stamp along a road - an open path textPath that follows the shape in the footage, pathAlign:"center", textAnim:"letter-pop"; whip without the transition - a fast x move over 4–6 frames with motionBlur:360.

diff --git a/docs/docs/motion/index.html b/docs/docs/motion/index.html index 40180d0a5..dbe44075f 100644 --- a/docs/docs/motion/index.html +++ b/docs/docs/motion/index.html @@ -92,7 +92,7 @@

Shapes, nulls and parenting

"keys": [ { "t": 0, "rotation": 0 }, { "t": 5, "rotation": 360, "ease": "linear" } ] } ] } }
keydefaultdoes
typerectrect · ellipse · polygon · star · line · path · group
x · y0position in layer px, from the layer's origin (the clip's x/y, y down)
rotation · scale · opacity0 · 1 · 1about the item's own x, y
w · h200size, px (rect, ellipse, polygon, star)
radius0rect corner radius, px
sides · inner6 / 5 · 0.5polygon / star point count (3–64); a star's inner radius as a fraction of the outer
points-line: exactly 2 · path: 2–128 points [x, y] or [x, y, inX, inY, outX, outY] (curve handles relative to the point), px around the item's x, y
closedtruepath only; false leaves it open (lines are always open)
fill · stroke#ffffff · none"#rrggbb", "#rrggbbaa" or "none"; lines and open paths default to a white stroke and no fill
strokeWidth6 (8 open)px; set with stroke
lineCap · lineJoinround · roundbutt · round · square / miter · round · bevel
dash-[on, off, …] px, e.g. [24, 12]
trimStart · trimEnd0 · 100the part of the outline drawn, % - key trimEnd 0→100 to draw a path on
trimOffset0% of the outline the drawn part is shifted round by (key it to make a dash run round a loop)
items-group only: its items. A group moves, turns, scales, fades and trims them together (groups nest 4 deep)
name · on-a label (agents address items by it); on:false hides it
keys-[{t, ease?, …}], t in seconds from the clip's start. Keyable: x y rotation scale opacity w h radius inner strokeWidth trimStart trimEnd trimOffset fill stroke points. Each value eases between the keys that set it (ease on the arriving key); colours blend; points keys morph the path and need its point count

At most 64 items per layer (group children included). The layer itself is a normal visual clip: its x, y, scale, rotation, opacity, blend, masks, transitions and keyframes all work, as do blur and shake. Its own trimStart / trimEnd / trimOffset (clip props, keyframable) trim every path in it at once. A trimmed shape fills the part that is drawn.

Null objects. kind:"null" (no mediaId) is a clip that never renders. Give it x, y, rotation, scale (and keyframes), and parent clips to it to move them as one. The monitor shows it as a red square while it is on screen.

Parenting. "parent": "<clip id>" (top-level, next to track) makes a clip move, turn and scale with that clip. Its own x/y are then measured in the parent's space: from the parent's centre, turned and scaled with it. Parents chain (a parent can have a parent), and loops are refused. Only the transform follows: the parent's opacity, transitions, shake and effects do not, and the parent's keyframes are read even outside its time range (held at its first or last value). Splitting a parent leaves the children on the left half.

Anchor point. anchorX / anchorY (px from the picture's centre, for any visual clip) pick the point that x/y place and that rotation and scale turn around: anchorY: 200 on a 400 px tall shape spins it about its bottom edge. Moving the anchor without moving the picture means changing x/y with it (the editor's anchor tool does that).

In the editor: the bin's Shapes tab adds a rectangle, ellipse, polygon, star, line or pen-path layer, or a null object, at the playhead. The Shape layer section lists the items; pick one to edit it - the sliders, Fill / Stroke (colour or None), ends and joins, trim, Group / Ungroup / Out, ↑ ↓, Copy, Delete - and on the monitor drag it to move, the knob to turn it (Shift: 15°) and the corners to resize it. On a line or path, drag points and their handles (Alt breaks the pair, Alt-drag pulls new handles); on a path, Ctrl-click the outline to add a point and double-click one to remove it. Pen draws a new path: click points (drag to curve), click the first point to close it or press Enter to keep it open. Each value has its own ◆: key it at the playhead, and from then on changing it keys it. Every visual clip's Transform section has Anchor (✥ Move: drag on the monitor to move the anchor point while the picture stays put, Shift snaps to the centre; Centre puts it back) and Parent. Right-click clips → Parent to a new null groups them under a fresh null at their centre.

Agents:

  • Add a layer with addClip {kind:"shape", track, start, duration, props:{shapes:[…]}}, a null with addClip {kind:"null", track, start, duration, props:{x, y}}.
  • {op:"setShape", id, set:{type:"rect", w:400, h:80, fill:"#ffd166"}} adds an item (no shape, an index one past the end or a new name adds one; a new item needs type). {op:"setShape", id, shape:"Bar", set:{fill:"#22d3ee"}} edits one - by index (0 = first), name, or a path into groups like "2.0" (item 0 of group 2; "2.3" with 3 items adds one there) - merging key by key (null resets a key; a new type keeps the position and paint). replace:true starts it over. keys in set replaces its keys. {op:"removeShape", id, shape} deletes one. ids:[…] edits several clips.
  • {op:"setParent", id | ids, parent:"c_null"} parents clips and keeps them where they are on screen (at time at, default each clip's start; keyed channels are left as they are). keep:false keeps the numbers instead. parent:null unparents. Removing a parent clip unparents its children where they stand.
  • props.shapes and parent written through addClip / updateClip are validated the same way; bad input refuses the whole patch. The compact view lists a layer as [3 shapes: rect #ffd166 2 keys, line stroke #ffffff/6, group(star(5) #ff7ac8)] and a child as parent:c_null.

Recipes: draw-on logo - the logo as path items with a stroke and no fill, trimEnd keyed 0→100 (stagger the items' keys), then fill keyed from "#ffffff00" to "#ffffff"; lower third - a rect bar whose w keys from 0, a line drawn on under it, a title on the track above parented to the shape layer so they slide out together; loading ring - an ellipse with a stroke, trimEnd: 25, trimOffset keyed 0→100 with ease:"linear"; orbit - a null at the centre with rotation keyed 0→360, a shape parented to it with x: 300; swing from the top - anchorY at the top edge (minus half the height) and rotation keyed −10↔10; burst - a group of lines at different rotations with scale keyed 0→1 and opacity 1→0.

diff --git a/docs/docs/music/index.html b/docs/docs/music/index.html index c130dd923..f8251de8b 100644 --- a/docs/docs/music/index.html +++ b/docs/docs/music/index.html @@ -83,7 +83,7 @@

Music

The bin's Music tab and fablecut_music find music and sound effects that may be used in a video: openly licensed tracks from Openverse (openverse.org), which indexes Jamendo, Freesound, ccMixter, Wikimedia Commons and more. Results show every licence, not only the free ones, and each result says what its licence allows. FableCut is made with Openverse but isn't endorsed or certified by it. The licence is the artist's, and Openverse doesn't check it, so the person publishing the video is the one who must respect it.

licencelabelmay it go in a video?
cc0 · pdmfree to useyes, any use; no credit needed
bycredityes, any use; credit the artist
by-sacredit · share alikeyes; credit, and the video is shared under CC BY-SA too
by-nc · by-nc-sacredit · non-commercialnot in ads, sponsored or monetized videos; credit (NC-SA: share alike too)
by-nd · by-nc-ndno editsno: Creative Commons counts music set to video as a derivative
sampling+credit · non-commercial · samples onlyparts may be sampled and transformed, also commercially (not in ads); the whole track as it is can't be set under a video
nc-sampling+credit · non-commercial · samples onlyparts may be sampled and transformed, non-commercially only; the whole track as it is can't be set under a video

Search with words about the music (mood, genre, instrument: "chill lo-fi piano"); leave the words out to see the newest tracks. Music comes from the music category, sound effects from Freesound. Lengths are Openverse's: under 30 s, 30 s – 2 min, 2 – 10 min, over 10 min. Without an account Openverse answers 20 results a page, 240 per search and about 20 searches a minute and 200 a day per address. The search runs from the editor tab (or the MCP server) straight to Openverse, and the file goes through the editor server's URL import into media/.

An imported track keeps its licence on its media entry, so the credits can be listed later:

{ "id": "m_x", "name": "Cinematic — Jahzzar", "kind": "audio", "src": "/media/Cinematic%20-%20Jahzzar.mp3",
   "license": { "code": "by-sa", "label": "CC BY-SA 3.0", "url": "https://creativecommons.org/licenses/by-sa/3.0/",
     "title": "Cinematic", "creator": "Jahzzar", "page": "https://www.jamendo.com/track/918921",
-    "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } }

The credits are every licensed file the edit uses (main timeline, comps and other sequences; a denoised copy counts as its original), one line each: "Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921, with a warning for a licence that limits the video (non-commercial, share alike, no derivatives, samples only), and — changed: noise reduced when the edit plays a denoised copy. They go in the video's description. Replacing a file (Replace file…, replaceMedia) drops its licence; a relink keeps it.

In the editor: the bin's Music tab has the search box, a length, OK to monetize (only licences that allow commercial use and edits), and mood chips to start from. The SFX tab has the same search for sound effects (with chips such as whoosh, impact, riser) above the files in library/sfx/. Each result shows its artist, length, genres, source, a licence badge (green: free to use, blue: credit, amber: non-commercial, red: no edits; hover for what it allows, click for the licence) and a link to its page. ▶ previews it, ⬇ imports it into the Project bin, + (or a double-click) imports it and adds it at the playhead. More results loads the next page. A file's Media info shows its licence and credit with Copy credit, and the Export dialog lists the edit's music credits with Copy. Importing needs the editor server (or Studio).

Agents use fablecut_music:

  • {query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?} searches: 20 tracks a page, each id "title" — artist · m:ss · licence [flags] · genres · source. commercial:true keeps licences that allow commercial use (CC0, public domain, BY, BY-SA, BY-ND), edits:true those that allow edits (it leaves out ND); pass both when the video will be monetized. With licenses, only the ones among them that pass.
  • {import:"<track id>"} downloads it into media/ (named "Title - Artist") and registers it with its license; the reply gives the licence, the credit, any limits, and an addClip to place it (not for an ND or Sampling track, which can't go under a video as it is). Then fablecut_beats {clipId} finds its tempo, retime cuts to it, and fablecut_auto_duck dips it under speech.
  • {credits:true} lists the edit's credits and licence warnings. fablecut_export adds them to its reply when the edit uses licensed music.
  • Say which licence a track has before the user publishes, and search with commercial:true, edits:true when they plan to monetize. Import what the user picked, or the best fit when they asked you to choose. The compact view shows an imported file's licence:"CC BY 3.0".

Recipes: music under a reel - search the mood with length:"short", import one, place it on A1, fablecut_beats {clipId, retime:{every:2}}; a whoosh on every cut - kind:"sfx", query:"whoosh", import a CC0 one, place it just before each cut; music for a sponsored video - commercial:true, edits:true, and give the user the credits from the reply.

+ "source": "jamendo", "openverse": "c14c7353-…", "attribution": "\"Cinematic\" by Jahzzar is licensed under …" } }

The credits are every licensed file the edit uses (the open sequence and the compositions placed in it; a denoised copy counts as its original), one line each: "Cinematic" by Jahzzar (jamendo) — CC BY-SA 3.0 (https://…) — https://www.jamendo.com/track/918921, with a warning for a licence that limits the video (non-commercial, share alike, no derivatives, samples only), and — changed: noise reduced when the edit plays a denoised copy. They go in the video's description. Replacing a file (Replace file…, replaceMedia) drops the old licence and takes the new file's, when another entry imported that file with one; a relink keeps it.

In the editor: the bin's Music tab has the search box, a length, OK to monetize (only licences that allow commercial use and edits), and mood chips to start from. The SFX tab has the same search for sound effects (with chips such as whoosh, impact, riser) above the files in library/sfx/. Each result shows its artist, length, genres, source, a licence badge (green: free to use, blue: credit, amber: non-commercial, red: no edits; hover for what it allows, click for the licence) and a link to its page. ▶ previews it, ⬇ imports it into the Project bin, + (or a double-click) imports it and adds it at the playhead. More results loads the next page. A file's Media info shows its licence and credit with Copy credit, and the Export dialog lists the edit's music credits with Copy. Importing needs the editor server (or Studio).

Agents use fablecut_music:

  • {query, kind?:"music"|"sfx", length?:"shortest"|"short"|"medium"|"long", commercial?, edits?, licenses?:[…], page?} searches: 20 tracks a page, each id "title" — artist · m:ss · licence [flags] · genres · source. commercial:true keeps licences that allow commercial use (CC0, public domain, BY, BY-SA, BY-ND), edits:true those that let a track go under a video as it is (it leaves out ND and the Sampling licences); pass both when the video will be monetized. With licenses, only the ones among them that pass.
  • {import:"<track id>"} downloads it into media/ (named "Title - Artist") and registers it with its license; the reply gives the licence, the credit, any limits, and an addClip to place it (not for an ND or Sampling track, which can't go under a video as it is). Then fablecut_beats {clipId} finds its tempo, retime cuts to it, and fablecut_auto_duck dips it under speech.
  • {credits:true} lists the edit's credits and licence warnings. fablecut_export adds them to its reply when the edit uses licensed music, and says so if the timeline's licensed music changed while it exported.
  • Say which licence a track has before the user publishes. Search with edits:true for music to put under a video, plus commercial:true when they plan to monetize. Import what the user picked, or the best fit when they asked you to choose. The compact view shows an imported file's licence:"CC BY 3.0".

Recipes: music under a reel - search the mood with length:"short", import one, place it on A1, fablecut_beats {clipId, retime:{every:2}}; a whoosh on every cut - kind:"sfx", query:"whoosh", import a CC0 one, place it just before each cut; music for a sponsored video - commercial:true, edits:true, and give the user the credits from the reply.

Edit this in CLAUDE.md The whole manual as Markdown diff --git a/docs/docs/presets-templates/index.html b/docs/docs/presets-templates/index.html index ae4b22f30..9149fe723 100644 --- a/docs/docs/presets-templates/index.html +++ b/docs/docs/presets-templates/index.html @@ -88,7 +88,7 @@

Animation presets and templates

{ "key": "name", "label": "Name", "type": "text", "targets": [ "name:props.text" ], "value": "Ava Moreno" }, { "key": "accent", "label": "Accent", "type": "color", "targets": [ "bar:props.shapes.1.fill" ], "value": "#ffd166" } ] } }
templatenamesizelengthfields
lower-third-barLower third - Bar1920×10805 sname title accent panel
lower-third-underlineLower third - Underline1920×10805 sname title accent
lower-third-boxesLower third - Boxes1920×10805 sname title accent box
logo-ringLogo - Ring reveal1920×10804 slogo brand accent
logo-slamLogo - Slam1920×10803.5 slogo accent
logo-linesLogo - Lines1920×10804 slogo tagline lines
social-storyStory - Headline (9:16)1080×19206 sheadline subline button accent background
social-quotePost - Quote (1:1)1080×10806 squote author accent background
social-end-cardEnd card - Follow (16:9)1920×10806 sheading button accent background

Field types: text (a string), color (#rgb, #rrggbb or #rrggbbaa) and media (a media id of a picture: image, svg or video; the clip's kind follows it). A target is "<clip id>:<path>" inside the comp (props.text, props.shapes.1.fill, mediaId, …) or "comp:background"; one field can set several. The logo templates start with a placeholder, /library/elements/logo-placeholder.svg, until the logo field gets a picture. hold is when the exit starts: changing a template's length keeps everything after it at the same distance from the end, so a longer lower third just holds longer (it can't get shorter than its entrance needs).

A saved template (library/templates/<id>.json) is a template object: {id, name, group, width, height, duration, hold, background?, tracks?, clips, media?, fields}; media lists the {id, name, kind, src} entries its clips use (/library/… or /media/…), matched by src when it is placed. A saved preset or template whose name a built-in already has is saved as "<name> (saved)".

In the editor: the bin's Templates tab lists them by group (Lower thirds, Logo animations, Social, then Saved); drag one onto the timeline or click +. The Inspector's Template section on its clip edits the fields, its Length, and offers Use W×H canvas when the template was made for another shape. Right-click a comp in the Project tab → Save as template keeps it (every title's text and every picture become fields). The Motion section's Presets menus (In, Out, At playhead, Loop) put a preset on the selected clips, and Save as preset keeps this clip's keyframes (In: from its start to its last key; Out: from its first key to its end; Loop: the whole clip).

Agents:

  • {op:"applyPreset", id | ids, preset, length?, at?} - preset is a name, a saved one's id, or an inline preset object; at is timeline seconds (for an At preset; default the clip's start). Visual clips only.
  • {op:"addTemplate", template, start?, track?, duration?, fields?:{key: value}, id?, compId?, name?} places one (default track V2, at 0, its own length).
  • {op:"setTemplate", id, fields?:{key: value}, duration?} - id is its comp clip or its comp; a new duration retimes it, and clips that showed it to its end keep doing so.
  • {op:"savePreset", id, name, anchor?, from?, to?} (from/to in clip seconds) or {op:"savePreset", preset:{…}}; {op:"saveTemplate", comp, name?, fields?, hold?} or {op:"saveTemplate", template:{…}}. Files are written once the patch is saved, and later ops in the same patch can use them.
  • applyPreset, addTemplate and setTemplate also run inside inComp.
  • The compact view prints a placed template's fields under its comp: template lower-third-bar — fields (setTemplate): name="Ava Moreno" ….

Recipes: name every speaker - addTemplate lower-third-bar once per speaker with fields:{name, title}; branded intro - addTemplate logo-ring with fields:{logo:"<your logo's media id>", brand, accent} at 0; vertical teaser - set the canvas to 1080×1920, addTemplate social-story; house style - build a comp the way you like it, saveTemplate, then place it in every project; titles that arrive and leave the same way - applyPreset an In and an Out on every title in one patch.

diff --git a/docs/docs/projects/index.html b/docs/docs/projects/index.html index 56b5964e3..d147b1b1a 100644 --- a/docs/docs/projects/index.html +++ b/docs/docs/projects/index.html @@ -82,7 +82,7 @@

Projects

Keep many projects in one FableCut: a dashboard to open, create from a canvas or template, duplicate, rename, take notes on, tag, archive and delete them, and fablecut_projects for agents.

One FableCut keeps any number of projects. ./project.json is always the open project: the editor, every MCP tool, the REST API and scripts read and edit that file as before. The others wait in projects/, and opening one swaps it in:

pathholds
projects/index.json{active} - the open project's id
projects/<id>/meta.json{id, created, opened, archived, notes, tags, template?}
projects/<id>/project.jsonthe document (while that project is open, ./project.json is the live copy)
projects/<id>/thumb.jpgthe editor's last picture of it
library/project-templates/<id>.jsona saved project template {name, created, project}

media/, exports/, analysis/ and library/ are shared by every project, so a duplicate or a project made from a template copies no footage. The first time projects are used, the existing ./project.json becomes the first project, unchanged. Ids look like p_3f9a01c2de.

Opening a project saves the open one into its folder, then copies the chosen one to ./project.json with a revision above both. A save based on the project that was open before (an editor tab, an agent's fablecut_set_project, a baseRevision patch) is therefore refused as a CONFLICT instead of landing in the wrong project. Editor tabs reload, clear their undo history and close an open composition. GET /api/project names the open project in the X-FableCut-Project header, and the editor sends it back on every save, so an edit made for one project can never be written into another.

In the editor: Projects in the top bar (Ctrl/Cmd+O, or a click on the project name) opens the dashboard: cards with a picture, size, frame rate and length; search by name, notes or #tag; sort by last opened, last modified, created or name. Pick one to rename it, write notes, tag it, Open (or double-click / Enter on its card), Duplicate, Save as template or Archive it. Archived lists archived projects, where Unarchive brings one back and Delete… (click twice) removes it; only archived projects can be deleted, and the open one can be neither archived nor deleted. + New project starts one from a canvas (Landscape 16:9 1080p, Vertical 9:16, Square 1:1, Portrait 4:5, 4K UHD, Landscape 720p) or a saved template, with its own frame rate. Import… adds a project file from elsewhere (an old backup, another machine); its media must be in media/, and Relink finds files that moved.

Agents use fablecut_projects (or GET /api/projects, POST /api/projects):

  • {} or {action:"list", archived?:"only"|"all"} lists them: id, name, size, length, clips, tags, notes, and which is (OPEN).
  • {action:"open", id} switches the editor to that project; re-read it with fablecut_get_project {compact:true} before editing.
  • {action:"new", name, template?, fps?, width?, height?, notes?, tags?, open?} - template is landscape-1080 (default), vertical-1080, square-1080, portrait-1350, uhd-4k, landscape-720 or a saved template's id; it opens unless open:false.
  • {action:"duplicate", id, name?, open?} · {action:"update", id, name?, notes?, tags?} · {action:"archive" | "unarchive" | "delete", id}.
  • fablecut_status also counts the open project's versions; see Versions for them.
  • {action:"templates"} · {action:"save_template", id, name} (the project's canvas, tracks, clips and media references) · {action:"delete_template", template}.
  • Opening, archiving or deleting changes what the user sees: do it only when they asked. fablecut_status says how many projects there are.

Recipes: one edit, three versions - duplicate the project per client cut, put the brief in notes; house canvas - build an empty project with your tracks, intro and outro, save_template, then new from it for every episode; park finished work - archive delivered projects to keep the list short without deleting anything.

diff --git a/docs/docs/recipes/index.html b/docs/docs/recipes/index.html index 770945b92..0dee032dc 100644 --- a/docs/docs/recipes/index.html +++ b/docs/docs/recipes/index.html @@ -82,7 +82,7 @@

Recipes

Short answers for common edits: grades, captions, speed ramps, transitions and more, each one a few props away.

Assemble a rough cut#

Clips back-to-back on V1; each start = running sum of previous durations.

Insert / replace at playhead 3-point editing#

Load media into the Source monitor (double-click a bin item or timeline clip), mark the window with I/O, then , (insert icon) splits straddling clips on targeted tracks at the playhead, ripples everything later to the right by the window length, and drops the Source window in - video brings its linked audio stems. . (replace icon) overwrites instead: punches the placement tracks (V1 + linked stems) over [playhead, +window) with no ripple. Placement lanes are resolved against the live track list and follow targeting - if V1 / A1 / A2 were removed or untargeted, the lowest remaining targeted lanes of the right kind are used instead. Locked clips are never punched or split. A locked clip loaded into Source can't be retargeted with . (toast) until it is unlocked. When Source was loaded from a timeline clip, . instead retargets that clip's In/Out (and its linked stems) and ripples later clips on its tracks if the duration changed.

Ripple delete#

Select clip(s), then ⇧Del or the timeline-toolbar Ripple delete - removes the selection (linked partners included) and pulls later clips left on each targeted track to close the gap. Plain Del lifts (leaves a gap). Sync lock applies: linked partners on untargeted tracks move with the ripple, and locked clips are neither deleted nor moved. An unselected clip that merely overlaps the deleted range stays put - its overlap ends up bridging the shifted-in clip, so a crossfade across the cut survives.

Tighten a cut without breaking the rest#

Ripple edit (B) on the tail of the shot that runs long - the rest of the edit follows. To change where a cut falls between two shots without shifting anything else, Rolling edit (R) the cut. To keep a shot's timing but use a better take of the same moment, Slip (Y) it. To pull a whole segment out of the middle: set IN / OUT around it and Extract (').

Jump to cut#

Select a clip, then ↑ / ↓ - playhead snaps to its In, then Out (further taps walk neighboring cuts). No selection → previous / next cut on targeted tracks. Source monitor: same keys jump among 0 / In / Out / duration.

Protect finished work#

Lock the lanes you are done with (lockedTracks, or the padlock), e.g. setProject {lockedTracks:["A3"]} for a music bed. Now insert, ripple delete and close gap re-time the picture without touching it. To try an alternative without deleting a clip, disable it (⇧E / disabled:true).

Title card#

{kind:"text", mediaId:null, track:"V2", props:{text,fontSize,color}}.

Music bed#

Audio file on A1, props.volume: 0.3, trim with in/duration.

Level a voice-over edit#

fablecut_normalize_audio {clipIds:[…every VO clip…], target:-16} so all takes sit at one loudness, then keep the music on its own lane and pull that lane down: {op:"setTrack", id:"A3", set:{gain:-14}}. Then dip it under the voice: fablecut_auto_duck {clipIds:[<music clip>], under:["A1"], amount:-10}.

Cut a montage to the music#

Put the shots on V1 in the order you want (rough lengths are fine) and the music on an audio lane, then fablecut_beats {clipId:<the music>, retime:{every:2}} - each shot gets two beats where its footage allows (fewer when it runs out; clips past the music keep their length; one with less than a beat of footage refuses the re-cut), the cuts land on the beat. every:1 for a fast reel, 4 for a calm one; re-cut the part after the drop separately with retime:{from:<the drop>, every:1}. For an edit whose cuts are already chosen, snap:true just nudges each one onto the nearest beat (cuts on untargeted tracks, beside locked clips, or without spare footage to reach it stay where they are; the reply counts them). Check a cut with fablecut_frame before exporting.

Tighten a talking-head take#

Lock the music lane (setProject {lockedTracks:["A3"]}), then fablecut_silence {clipIds:[<the take>]} to see the pauses (it does the listening; fablecut_frame only shows the picture, handy to check a cut won't land mid-gesture), and fablecut_silence {clipIds:[<the take>], cut:true}. Add {op:"crossfade", ids:[…]} on the new audio cuts if a breath clicks.

Cut an interview down by text#

Lock the music lane, fablecut_transcribe {clipIds:[<the interview>]} to read what was said (name the speech clips, or the music bed is transcribed too), decide what stays, then fablecut_transcribe {clipIds:[<the interview>], find:["the sentence to drop", "and this one"], cut:true}. Then fablecut_silence {clipIds:[…], cut:true} for the pauses that are left.

Caption a talking-head reel#

Finish the cut first, then fablecut_captions {style:"highlight", clipIds:[<the talking-head clips>]} (name the speech clips, or a music bed with vocals gets captioned too), fablecut_frame {time:<mid-sentence>} to check the size and placement, and fablecut_captions {export:"srt"} for the platform's own subtitle upload.

Center a mono stem#

Linked or standalone audio clip with props.pan: 0 (inspector Pan slider, −1…+1). Stereo video stems default to L −1 / R +1; set A1 to 0 to center that channel in the mix.

Cinematic grade#

props.filterPreset: "teal-orange" (tweak with temperature/vignette on top).

Balanced, contrasty base grade then measure with fablecut_scopes#

{op:"setGrade", id, grade:{contrast:1.15, pivot:0.42, shadows:-10, highlights:-20, highSoft:30, saturation:108}}. Teal shadows / warm highlights: add lift:[-0.034, 0.008, 0.012, 0] and gain:[0.04, 0, -0.06, 0]. Film-style S-curve, muted greens, yellows pushed toward orange: grade:{curves:{y:[[0.25, 0.2], [0.75, 0.82]]}, hueSat:[[115, 0.7]], hueHue:[[60, -12]]} - then fablecut_scopes to check the blacks didn't crush. A grade on an adjustment layer over the whole edit = one look for every shot.

Green-screen composite#

Subject clip on V2 with props: {chromaKey:"#00ff00", chromaTolerance:30, chromaSoftness:15}, background footage on V1.

Remove background without a green screen people#

props: {bgRemove:true} - then put anything behind it on V1.

Picture-in-picture#

Clip on V3 with props: {scale:0.35, x:380, y:-200, cornerRadius:24} - add transitionIn: {type:"slide-right", duration:0.5} to fly it in.

Slow motion / timelapse#

props.speed: 0.5 (half speed) or 4 (4×). Remember the source window is duration × speed.

Speed ramp the reel move - fast into slow on the beat#

keyframes: { speed: [ {t:0, v:3}, {t:1.1, v:3}, {t:1.3, v:0.4, "ease":"ease-out"} ] } - sync the drop (t:1.3) to a marker; add transitionIn:{type:"whip",duration:0.2} before it.

Impact hit#

Adjustment layer, 0.25–0.4 s at the hit: {kind:"adjust", track:"V3", props:{shake:20, rgbSplit:8}} + impact-hit.mp3 from library/sfx on A2.

VHS / glitch look#

props: {rgbSplit:4, grain:35, saturation:120} + library/elements/vhs-scanlines.svg on V3 with blend:"soft-light", fit:"stretch". Cut between shots with transitionIn:{type:"glitch",duration:0.3}.

Film look#

Adjustment layer across the whole edit: props: {filterPreset:"cinematic", grain:18} - one clip grades every shot.

Neon caption#

props: {glow:60, glowColor:"#22d3ee", color:"#ffffff", font:"Bebas Neue", textAnim:"wave"} on a dark shot.

Light leak accent#

library/elements/light-leak-warm.svg on V3, props:{blend:"screen", fit:"cover", opacity:0.7}, 1–2 s at scene changes, transitionIn/Out: fade.

Light-leak / dust overlay#

Element from library/elements on V3 with props: {blend:"screen", opacity:0.6, fit:"cover"}.

Reel caption#

Text clip with props: {textAnim:"word-pop", wordRate:0.15, strokeWidth:6, bgColor:"#000000", bgOpacity:0.45, fontSize:88}. karaoke dims words until "spoken"; typewriter for terminal vibes.

RTL / Hebrew / Arabic caption#

Omit direction (defaults to "auto") or set direction:"rtl" explicitly; pick a font with the script's glyphs (Google Fonts work). Animations wipe and stagger in reading order automatically. letter-pop / wave animate whole words on Arabic/Indic lines (not isolated letters) so cursive joining stays correct.

Branded title#

props: {font:"Bebas Neue", weight:700, letterSpacing:6, uppercase:true, color:"#ffffff", color2:"#7b6cff", textShadow:20} - any Google Font name just works.

Kinetic font-cut title rhythmic typeface cuts on the beat, then settle#

props: {font:"Bebas Neue", fontSize:120, uppercase:true, color:"#ffd166", textAnim:"font-cut", fontCutSet:["Anton","Bebas Neue","Archivo Black","Oswald"]}.

Elegant clip-on title letters wipe in#

props: {font:"Playfair Display", fontSize:88, color:"#ffffff", color2:"#ffd166", letterSpacing:2, textAnim:"clip-reveal"} - centered, one clean sweep.

Lower-third reveal#

props: {font:"Archivo Black", fontSize:92, uppercase:true, textAnim:"rise-mask", y:<height*0.30>} - the line rises from behind its baseline. Pair with a serifDrop/zoom-in kicker above it.

Custom font#

Drop MyBrand.ttf into library/fonts/, then props.font: "MyBrand".

Animated sticker#

Author an SVG (convention above) into library/svg/, register {kind:"svg", src:"/library/svg/foo.svg"}, clip on V2/V3. Scale/move/ rotate with normal props & keyframes; the SVG's own CSS animation plays on top, frame-accurately.

Whoosh on a cut#

0.4 s sfx clip from library/sfx on A2 aligned to the cut.

Ken Burns slow push on a photo#

keyframes: { scale:[{t:0,v:1},{t:D,v:1.2,ease:"linear"}], x:[{t:0,v:0},{t:D,v:-40,ease:"linear"}] }.

Crossfade#

Overlap two clips on the same track by ~1 s; later clip gets transitionIn: {type:"fade", duration:1}. For audio give the earlier clip the matching transitionOut and both curve:"power" (or select a clip and press Shift+D in the editor).

Whip-pan cut#

A gets transitionOut:{type:"whip",duration:0.25}, B gets transitionIn:{type:"whip",duration:0.25}.

Beat-synced cut#

Write beat times into markers, then align clip starts to them (the UI also snaps drags to markers).

Label the structure#

Write named, coloured markers for sections the user can jump between (⇧M / Alt+⇧M, or the Markers list): setProject {markers:[{t:0,label:"intro",color:"blue"},{t:8.5,label:"drop",color:"red"},{t:24,label:"outro",color:"purple"}]}. setProject replaces the whole list - include the existing markers you want to keep.

Music fade-out#

Audio clip keyframes: { volume:[{t:D-3,v:0.8},{t:D,v:0}] } or simply transitionOut: {type:"fade", duration:3, curve:"exp"}.

Pulse / emphasis#

keyframes: { scale:[{t:0,v:1},{t:0.3,v:1.12},{t:0.6,v:1}] }.

Reframe horizontal → vertical#

Keep a wide composition canvas and crop for delivery - e.g. width:1920, height:1080 with exportFrame:{x:656,y:0,w:608,h:1080} (9:16 fitted to canvas height). Position footage with clip x/y/scale; the export frame can be dragged in the UI. Omit exportFrame to export the full canvas.

Vertical reel#

Set project width:1080, height:1920; use the UI's safe-area guides (▦) to keep captions out of platform UI zones.

Project frame rate#

Set fps in project.json (or the Program Monitor FPS dropdown - 24 / 25 / 30 / 50 / 60). Preview stepping, timecode frames, Fast / WebCodecs / Realtime export, and /api/export/begin all use this value; pass the same fps when starting an export via the API.

diff --git a/docs/docs/remake/index.html b/docs/docs/remake/index.html index df700d0b9..4541b0caf 100644 --- a/docs/docs/remake/index.html +++ b/docs/docs/remake/index.html @@ -93,7 +93,7 @@

Remake a reference video

"music": { "name": "ref-music.m4a", "src": "/media/…", "mediaId": "m_x" } } // ^ extracted + registered by the MCP tool

threshold tunes cut sensitivity (default adapts 0.30→0.20→0.12): lower it if obvious cuts were missed, raise it if motion is being misread as cuts.

Rebuild recipe - the analysis is deterministic; the creative mapping is yours:

  1. setProject: copy the reference's width/height/fps; write beats (or the cuts) into markers so the user sees the grid.
  2. Music: the extracted track on A1, in:0, duration:<ref duration>.
  3. Structure: one clip per shots[] entry on V1 at the same start/duration (hard cuts by default - that's what shot detection saw). Pick source footage whose motion matches each shot's energy (calm ≤40, action ≥70), and choose each clip's in so something interesting happens inside the window. Then look: fablecut_frame {path, frames:12} to survey a candidate clip, {path, t} at the exact moment you want, before committing to an in.
  4. The drop: put the hero shot there; classic garnish = a speed ramp landing on it, an impact adjust layer (shake+rgbSplit), or a whip transition.
  5. Pacing garnish to taste: shots shorter than ~0.6 s read as beat-flashes; avgShotLen tells you the reference's overall pace. Captions/grade/SFX per the Recipes section - the blueprint gives structure, not style.
diff --git a/docs/docs/rest-api/index.html b/docs/docs/rest-api/index.html index c597e605d..f6c72b76e 100644 --- a/docs/docs/rest-api/index.html +++ b/docs/docs/rest-api/index.html @@ -82,7 +82,7 @@

REST API

The HTTP endpoints behind the editor, for scripts and tools that don't speak MCP.

  • GET /api/project - current project JSON
  • PUT /api/project - replace project JSON (body = full document). Conflict-safe: if the body's revision ≤ the revision currently on disk, the server rejects with 409 and returns {"error":"…","revision":<current>}. Append ?force=1 to overwrite unconditionally. A request with an X-FableCut-Project header (the editor sends the id of the project it loaded) is also refused with 409 when another project is open (see Projects). Writes are atomic (tmp file + rename), so a crashed write never corrupts the file.
  • GET /api/media - list files in ./media (name, src, size)
  • GET /api/media-info?src=/media/x.mp4 → {src, info} · POST /api/media-info {srcs:[…], stat?} → {info:{src: info}} (up to 2000; stat:true answers only {size, mtimeMs}, no ffprobe - how the editor checks for offline files) - a file's metadata from ffprobe: size, fps, codec, audioCodec, audioChannels, sampleRate, bitrate, duration, width, height and probe ("ffprobe", or "stat" when only the size could be read). info is null when the src names no file under /media/ or /library/. Cached per file version.
  • POST /api/proxy {srcs:[…], height?:540|720|1080} → {status:{src: status}} queues proxies (ffmpeg, one at a time); POST /api/proxy/status {srcs} → {status:{src: status | null}}; POST /api/proxy/delete {srcs} → {deleted:{src: n}}. A status is {state:"ready", src:"/proxies/…", width, height, size}, {state:"queued"|"running", progress, height}, {state:"failed", error} or {state:"none"} (null = no such source file). Progress and results are also pushed as SSE event proxy ({src, status}). GET /proxies/<name> serves a proxy file from analysis/proxies/. /api/proxy answers 503 without ffmpeg.
  • POST /api/relink/candidates {media:[{id, name, src?, size?, kind?}]} → {candidates:{id:[{src, name, size, score, why}]}} - where a missing file might be now: files under media/ and library/ (subfolders included) of the same kind, ranked by name (same name, same name with another extension, similar name) and size, best 5 each.
  • GET /api/projects[?archived=only|all] → {active, projects:[{id, name, active, archived, notes, tags, created, opened, modified, width, height, fps, duration, clips, media, thumb}], templates:[…]} · POST /api/projects {action, …} - the actions of fablecut_projects (plus import {project, name?}). The answer depends on the action: {id, project} for open / new / duplicate / update / archive / unarchive / import (plus from when the open project changed, already when it was open), {id, deleted} for delete, {templates} for templates, {template} for save_template (the saved one) and {template, deleted} for delete_template · GET / PUT /api/projects/thumb?id= - a project's JPEG thumbnail (1 MB max). SSE event projects ({action, id, active}) after each change. See Projects.
  • GET /api/versions[?project=] → {project, versions:[{v, name, note, kind, created, revision, clips, duration, final}]} (newest first; default the open project) · POST /api/versions {action, project?, version?, …} - save {name?, note?, final?} → {project, version} · diff {version, to?} → {same, lines, added, removed, changed, mediaAdded, mediaRemoved, settings} · restore {version} → {restored, saved} · update {version, name?, note?, final?} → {version} · delete {version} → {deleted}. GET /api/versions/file?project=&version= is that version's document; GET /api/projects/backup?id= a project with all its versions (import it with POST /api/projects {action:"import", project:<the backup>}). SSE event versions ({project, action}). See Versions.
  • POST /api/files {action, …} - the files in media/: list {dir?} → {dir, folders, files:[{name, src, size}]} · mkdir {dir} · move {from, to, force?} → {from, to, moved:[{from, to}], repointed:[{project, open, media}], warning?} (from / to are the item itself; moved lists each file in it, so it is empty for an empty folder or a no-op; 409 while a project can't be read, unless force:true) · trash {paths, force?} → {trashed:[{id, src}], offline} (409 while a project uses one or can't be read, unless force:true; a batch that stops part-way answers 400 with trashed and failed; stillThere lists uses whose file is still in place) · trash-list → {items} · restore {id}. See Media management.
  • GET /api/library?dir=sfx|elements|svg|fonts|presets|templates - list library assets
  • GET /api/presets · GET /api/templates - the saved presets / templates, validated (bad files skipped); POST /api/presets {preset} · POST /api/templates {template} - validate one and save it as library/presets/<id>.json / library/templates/<id>.json, returning {id, name, file}
  • GET /api/workflows[?id=] - the saved workflows, validated (bad files skipped), or one by id or name (404 if none) · POST /api/workflows {workflow} - validate and save it as library/workflows/<id>.json, returning it with created / updated · POST /api/workflows/delete {id} → {deleted}. See Workflows.
  • POST /api/upload?name=foo.mp4 - raw body saved into ./media, returns {src}. MP4/MOV/M4V uploads are auto-remuxed with +faststart (needs ffmpeg on PATH). Files copied straight into ./media by external tools skip this - remux big ones yourself (ffmpeg -i in.mp4 -c copy -movflags +faststart out.mp4) or playback stalls.
  • POST /api/import-url - body {url:"https://…", name?} downloads the file into ./media/ and returns {src,name} (same-origin /media/…, like upload). name is the file name to save as (its extension follows the download). HTTPS only; rejects localhost, private/link-local/CGNAT addresses, and redirects to those. Remote SVG is refused (/media/*.svg is served same-origin as image/svg+xml - a scripted SVG opened as a document would run on the editor origin). Does not write project.json - register the media afterwards (UI and fablecut_import_media do this). Do not put a raw https:// URL (or another origin, including localhost on a different port) in media.src: canvas CORS would taint the compositor and Fast / WebCodecs export cannot JPEG-encode. Import into ./media so src is /media/…, or serve the remote with Access-Control-Allow-Origin.
  • GET /api/transcript?src=/media/x.mp4 → {transcript} (null when the file has none yet; 404 when the file is missing) · POST /api/transcript?src= (a transcript document) → {src, words} · POST /api/transcript/status {srcs} → {status:{src: {words, language, model, duration, created} | false | null}} · POST /api/transcript/delete {src} → {deleted}. SSE event transcript ({src}) after each save or delete. POST /api/transcribe/request {transcribe:{srcs, model?, language?, again?}, where?} queues a transcription on the export-job queue (poll GET /api/export/job?id=); the tab saves each transcript, and the job's result lists done, skipped and failed. See Transcripts and text-based editing.
  • POST /api/denoise - body {src:"/media/…", amount:"light"|"medium"|"strong"}: writes a noise-reduced FLAC of the whole file into ./media/ (reused if it exists) and returns {src, name, duration, channels}. Does not touch project.json (see Audio mix).
  • POST /api/analyze - body {src:"/media/ref.mp4", threshold?, music?}: analyze a reference video into an edit blueprint (see Remake a reference video); extracts its music into ./media. GET /api/analyze?src=… returns the cached blueprint.
  • GET /api/frame?src=/media/x.mp4&t=3.2 - one JPEG still of a source clip, the "eyes" to go with /api/analyze's ears (see Look at the footage). Optional w (pixel width, default 768) and q (ffmpeg -q:v 1–31, default 4). &frames=N[&cols=][&from=][&to=][&w=320] instead returns one N-up contact sheet across the clip (N 2–60; cols omitted → the squarest layout, so 6 frames give 3×2 rather than 4×2 with two black cells). src must name an existing file under /media/ or /library/ (404 otherwise). ?path= reads any file on the machine but only with the X-FableCut-Client: mcp request header, which only the local MCP client sends - without it the request is refused (403) before the path is even resolved. Results are cached in analysis/frames/ keyed by source path, size and mtime; the cache is capped (500 files / 128 MB, oldest first). The response carries X-FableCut-Frame-Times (comma-separated sample times, so a sheet's cells can be mapped back to timestamps) and X-FableCut-Frame-Source.
  • POST /api/scopes/request also takes {"image":true}, which makes the editor return the measured still as a JPEG data URL in result.image - how fablecut_frame {time} shows an agent the composed program picture.
  • GET /api/events - SSE: named event change when project.json, ./media or ./library changes; named event profiles when encoding-profiles.json changes (UI refreshes the export-profile list only - no project reload); named event proxy as a proxy is queued, makes progress, finishes or is deleted
  • Fast / WebCodecs export (browser compositor → server ffmpeg): GET /api/export/ffmpeg → {available} · GET /api/export/profiles[?detail=1] → {default, profiles, issues} · POST /api/export/begin {fps,name,mode?,profile?,hasAudio?,pixelFormat?,width?,height?} → {id,mode,profile?,label,summary} (fps is required - pass project.fps, no server-side default; mode is "jpeg" (default, Fast) or "annexb" (WebCodecs H.264 elementary stream); jpeg 400 if profile is not a defined id, or if ffmpeg rejects its args in the dry run; optional pixelFormat:"rgba" plus width/height pipes raw canvas frames instead of JPEG) · POST /api/export/frame?id= (JPEG body for jpeg mode; raw RGBA if begin used pixelFormat:"rgba"; Annex-B for annexb - one POST may concatenate frames or AUs. Must be after audio; ffmpeg is spawned on the first frame in both modes) · POST /api/export/audio?id= (WAV body - must be sent before the first frame) · POST /api/export/end?id=[&discard=1] → {src} under /exports/
  • Export jobs (what fablecut_export drives): POST /api/export/request {range?, profile?, where?:"auto"|"tab"|"headless"} → {id, status, via, …} (409 if one is already running, or nothing can render it) · GET /api/export/job?id= → {status: pending|running|done|failed|cancelled, progress 0–1, src, error} · POST /api/export/job/cancel?id=. The editor tab side: SSE event export (a ticket), GET /api/export/job/ticket?id=, POST /api/export/job/claim?id= (first tab wins, else 409), POST /api/export/job/report?id= {progress} | {status:"done", src} | {status:"failed", error} → {cancel}.
diff --git a/docs/docs/sequences/index.html b/docs/docs/sequences/index.html index 129250c8b..4c5f107ba 100644 --- a/docs/docs/sequences/index.html +++ b/docs/docs/sequences/index.html @@ -87,7 +87,7 @@

Sequences

"clips": [ /* … */ ], "tracks": [ /* … */ ], "markers": [ /* … */ ], "delivery": { "preset": "instagram-reels" } } ]

Opening another sequence parks the top-level keys in the open one's entry and brings the other's up, with a new revision - like any edit. A clip in a sequence that isn't open still counts: its media shows "used" in the bin, can't be removed while it is there (removeMedia and Remove from project refuse and name the sequence), and Replace file… trims it too; a comp it places can't be removed either. A project with one sequence named Main has neither key.

In the editor: the sequence menu at the left of the timeline toolbar (it shows the open sequence's name, and how many there are) lists them - click one to open it - and has New sequence… (a name, a canvas - the same as the open one, or 16:9, 9:16, 4:5, 1:1 - and, optionally, a copy of the open sequence's timeline to start from), Duplicate, Rename… and Delete… (click twice; the project is first kept as a version, so a deleted sequence can be restored from Projects → Versions). For the session each sequence keeps its own undo history, playhead and selection. The Export dialog, the Mixer, IN / OUT and the canvas settings all belong to the open sequence. Find timeline instances lists placements in other sequences too; clicking one opens its sequence.

Agents (fablecut_patch_project):

  • {op:"addSequence", name?, id?, from?, width?, height?, fps?, open?:true} - from:"empty" (default; the open sequence's canvas and frame rate, no clips), "open" (a copy of the open sequence's timeline) or a sequence id (a copy of that one). width / height / fps change the copy's canvas: the clips keep their positions relative to the centre, and an exportFrame is dropped.
  • {op:"inSequence", sequence, ops:[…]} runs ops on a sequence without opening it: clip and timeline ops, setProject (its canvas, markers, IN / OUT, delivery), setTrack, setBus, setFx on its tracks, and updateSequence (name, index) - not addSequence, openSequence, removeSequence or another inSequence. The user's editor stays where it is.
  • {op:"openSequence", id} changes what the user's editor shows, and what fablecut_export, fablecut_frame {time} and fablecut_scopes render: do it when the user asked, or to export that sequence.
  • {op:"updateSequence", id, set:{name?, index?}} renames or reorders one; {op:"removeSequence", id} deletes one (only when asked; the last one stays, deleting the open one opens its neighbour, and one holding locked clips or tracks needs force:true).
  • The compact view and fablecut_status list every sequence (id, name, canvas, clips, length, which is open). A version's Compare reports each sequence's changes on its own, sequences added and removed, and which one was open.

Reframe - fablecut_reframe {aspect?:"9:16"|"1:1"|"4:5"|"16:9"|"4:3"|"2:3", name?, clipIds?, follow?, smooth?, force?} makes a copy of the open sequence on that canvas shape and opens it (the project's shorter side kept: 1920×1080 → 1080×1920 for 9:16, 1080×1080 for 1:1), so the original cut stays as it was; without aspect it reframes the open sequence on its own canvas. Each full-frame shot - a video or still that isn't moved, scaled, cropped or keyed by hand - gets fit:"cover" and an x (or y) that keeps its subject in view. Frames are sampled 5 times a second at 96 px; the subject is where motion (against the shot's own movement, so a pan or a flicker doesn't count), detail and colour gather, pulled gently toward the centre. A virtual camera operator then holds still while the subject stays inside a dead zone and eases after it no faster than a pan speed, and the path becomes ordinary keyframes (thinned to within ~2 px), or one steady position. Shots with no clear subject are centred. Titles, picture-in-picture, clips placed or animated by hand and locked clips (unless force:true) are left alone and listed in the reply - check them on the new canvas with fablecut_frame {time}. follow:false only fits and centres; smooth 0…1 (default 0.5) holds longer and pans slower as it rises. props.reframe marks what Reframe did, so running it again replaces its own keys. A version is kept first. In the editor: New sequence… with a copy of the open sequence on another shape has Follow the subject in each shot; the Inspector's Reframe section on a video or picture of another shape than the canvas has Follow subject, Centre and Lively / Balanced / Steady (the selected clips, one undo step, with Cancel).

Highlights - fablecut_highlights {duration?, shot?, clipIds?, mediaIds?, name?, aspect?} finds the best moments of long footage and cuts them into a short edit: a new sequence (Highlights 30 s, or name), opened, so the timeline it came from stays as it was. It reads the video clips on the open timeline (clipIds limits them; mediaIds reads whole files instead), up to an hour of footage at a time: frames twice a second at 64 px, and the sound. Every half second is scored for movement, sound louder than the 20 s around it (a cheer, a laugh, a hit), its overall level, and a clear picture; black frames and flat colour count for little. Cuts already in the footage are found, and a moment never crosses one. It then takes the best moments of shot seconds (default duration / 8, kept within 1.5–4 s), apart in the same footage (by half a moment, at least a second) and spread over its shots, until the edit is duration seconds (default 30; 5…600), trims the last ones to fit exactly, and nudges each end up to 0.3 s to the quietest point near it, so no word or hit is cut through. The moments go back to back on V1 in story order, each a clip of its source with its props (a reframed clip's framing isn't carried over) and its linked sound clips beside it (their own tracks, linked again); their keyframes aren't carried over. A moment from a whole file (mediaIds) is one video clip that plays its own sound, with no separate audio clips. A clip played faster or slower counts by its length on the timeline: duration and shot are always seconds of the edit. In the editor (and Studio) the sound of a file longer than 30 minutes isn't read, so as not to decode it whole in the browser; its picture decides. Disabled clips and clips with a speed ramp are not read. aspect makes the new sequence 9:16, 1:1 or 4:5: the shots are then letterboxed, and fablecut_reframe {} fits them and follows the subject. The reply lists each moment (its source, times, length, why it was picked and its score). A version is kept first. In the editor: the sequence menu's Highlights… (15, 30, 60 or 90 s; a canvas, and Follow the subject in each shot on another shape) reads the selected video clips, else every video clip on the timeline, with progress and Cancel.

Recipes: vertical cut of a finished edit - fablecut_reframe {aspect:"9:16"}, then check the titles with fablecut_frame; by hand, addSequence {name:"Reel 9:16", from:"open", width:1080, height:1920}, then inSequence ops to re-position or re-scale the shots and setProject {delivery:"instagram-reels"} in it; reel from a long video - fablecut_highlights {duration:30, aspect:"9:16"}, then fablecut_reframe {}, music on an audio track and fablecut_beats {clipId:<the music>, retime:{every:2}}, then captions; cut-downs - duplicate the edit as "30 s" and "15 s" and tighten each with the trim ops inside inSequence; selects reel - an empty sequence the user drops favourite takes on, cut into the edit from the Source monitor.

diff --git a/docs/docs/tracking/index.html b/docs/docs/tracking/index.html index c1a73bf97..bd8069d8e 100644 --- a/docs/docs/tracking/index.html +++ b/docs/docs/tracking/index.html @@ -85,7 +85,7 @@

Motion tracking

"samples": [[0, 0.31, 0.42, 1, 0, 1], [0.0333, 0.312, 0.421, 1, 0, 0.98]] } ]
keydoes
namehow masks, clips and agents refer to it (default Track n, or the mask's name)
kindpoint (position) or box (position, size and rotation were followed)
w · hthe region that was matched, fractions of the clip's picture
samplesone per frame: [t, x, y, s, r, q]. t is seconds from the clip's start, x, y is the centre (fractions of the picture, like masks), s is the scale and r the rotation (°) relative to the first sample, q is the match quality 0…1

The tracker matches a small greyscale template of the region (normalized cross-correlation, sub-pixel, optionally over scale and rotation) and keeps the template fresh while anchoring it to the first frame so it does not drift. It stops where the match quality drops below 0.45 (the region was covered, left the frame or changed too much) and keeps what it tracked up to there. Pick regions with detail: corners, text, edges. Flat sky or a blank wall can't be tracked. A track without scale follows position only: if the thing grows, shrinks or turns noticeably, turn on Scale / Rotate (scale / rotation), or the match fades and the track stops early. Tracks are stored in clip time, so they move with the clip and follow trims and splits (re-track after changing its speed).

In the editor:

  • Mask tracking. Select a mask on a video clip. Under its mode row, ◀ Back and On ▶ follow what the mask covers from the playhead to the clip's start or end, and key the mask's x / y. Turn on Scale and Rotate to key those too. The keys are linear and simplified (a key only where the motion turns, within ~1.5 px). Keys the mask had in that range lose their position and keep everything else.
  • Point tracking. The Inspector's Tracking section (video clips): + Track point, then click the spot on the monitor. It tracks from the playhead to the clip's end. Region sets the matched area (% of the picture's width). Pick a track's chip to see its path and region on the monitor, ◀ Track back / Track on ▶ to extend it from the playhead, and Delete it.
  • Attach a clip. With a track picked, choose a clip in Attach (any visual clip that overlaps it in time) and press Attach to the track. The clip gets x / y keyframes (plus scale / rotation with those toggles on) that ride on the track and keep it where it is at the playhead. Stickers, titles, a blur box or a highlight then stay pinned to the moving thing.
  • Tracking runs from a private copy of the video, so the monitor does not move. Progress shows in the Inspector, and Esc stops it and keeps what it has. Each finished track is one undo step.

Agents: fablecut_track runs the tracker in the editor (an open tab, else headless Chrome / Edge) and saves the result:

  • {clip, point:{x:0.62, y:0.4}, at:12} follows a spot from at to the clip's end. region:{x, y, w, h} gives the area instead, size sets a point's region (default 0.08 of the width), direction:"backward"|"both" and to (timeline seconds) set the range, and scale / rotation follow those too.
  • apply:{mask:"Face"} bakes the result into that mask's keys. Leave out point / region and the mask's own outline is what gets followed.
  • apply:{clip:"c_sticker", scale?, rotation?, at?} pins another clip to the track.
  • name names the track. Passing an existing name with apply and no region re-applies the stored track without tracking again.
  • The reply gives the range, the match quality (min / mean; ≥ 0.8 is solid), where it was lost, and what was keyed.
  • {op:"removeTrack", id, track} deletes a stored track; what followed it keeps its keys. The compact project view lists tracks as [tracks: "Logo" point 0.00–4.20 s (127 samples)], never their samples.

Recipes: a title that follows a car - track a point on the car, attach the title; blur a face or a plate - an ellipse mask on a blurred copy of the shot on the track above, then apply:{mask:"Face"}; a screen replacement - track the screen with Scale and Rotate on and attach the new picture, cropped to fit; a highlight that stays on a UI element in a screen recording - track the button, attach a rect svg.

diff --git a/docs/docs/transcripts/index.html b/docs/docs/transcripts/index.html index 2913145c1..edc9055fb 100644 --- a/docs/docs/transcripts/index.html +++ b/docs/docs/transcripts/index.html @@ -82,7 +82,7 @@

Transcripts and text-based editing

Turn speech into words with times, in the browser, then read, search and cut the edit like text: in the Transcript tab, or from an agent with fablecut_transcribe.

FableCut turns the speech in a clip into words with times, so an edit can be read, searched and cut like text. Transcription runs in the browser: Whisper (OpenAI's speech model, through transformers.js) in a background worker of the editor tab. The library and the model are fetched from a CDN the first time and kept by the browser after that; the audio never leaves the machine.

modeldownload
base (default)77 MBquick: about 15 s per minute of speech on a fast desktop
small250 MBoften more accurate (accents, noisy rooms, numbers); about twice as slow

Whisper detects the language by itself; give it one (en, es, hi, ja, … any Whisper code) when a clip is short or mixes languages. Long files are split at their quietest moments into pieces of at most 28 s, and stretches of silence are skipped (Whisper invents words in silence).

One transcript per file, kept by the server in analysis/transcripts/: {v, src, model, language, duration, created, words:[[text, start, end], …]}, times in seconds of the file. Like a proxy it belongs to the file's size and modification time, so a replaced or re-rendered file has none until it is transcribed again. It is not stored in project.json, so it never bloats the timeline, and every clip and sequence that uses the file reads the same one.

On the timeline a clip shows the words its window of the file holds, placed through its in point and speed (a word counts when its middle is inside the clip). A clip with a speed ramp is left out, and so are disabled clips and pictures whose sound is off.

Cutting words extracts on the targeted tracks, from just before the first word to just before the word after the last one: the pause after the cut goes too, the pause before it stays. Cuts land on whole frames, never in a neighbouring word or past the clip. Several cuts go last first, as one undo step (one revision for an agent): later material moves up, linked stems stay in step, and locked clips stay put - lock the music bed first if it should keep running under the tightened edit. Find matches whole words and ignores case, accents, punctuation and spacing: "ai powered" finds "A.I.-powered", and "cat" doesn't find "category".

In the editor, the Transcript tab beside the Inspector:

  • Transcribe works on the selected clips' files (a selection with no speech, such as a title, transcribes nothing), else on every file on the timeline that has no transcript yet; once every file has one (an agent may have made them), it reads Transcribe again and redoes them all. The model and the language are beside it. Progress shows below (the first time, the model download), with Cancel. A line above the words says which model and language made them: when the words look wrong, pick the language spoken and the Small model, then Transcribe again.
  • The timeline's words, in paragraphs with timecodes. Click a word to go there; the word under the playhead is underlined and followed while playing. ⇧-click or drag to select a run of words, then press Delete (or Cut) to extract it.
  • Find words marks every match, Enter steps through them, and Cut N extracts them all. Copy copies the text with its timecodes.

Agents use fablecut_transcribe. It transcribes in an open editor tab, else in headless Chrome / Edge, whose profile is kept in analysis/browser-profile/ so the model downloads once:

  • {} transcribes every clip with sound that has no transcript yet, then returns the timeline's words as timed lines: [0:12.08] Open the demo, nothing to install. clipIds limits it to some clips; from / to limit the time (the reply stops at 300 lines); mediaIds reads whole files in file seconds instead.
  • model:"small", language:"es", and again:true (transcribe again, with another model or language).
  • find:"phrase" (or a list) reports each place it is said, with its span, the words around it and how much cutting them would remove; cut:true extracts them (tracks and force as for fablecut_silence). A version of the project is kept before the cut.

Whisper writes clean text: it often leaves out fillers ("um", "uh") and false starts, so find those by ear (fablecut_silence for the pauses), not by text. Word times are good to about a tenth of a second; listen to a cut that matters, or check it with fablecut_frame.

diff --git a/docs/docs/versions/index.html b/docs/docs/versions/index.html index 63b1ca2e4..9a9cf2c20 100644 --- a/docs/docs/versions/index.html +++ b/docs/docs/versions/index.html @@ -82,7 +82,7 @@

Versions

Saved copies of a project you can compare and go back to, made by you, every few minutes, and before an agent edits; restoring is never destructive, and a backup carries them all.

Every edit is saved as it happens, and undo covers the session. An edit that reaches the open editor from outside (an agent, another tab) is one undo step of its own there: Ctrl+Z takes it back first, then the user's own edits. Versions are what you come back to later: full copies of a project, kept beside it, that are never overwritten. Restoring one is not destructive either - what is there is saved as a version first, so a restore can be undone by restoring that.

pathholds
projects/<id>/history/v0007.jsonthe project as it was
projects/<id>/history/v0007.meta.json{v, name, note, kind, created, revision, clips, duration, final}

A version's kind says where it came from:

kindmade
manualby you (Save version, Ctrl/Cmd+S) or an agent (fablecut_versions {action:"save"})
autoevery 10 minutes while the open project changes, whoever changes it (FABLECUT_AUTO_VERSION_MIN sets the minutes); the newest 30 are kept
agentbefore an agent's first edit of a session (again after 10 quiet minutes), and before every fablecut_set_project rewrite
restorewhat was there just before a restore

One version per project can be marked final (the cut that went out); a final version can't be deleted until it is unmarked. Manual, agent and restore versions are never pruned.

Compare tells what changed between a version and now (or two versions): clips added, removed and changed (timing, which props, keyframes, effects, transitions, source, track), media added and removed, the length, and project settings (name, canvas, frame rate, IN / OUT, tracks, markers, comps, mix, delivery, …).

Backup and recovery. Download backup saves a project with all its versions as one .fablecut-backup.json file; Import… in the dashboard brings it back, versions included. When project.json can't be read as the server starts (another tool crashed mid-write, a bad hand edit), the server keeps the broken file as project.corrupt-<time>.json and puts back the newest good copy: the latest version, or the project's last parked copy.

In the editor: Ctrl/Cmd+S saves a version of the open project. In the Projects dashboard, a project's Versions… lists its versions, newest first, with Save version (name and note), and per version Compare with now, Restore… (click twice), Mark final, Rename, Download and Delete… (click twice). Esc goes back to the projects.

Agents use fablecut_versions (or GET / POST /api/versions):

  • {} lists the open project's versions (project picks another one).
  • {action:"save", name?, note?, final?} - save one before a big or risky change (a restructure, a remake, a new grade on every shot) and when the user is happy with a cut, so there is a named point to go back to.
  • {action:"diff", version, to?} - what changed since that version (to now, or to version to). Use it to tell the user what an edit session changed.
  • {action:"restore", version} - only when the user asked; then re-read the project. {action:"update", version, name?, note?, final?} · {action:"delete", version}.

Recipes: try a bold alternative - save a version, make the change, compare, and restore if the user prefers the old one; client rounds - save "Round 1", "Round 2", … with the feedback in the note, mark the approved one final; what did the agent do? - diff against the "Before agent edits" version.

diff --git a/docs/docs/workflows/index.html b/docs/docs/workflows/index.html index bb6828abd..0acdfcb5d 100644 --- a/docs/docs/workflows/index.html +++ b/docs/docs/workflows/index.html @@ -91,7 +91,7 @@

Workflows

{ "text": "Export for YouTube Shorts.", "call": { "tool": "fablecut_export", "args": { "preset": "youtube-shorts" } } } ], "created": "…", "updated": "…" }
keydoes
name · idup to 80 characters; the id is made from the name, and saving the same name again updates that workflow (it keeps its created)
description · tagswhat it is for (up to 600 characters) · up to 12 labels
steps1–50, each {text, call?} (a plain string is a step with only text); text up to 1000 characters
call{tool, args}: a FableCut tool (not fablecut_workflows) and the arguments it was given, up to 20 000 characters

Following one is a job for judgement, not a replay. The new project has other clips, ids and times, so a step's call is a worked example: read what the step says, look at the project (fablecut_get_project {compact:true}, fablecut_frame), and make the call that does that here. A step with no call is one only the agent's judgement can do ("pick the three strongest shots").

Agents use fablecut_workflows (or the REST endpoints below):

  • {} lists them (id, name, steps, tags, description); {action:"show", id} gives the steps to follow (id or name).
  • {action:"save", workflow:{name, description?, tags?, steps}} keeps one. Save when the user asks to keep or repeat what was just done: write each step the way you would explain it to another editor, and attach the calls that worked. A call to a tool that doesn't exist refuses the save.
  • {action:"delete", id} removes one: only when the user asks.

Recipes: "do what you did last week" - {}, then show the one that matches and do its steps; a house style for every episode - after the first episode is right, save its loudness, captions, grade and export steps as one workflow; hand a routine to another agent - the file in library/workflows/ is plain JSON any agent can read.

diff --git a/mcp-server.js b/mcp-server.js index dd1176877..c8df09bbe 100644 --- a/mcp-server.js +++ b/mcp-server.js @@ -40,7 +40,6 @@ const SeqLib = require("./sequences"); const Templates = require("./templates"); const Workflows = require("./workflows"); const Music = require("./music"); -const MediaLib = require("./media-lib"); const Delivery = require("./delivery"); const { probeFile, infoForEntry } = require("./media-probe"); const { findProxies } = require("./proxy"); @@ -1362,7 +1361,7 @@ async function openverse(url) { } const fmtLen = (s) => s == null ? "?:??" : Music.fmtLen(s); function creditsText(proj) { - const list = Music.credits(proj, MediaLib.usageCounts(proj)); + const list = Music.credits(proj, Music.editUsage(proj)); // the open sequence and the comps it places if (!list.length) return ""; return [`CREDITS — licensed music in this edit (put these in the video's description):`, ...list.map((c) => ` ${c.needsCredit ? c.line : c.line + " (no credit required)"}`), @@ -1382,7 +1381,8 @@ async function musicTool(args) { try { const kind = kindFromName(got.name); if (kind !== "audio" && kind !== "video") throw new Error("the track's file isn't audio: " + got.name); - entry = await registerFile(got.target, kind, { name: `${t.title} — ${t.creator}`, license: Music.mediaLicense(t), keepRead: true }); + // always an audio entry, even in a video container: it's a music track, placed on an A track + entry = await registerFile(got.target, "audio", { name: `${t.title} — ${t.creator}`, license: Music.mediaLicense(t), keepRead: true }); } catch (e) { try { fs.rmSync(got.target, { force: true }); } catch {} throw e; @@ -1587,7 +1587,7 @@ async function exportTool(args) { if (r.status !== 200) throw new Error(r.body?.error || `export request failed (${r.status})`); job = r.body; // the credits of the timeline this job renders, kept with the job for later polls - try { const cr = creditsText(readProject()); if (cr) jobCredits.set(job.id, cr); } catch {} + try { const p = readProject(); jobCredits.set(job.id, { revision: p.revision || 0, text: creditsText(p) }); } catch {} if (job.notes && job.notes.length) startNote = `Settings adjusted: ${job.notes.join("; ")}\n`; if (args.wait === false) return (job.delivery ? `Output: ${job.delivery}\n` : "") + startNote + describeExportJob(job); } @@ -1601,7 +1601,19 @@ async function exportTool(args) { job = r.body; } // licensed music the edit uses: the credits belong in the video's description - const credits = job.status === "done" ? jobCredits.get(job.id) : ""; + let credits = ""; + if (job.status === "done" && jobCredits.has(job.id)) { + // the editor renders the live timeline: the credits taken at the request match it unless it changed meanwhile + const kept = jobCredits.get(job.id); + let now = null; + try { now = readProject(); } catch {} + if (now && (now.revision || 0) !== kept.revision) { + const text = creditsText(now); + credits = text !== kept.text + ? "The timeline changed while it exported, and so did its licensed music — check which version the file has before using these credits.\n" + (text || kept.text) + : text; + } else credits = kept.text; + } return startNote + describeExportJob(job) + (credits ? "\n" + credits : ""); } const jobCredits = new Map(); // export job id → the credits of the timeline it rendered diff --git a/music.js b/music.js index 2878efe8c..6fc2e1e06 100644 --- a/music.js +++ b/music.js @@ -101,10 +101,11 @@ for (const k of Object.keys(kind)) p.set(k, kind[k]); if (opts.length && LENGTHS[opts.length]) p.set("length", opts.length); // commercial / edits pick licence codes by FableCut's own table: Openverse's "commercial" group - // includes Sampling+, which FableCut labels non-commercial for a whole track + // includes Sampling+, which FableCut labels non-commercial for a whole track. edits means "may + // go under a video as it is", so it leaves out ND and the Sampling licences. let lic = (opts.licenses || []).map((l) => String(l).toLowerCase()).filter((l) => LICENSES[l]); if (opts.commercial || opts.edits) { - const ok = (c) => (!opts.commercial || LICENSES[c].commercial) && (!opts.edits || LICENSES[c].edits); + const ok = (c) => (!opts.commercial || LICENSES[c].commercial) && (!opts.edits || (LICENSES[c].edits && !LICENSES[c].sampling)); const picked = (lic.length ? lic : Object.keys(LICENSES)).filter(ok); if (!picked.length) throw new Error("none of those licences allow " + [opts.commercial && "commercial use", opts.edits && "edits"].filter(Boolean).join(" and ")); lic = picked; @@ -189,6 +190,27 @@ (l.url ? ` (${l.url})` : "") + (l.page ? ` — ${l.page}` : ""); } + /** How often each media file is placed in the edit itself: the open sequence's clips and the + * compositions placed in it (nested ones too) — not other sequences or comps nothing places. + * A linked group counts once. → Map(media id → placements) for `credits`. */ + function editUsage(doc) { + const n = new Map(), comps = new Map(((doc && doc.comps) || []).map((c) => [c.id, c])); + const scan = (clips, depth, inComps) => { + const seen = new Set(); + for (const c of clips || []) { + if (c.kind === "comp" && comps.has(c.compId) && depth < 8 && !inComps.has(c.compId)) + scan(comps.get(c.compId).clips, depth + 1, new Set([...inComps, c.compId])); + if (!c.mediaId) continue; + const key = (c.linkGroup ? "g:" + c.linkGroup : "c:" + c.id) + "|" + c.mediaId; + if (seen.has(key)) continue; + seen.add(key); + n.set(c.mediaId, (n.get(c.mediaId) || 0) + 1); + } + }; + scan(doc && doc.clips, 0, new Set()); + return n; + } + /** The credits an edit needs: every licensed file the edit uses (a denoised * copy counts as its original, and its credit says the sound was changed). * uses: media id → placements (MediaLib.usageCounts). @@ -220,5 +242,5 @@ const ABOUT = "Music from Openverse (openverse.org) — made with Openverse, not endorsed or certified by it. Each track's licence is the artist's: check it before you publish."; return { API, PAGE_SIZE, MAX_PAGE, LENGTHS, KINDS, MOODS, SFX_WORDS, LICENSES, ABOUT, - licence, flags, warnings, webUrl, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, credits }; + licence, flags, warnings, webUrl, searchUrl, trackUrl, track, results, fmtLen, fileName, mediaLicense, cleanLicense, creditLine, editUsage, credits }; }); diff --git a/project-ops.js b/project-ops.js index 5f3126623..7f1c17ab5 100644 --- a/project-ops.js +++ b/project-ops.js @@ -455,7 +455,10 @@ if (name === "replaceMedia") { m.name = op.name ? String(op.name).trim().slice(0, 200) : MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; - delete m.license; // another file: the old track's licence and credit don't apply (relinkMedia keeps it) + // another file: the old track's licence doesn't apply (relinkMedia keeps it); the new + // file's does, when another entry imported it with one (fablecut_music) + const same = proj.media.find((x) => x !== m && x.license && x.src === src); + if (same) m.license = { ...same.license }; else delete m.license; } else if (op.name) m.name = String(op.name).trim().slice(0, 200); if (info) { for (const k of MediaLib.INFO_KEYS) if (info[k] != null) m[k] = info[k]; diff --git a/skills/edit-video/SKILL.md b/skills/edit-video/SKILL.md index 6d2b90ab9..ed24a3179 100644 --- a/skills/edit-video/SKILL.md +++ b/skills/edit-video/SKILL.md @@ -103,10 +103,10 @@ them: look at those with `fablecut_frame` on the new canvas and move them. Lock the music lane before either cut. Caption it last: `fablecut_captions {style:"highlight", clipIds:[…the speech clips]}` (or subtitle, karaoke, pop), then look at a frame mid-sentence. -- **Music and sound effects** the user may use: `fablecut_music {query:"upbeat acoustic"}` - (or `kind:"sfx"`) lists openly licensed tracks with their licences; tell the - user the licence before they publish (ND tracks can't go under video; NC ones - not in monetized videos). `{import:""}` brings one in, `{credits:true}` +- **Music and sound effects** the user may use: `fablecut_music {query:"upbeat acoustic", edits:true}` + (or `kind:"sfx"`) lists openly licensed tracks that may go under a video, with their + licences; tell the user the licence before they publish (NC ones not in monetized + videos: add `commercial:true` then). `{import:""}` brings one in, `{credits:true}` gives the lines for the video's description. - Vary the font per title. Reusing one typeface across a whole edit is the single clearest tell of a machine-made cut; `fablecut_docs {section:"Text"}` diff --git a/skills/remake-reel/SKILL.md b/skills/remake-reel/SKILL.md index f388f2c90..a3c73edcb 100644 --- a/skills/remake-reel/SKILL.md +++ b/skills/remake-reel/SKILL.md @@ -38,11 +38,12 @@ as cuts, raise it. a whip transition on the way in. 5. Pace to taste: shots under ~0.6 s read as beat-flashes. `avgShotLen` tells you the reference's overall rhythm. -6. No music of their own? `fablecut_music {query:"", length:"short"}` - finds openly licensed tracks (say each one's licence; add - `commercial:true, edits:true` when the reel will be monetized), and - `{import:""}` brings one in with its credit. It replaces the reference's - music: `removeClip` the extracted track on A1, then place the new one there at 0. +6. No music of their own? `fablecut_music {query:"", length:"short", edits:true}` + finds openly licensed tracks that may go under a video (`edits:true` leaves out + ND and Sampling tracks; add `commercial:true` when the reel will be monetized), + and `{import:""}` brings one in with its credit. Say its licence. Only when + the import reply gives a placement (`Place it`), replace the reference's music: + `removeClip` the extracted track on A1, then place the new one there at 0. With the user's own music instead of the reference's, `fablecut_beats {clipId}` finds its tempo, beat and drop; `snap:true` rolls the cuts onto the beat, `retime:{every:2}` re-cuts V1 so each shot lasts 2 beats. diff --git a/test/music.test.js b/test/music.test.js index 77a91ec72..0dfd144f7 100644 --- a/test/music.test.js +++ b/test/music.test.js @@ -46,6 +46,8 @@ test("searchUrl builds the Openverse query", () => { assert.equal(u.searchParams.get("license"), "cc0,pdm,by,by-sa", "FableCut's own table, never Openverse's commercial group (it has Sampling+)"); assert.equal(u.searchParams.get("license_type"), null); assert.equal(new URL(M.searchUrl({ commercial: true })).searchParams.get("license"), "cc0,pdm,by,by-sa,by-nd"); + assert.equal(new URL(M.searchUrl({ edits: true })).searchParams.get("license"), "cc0,pdm,by,by-sa,by-nc,by-nc-sa", + "edits = may go under a video: no ND, no Sampling"); assert.equal(new URL(M.searchUrl({ commercial: true, licenses: ["by-nc", "by", "sampling+"] })).searchParams.get("license"), "by", "a choice is narrowed, never widened"); assert.throws(() => M.searchUrl({ commercial: true, licenses: ["by-nc", "sampling+"] }), /none of those licences allow commercial use/); assert.equal(u.searchParams.get("page_size"), "20"); @@ -121,6 +123,18 @@ test("a media entry keeps its licence, and the edit lists its credits", () => { const nd = M.credits(doc, MediaLib.usageCounts(doc)).find((c) => c.mediaId === "m_nd"); assert.deepEqual(nd.warnings, ["CC BY-NC-ND allows no derivatives — music set to video counts as one", "CC BY-NC-ND is non-commercial only"]); assert.match(ProjectOps.compactView(doc), /m_song audio "song".* licence:"CC BY-SA 3\.0"/); + + // the edit's own usage: the open sequence and the comps it places, not other sequences or unplaced comps + const scoped = seedProject({ + media: [{ id: "m_s", name: "s", kind: "audio", src: "/media/s.mp3", license: lic }, { id: "m_o", name: "o", kind: "audio", src: "/media/o.mp3", license: { ...lic, openverse: "x" } }, + { id: "m_u", name: "u", kind: "audio", src: "/media/u.mp3", license: { ...lic, openverse: "y" } }], + clips: [{ id: "cc", kind: "comp", compId: "k1", track: "V1", start: 0, in: 0, duration: 2 }], + comps: [{ id: "k1", name: "K", duration: 2, clips: [{ id: "ka", mediaId: "m_s", kind: "audio", track: "A1", start: 0, in: 0, duration: 2 }] }, + { id: "k2", name: "unused", duration: 2, clips: [{ id: "kb", mediaId: "m_u", kind: "audio", track: "A1", start: 0, in: 0, duration: 2 }] }], + sequence: "main", sequences: [{ id: "main", name: "Main" }, { id: "s2", name: "Other", clips: [{ id: "oc", mediaId: "m_o", kind: "audio", track: "A1", start: 0, in: 0, duration: 2 }] }], + }); + assert.deepEqual([...M.editUsage(scoped)], [["m_s", 1]]); + assert.deepEqual(M.credits(scoped, M.editUsage(scoped)).map((c) => c.mediaId), ["m_s"]); }); /* A stand-in for the Openverse API on 127.0.0.1, serving one track and its file. */ @@ -191,7 +205,10 @@ test("fablecut_music searches, imports a track with its licence, and lists the c await mcp.callTool("fablecut_patch_project", { ops: [{ op: "relinkMedia", id: m.id, src: "/media/other.wav" }] }); assert.deepEqual(readProject(dir).media.find((x) => x.id === m.id).license, before.license); await mcp.callTool("fablecut_patch_project", { ops: [{ op: "replaceMedia", id: m.id, src: "/media/Night%20Day%20-%20Jahzzar.wav" }] }); - assert.equal(readProject(dir).media.find((x) => x.id === m.id).license, undefined); + assert.equal(readProject(dir).media.find((x) => x.id === m.id).license, undefined, "a file no entry has a licence for: none"); + const ndEntry = readProject(dir).media.find((x) => x.license && x.license.title === "Golden Peaks"); + await mcp.callTool("fablecut_patch_project", { ops: [{ op: "replaceMedia", id: m.id, src: ndEntry.src }] }); + assert.equal(readProject(dir).media.find((x) => x.id === m.id).license.title, "Golden Peaks", "the replacement's own licence comes along"); }); test("a requested file name keeps its extension and never makes a dotfile", async (t) => { From 8ad3d3a5960f4c15c4025ec525e50d63a40ae4ca Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:25:37 +0530 Subject: [PATCH 6/9] =?UTF-8?q?Music:=20review=20round=203=20=E2=80=94=20c?= =?UTF-8?q?omp=20windows=20in=20credits,=20same-file=20replace,=20existing?= =?UTF-8?q?=20audio=20track?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - editUsage counts only what each comp instance shows (its in → in + duration window, nested) - Replacing a file with the same path keeps its licence; another file drops derivedFrom / denoise - Placement uses the top audio track that exists, with its lock check - The Export dialog's credits refresh when the project updates while it is open - remake-reel: remove the reference music only when it is there --- app.js | 16 ++++++++++++---- docs/demo/app.js | 16 ++++++++++++---- docs/demo/music.js | 14 ++++++++++---- music.js | 14 ++++++++++---- project-ops.js | 12 ++++++++---- skills/remake-reel/SKILL.md | 4 ++-- test/music.test.js | 9 +++++++++ 7 files changed, 63 insertions(+), 22 deletions(-) diff --git a/app.js b/app.js index cc776537a..b0bf46567 100644 --- a/app.js +++ b/app.js @@ -1482,6 +1482,8 @@ function syncExportFrameSel() { els.exportFrameSel.innerHTML = html; } function applyProject(data, opts = {}) { + // the Export dialog's music credits follow the timeline while it is open + queueMicrotask(() => { if (!$("exportSetup")?.classList.contains("hidden")) syncExportCredits(); }); if (state.compCtx && !opts.ctx && SeqLib.activeId(data) !== SeqLib.activeId(state.compCtx.root)) { // another sequence was opened (an agent, another tab): the comp was opened from the old one state.compCtx = null; @@ -2767,9 +2769,13 @@ async function setMediaSource(m, src, mode, name) { m.name = name || MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; // another file: the old track's licence doesn't apply (a relink keeps it); the new file's - // does, when another entry imported it with one (Music / SFX tab) - const same = project.media.find((x) => x !== m && x.license && x.src === src); - if (same) m.license = { ...same.license }; else delete m.license; + // does, when another entry imported it with one (Music / SFX tab). The same file keeps its + // licence. A replaced copy is no longer derived from its old original. + if (src !== oldSrc) { + const same = project.media.find((x) => x !== m && x.license && x.src === src); + if (same) m.license = { ...same.license }; else delete m.license; + delete m.derivedFrom; delete m.denoise; + } } mediaOffline.delete(m.id); reloadMediaSource(m, oldSrc); @@ -3357,7 +3363,9 @@ function placeImported(m, at) { if (!(m.duration > 0 && isFinite(m.duration))) return "its length couldn't be read, so it's in the Project bin but not on the timeline"; if ((project.sequence || null) !== at.seq || compCtxId() !== at.comp) return "another timeline is open now, so it's in the Project bin but not placed"; if (exportBusy()) return "an export is running, so it's in the Project bin but not placed"; - if (!addClipFromMedia(m, null, at.t)) return "it's in the Project bin, but the audio track is locked, so it wasn't placed"; + const lane = TRACKS.find((t) => t.kind === "audio"); // the top audio track there is (A1 may have been removed) + if (!lane) return "there's no audio track, so it's in the Project bin but not placed"; + if (!addClipFromMedia(m, lane.id, at.t)) return "it's in the Project bin, but " + lane.id + " is locked, so it wasn't placed"; return ""; } async function musicImport(t, place, kind) { diff --git a/docs/demo/app.js b/docs/demo/app.js index cc776537a..b0bf46567 100644 --- a/docs/demo/app.js +++ b/docs/demo/app.js @@ -1482,6 +1482,8 @@ function syncExportFrameSel() { els.exportFrameSel.innerHTML = html; } function applyProject(data, opts = {}) { + // the Export dialog's music credits follow the timeline while it is open + queueMicrotask(() => { if (!$("exportSetup")?.classList.contains("hidden")) syncExportCredits(); }); if (state.compCtx && !opts.ctx && SeqLib.activeId(data) !== SeqLib.activeId(state.compCtx.root)) { // another sequence was opened (an agent, another tab): the comp was opened from the old one state.compCtx = null; @@ -2767,9 +2769,13 @@ async function setMediaSource(m, src, mode, name) { m.name = name || MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; // another file: the old track's licence doesn't apply (a relink keeps it); the new file's - // does, when another entry imported it with one (Music / SFX tab) - const same = project.media.find((x) => x !== m && x.license && x.src === src); - if (same) m.license = { ...same.license }; else delete m.license; + // does, when another entry imported it with one (Music / SFX tab). The same file keeps its + // licence. A replaced copy is no longer derived from its old original. + if (src !== oldSrc) { + const same = project.media.find((x) => x !== m && x.license && x.src === src); + if (same) m.license = { ...same.license }; else delete m.license; + delete m.derivedFrom; delete m.denoise; + } } mediaOffline.delete(m.id); reloadMediaSource(m, oldSrc); @@ -3357,7 +3363,9 @@ function placeImported(m, at) { if (!(m.duration > 0 && isFinite(m.duration))) return "its length couldn't be read, so it's in the Project bin but not on the timeline"; if ((project.sequence || null) !== at.seq || compCtxId() !== at.comp) return "another timeline is open now, so it's in the Project bin but not placed"; if (exportBusy()) return "an export is running, so it's in the Project bin but not placed"; - if (!addClipFromMedia(m, null, at.t)) return "it's in the Project bin, but the audio track is locked, so it wasn't placed"; + const lane = TRACKS.find((t) => t.kind === "audio"); // the top audio track there is (A1 may have been removed) + if (!lane) return "there's no audio track, so it's in the Project bin but not placed"; + if (!addClipFromMedia(m, lane.id, at.t)) return "it's in the Project bin, but " + lane.id + " is locked, so it wasn't placed"; return ""; } async function musicImport(t, place, kind) { diff --git a/docs/demo/music.js b/docs/demo/music.js index 6fc2e1e06..209ab6833 100644 --- a/docs/demo/music.js +++ b/docs/demo/music.js @@ -195,11 +195,17 @@ * A linked group counts once. → Map(media id → placements) for `credits`. */ function editUsage(doc) { const n = new Map(), comps = new Map(((doc && doc.comps) || []).map((c) => [c.id, c])); - const scan = (clips, depth, inComps) => { + // lo / hi: the stretch of these clips' timeline that is shown (a comp instance shows its comp + // from `in` for `duration`, as the renderer flattens it); clips outside it aren't in the edit + const scan = (clips, depth, inComps, lo, hi) => { const seen = new Set(); for (const c of clips || []) { - if (c.kind === "comp" && comps.has(c.compId) && depth < 8 && !inComps.has(c.compId)) - scan(comps.get(c.compId).clips, depth + 1, new Set([...inComps, c.compId])); + const start = +c.start || 0, end = start + (+c.duration || 0); + if (end <= lo || start >= hi) continue; + if (c.kind === "comp" && comps.has(c.compId) && depth < 8 && !inComps.has(c.compId)) { + const off = (+c.in || 0) - start; // parent time → comp time + scan(comps.get(c.compId).clips, depth + 1, new Set([...inComps, c.compId]), Math.max(lo, start) + off, Math.min(hi, end) + off); + } if (!c.mediaId) continue; const key = (c.linkGroup ? "g:" + c.linkGroup : "c:" + c.id) + "|" + c.mediaId; if (seen.has(key)) continue; @@ -207,7 +213,7 @@ n.set(c.mediaId, (n.get(c.mediaId) || 0) + 1); } }; - scan(doc && doc.clips, 0, new Set()); + scan(doc && doc.clips, 0, new Set(), -Infinity, Infinity); return n; } diff --git a/music.js b/music.js index 6fc2e1e06..209ab6833 100644 --- a/music.js +++ b/music.js @@ -195,11 +195,17 @@ * A linked group counts once. → Map(media id → placements) for `credits`. */ function editUsage(doc) { const n = new Map(), comps = new Map(((doc && doc.comps) || []).map((c) => [c.id, c])); - const scan = (clips, depth, inComps) => { + // lo / hi: the stretch of these clips' timeline that is shown (a comp instance shows its comp + // from `in` for `duration`, as the renderer flattens it); clips outside it aren't in the edit + const scan = (clips, depth, inComps, lo, hi) => { const seen = new Set(); for (const c of clips || []) { - if (c.kind === "comp" && comps.has(c.compId) && depth < 8 && !inComps.has(c.compId)) - scan(comps.get(c.compId).clips, depth + 1, new Set([...inComps, c.compId])); + const start = +c.start || 0, end = start + (+c.duration || 0); + if (end <= lo || start >= hi) continue; + if (c.kind === "comp" && comps.has(c.compId) && depth < 8 && !inComps.has(c.compId)) { + const off = (+c.in || 0) - start; // parent time → comp time + scan(comps.get(c.compId).clips, depth + 1, new Set([...inComps, c.compId]), Math.max(lo, start) + off, Math.min(hi, end) + off); + } if (!c.mediaId) continue; const key = (c.linkGroup ? "g:" + c.linkGroup : "c:" + c.id) + "|" + c.mediaId; if (seen.has(key)) continue; @@ -207,7 +213,7 @@ n.set(c.mediaId, (n.get(c.mediaId) || 0) + 1); } }; - scan(doc && doc.clips, 0, new Set()); + scan(doc && doc.clips, 0, new Set(), -Infinity, Infinity); return n; } diff --git a/project-ops.js b/project-ops.js index 7f1c17ab5..46b417d13 100644 --- a/project-ops.js +++ b/project-ops.js @@ -449,16 +449,20 @@ const kindOf = MediaLib.kindFromName(src); if (kindOf && kindOf !== m.kind && !(m.kind === "audio" && kindOf === "video")) // an audio entry may sit in a video container throw new Error(`${name}: ${src} is ${kindOf === "audio" || kindOf === "image" ? "an" : "a"} ${kindOf} file, but ${m.id} is ${m.kind}`); - const was = { duration: m.duration }; + const was = { duration: m.duration }, sameFile = m.src === src; m.src = src; for (const k of MediaLib.INFO_KEYS) delete m[k]; if (name === "replaceMedia") { m.name = op.name ? String(op.name).trim().slice(0, 200) : MediaLib.srcName(src); delete m.duration; delete m.width; delete m.height; // another file: the old track's licence doesn't apply (relinkMedia keeps it); the new - // file's does, when another entry imported it with one (fablecut_music) - const same = proj.media.find((x) => x !== m && x.license && x.src === src); - if (same) m.license = { ...same.license }; else delete m.license; + // file's does, when another entry imported it with one (fablecut_music). The same file + // keeps its licence. A replaced copy is no longer derived from its old original. + if (!sameFile) { + const same = proj.media.find((x) => x !== m && x.license && x.src === src); + if (same) m.license = { ...same.license }; else delete m.license; + delete m.derivedFrom; delete m.denoise; + } } else if (op.name) m.name = String(op.name).trim().slice(0, 200); if (info) { for (const k of MediaLib.INFO_KEYS) if (info[k] != null) m[k] = info[k]; diff --git a/skills/remake-reel/SKILL.md b/skills/remake-reel/SKILL.md index a3c73edcb..1ed044669 100644 --- a/skills/remake-reel/SKILL.md +++ b/skills/remake-reel/SKILL.md @@ -42,8 +42,8 @@ as cuts, raise it. finds openly licensed tracks that may go under a video (`edits:true` leaves out ND and Sampling tracks; add `commercial:true` when the reel will be monetized), and `{import:""}` brings one in with its credit. Say its licence. Only when - the import reply gives a placement (`Place it`), replace the reference's music: - `removeClip` the extracted track on A1, then place the new one there at 0. + the import reply gives a placement (`Place it`), place it: if the reference's + extracted music is on A1, `removeClip` it first; then place the new track on A1 at 0. With the user's own music instead of the reference's, `fablecut_beats {clipId}` finds its tempo, beat and drop; `snap:true` rolls the cuts onto the beat, `retime:{every:2}` re-cuts V1 so each shot lasts 2 beats. diff --git a/test/music.test.js b/test/music.test.js index 0dfd144f7..383f09597 100644 --- a/test/music.test.js +++ b/test/music.test.js @@ -134,6 +134,13 @@ test("a media entry keeps its licence, and the edit lists its credits", () => { sequence: "main", sequences: [{ id: "main", name: "Main" }, { id: "s2", name: "Other", clips: [{ id: "oc", mediaId: "m_o", kind: "audio", track: "A1", start: 0, in: 0, duration: 2 }] }], }); assert.deepEqual([...M.editUsage(scoped)], [["m_s", 1]]); + // an instance showing seconds 0–2 of a comp doesn't credit audio the comp has at 8–10 + const windowed = JSON.parse(JSON.stringify(scoped)); + windowed.comps[0].duration = 10; + windowed.comps[0].clips.push({ id: "late", mediaId: "m_u", kind: "audio", track: "A2", start: 8, in: 0, duration: 2 }); + assert.deepEqual([...M.editUsage(windowed)], [["m_s", 1]]); + windowed.clips[0].in = 7; // now it shows 7–9: the late clip is in, the first (0–2) is not + assert.deepEqual([...M.editUsage(windowed)], [["m_u", 1]]); assert.deepEqual(M.credits(scoped, M.editUsage(scoped)).map((c) => c.mediaId), ["m_s"]); }); @@ -209,6 +216,8 @@ test("fablecut_music searches, imports a track with its licence, and lists the c const ndEntry = readProject(dir).media.find((x) => x.license && x.license.title === "Golden Peaks"); await mcp.callTool("fablecut_patch_project", { ops: [{ op: "replaceMedia", id: m.id, src: ndEntry.src }] }); assert.equal(readProject(dir).media.find((x) => x.id === m.id).license.title, "Golden Peaks", "the replacement's own licence comes along"); + await mcp.callTool("fablecut_patch_project", { ops: [{ op: "replaceMedia", id: ndEntry.id, src: ndEntry.src }] }); + assert.equal(readProject(dir).media.find((x) => x.id === ndEntry.id).license.title, "Golden Peaks", "the same file keeps its licence"); }); test("a requested file name keeps its extension and never makes a dotfile", async (t) => { From f677781909fb724c720651b683b773c74034ea62 Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:35:26 +0530 Subject: [PATCH 7/9] =?UTF-8?q?Music:=20review=20round=204=20=E2=80=94=20d?= =?UTF-8?q?enoised=20copies=20carry=20the=20licence,=20credits=20before=20?= =?UTF-8?q?the=20Export=20dialog=20shows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - A denoised copy keeps its original's licence (editor and fablecut_denoise), credited as changed - The Export dialog's credits are refreshed right before it shows - remake-reel: pick a track that covers the edit, or place it again after itself --- app.js | 2 ++ docs/demo/app.js | 2 ++ docs/demo/music.js | 3 ++- mcp-server.js | 1 + music.js | 3 ++- skills/remake-reel/SKILL.md | 2 ++ test/music.test.js | 8 ++++++++ 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index b0bf46567..13d87f680 100644 --- a/app.js +++ b/app.js @@ -9061,6 +9061,7 @@ async function denoiseClips(clips, level) { if (!m) { m = { id: "m_" + uid(), name: r.name, kind: "audio", src: r.src, duration: r.duration, folderId: base.folderId || null, derivedFrom: base.id, denoise: level }; + if (base.license) m.license = { ...base.license }; // the credit stays with the sound if (r.channels) m.channels = r.channels; project.media.push(m); } @@ -17056,6 +17057,7 @@ async function openExportSetup() { toast(exportRange(outFps).frames < 1 ? "The export range is empty — pick one" : !choiceOk ? "The last export's preset isn't there any more — pick one" : "The last export's engine isn't available — pick one"); } + syncExportCredits(); // the timeline may have changed while its settings loaded els.exportSetup.classList.remove("hidden"); // aria-modal hides what is behind — focus has to come inside if (!els.exportSetup.contains(document.activeElement)) $("exportRangeSel")?.focus(); diff --git a/docs/demo/app.js b/docs/demo/app.js index b0bf46567..13d87f680 100644 --- a/docs/demo/app.js +++ b/docs/demo/app.js @@ -9061,6 +9061,7 @@ async function denoiseClips(clips, level) { if (!m) { m = { id: "m_" + uid(), name: r.name, kind: "audio", src: r.src, duration: r.duration, folderId: base.folderId || null, derivedFrom: base.id, denoise: level }; + if (base.license) m.license = { ...base.license }; // the credit stays with the sound if (r.channels) m.channels = r.channels; project.media.push(m); } @@ -17056,6 +17057,7 @@ async function openExportSetup() { toast(exportRange(outFps).frames < 1 ? "The export range is empty — pick one" : !choiceOk ? "The last export's preset isn't there any more — pick one" : "The last export's engine isn't available — pick one"); } + syncExportCredits(); // the timeline may have changed while its settings loaded els.exportSetup.classList.remove("hidden"); // aria-modal hides what is behind — focus has to come inside if (!els.exportSetup.contains(document.activeElement)) $("exportRangeSel")?.focus(); diff --git a/docs/demo/music.js b/docs/demo/music.js index 209ab6833..ca4e918f1 100644 --- a/docs/demo/music.js +++ b/docs/demo/music.js @@ -235,7 +235,8 @@ if (!o) continue; const key = o.license.openverse || o.id; if (!byWork.has(key)) byWork.set(key, { o, changes: new Set() }); - if (m !== o && m.denoise) byWork.get(key).changes.add("noise reduced"); + // a denoised copy may carry the licence itself (and so be its own origin here) + if (m.denoise) byWork.get(key).changes.add("noise reduced"); else if (m !== o) byWork.get(key).changes.add("processed"); } return [...byWork.values()].map(({ o, changes }) => { diff --git a/mcp-server.js b/mcp-server.js index c8df09bbe..aa7a57a2d 100644 --- a/mcp-server.js +++ b/mcp-server.js @@ -1242,6 +1242,7 @@ async function denoiseTool(args) { if (!m) { m = { id: "m_" + uid(), name: r.name, kind: "audio", src, duration: r.duration, folderId: base.folderId || null, derivedFrom: base.id, denoise: amount }; + if (base.license) m.license = { ...base.license }; // the credit stays with the sound proj.media.push(m); } swap.set(id, m.id); diff --git a/music.js b/music.js index 209ab6833..ca4e918f1 100644 --- a/music.js +++ b/music.js @@ -235,7 +235,8 @@ if (!o) continue; const key = o.license.openverse || o.id; if (!byWork.has(key)) byWork.set(key, { o, changes: new Set() }); - if (m !== o && m.denoise) byWork.get(key).changes.add("noise reduced"); + // a denoised copy may carry the licence itself (and so be its own origin here) + if (m.denoise) byWork.get(key).changes.add("noise reduced"); else if (m !== o) byWork.get(key).changes.add("processed"); } return [...byWork.values()].map(({ o, changes }) => { diff --git a/skills/remake-reel/SKILL.md b/skills/remake-reel/SKILL.md index 1ed044669..8e5bd6a9e 100644 --- a/skills/remake-reel/SKILL.md +++ b/skills/remake-reel/SKILL.md @@ -44,6 +44,8 @@ as cuts, raise it. and `{import:""}` brings one in with its credit. Say its licence. Only when the import reply gives a placement (`Place it`), place it: if the reference's extracted music is on A1, `removeClip` it first; then place the new track on A1 at 0. + A clip can't run past its track's length: pick one at least as long as the edit + (`length` filter), or place it again right after itself to cover the rest. With the user's own music instead of the reference's, `fablecut_beats {clipId}` finds its tempo, beat and drop; `snap:true` rolls the cuts onto the beat, `retime:{every:2}` re-cuts V1 so each shot lasts 2 beats. diff --git a/test/music.test.js b/test/music.test.js index 383f09597..e7bf11a5a 100644 --- a/test/music.test.js +++ b/test/music.test.js @@ -117,6 +117,14 @@ test("a media entry keeps its licence, and the edit lists its credits", () => { assert.match(list[0].line, /^"Night & Day" by Jahzzar \(jamendo\) — CC BY-SA 3\.0 \(https:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0\/\) — https:\/\/www\.jamendo\.com\/track\/918921 — changed: noise reduced$/, "the edit plays a denoised copy, so the credit says it was changed"); assert.deepEqual(list[0].changes, ["noise reduced"]); + // a denoised copy that carries the licence itself still credits it, once, as changed + const own = JSON.parse(JSON.stringify(doc)); + own.media = own.media.filter((x) => x.id !== "m_song"); + own.media.find((x) => x.id === "m_den").license = lic; + own.clips = own.clips.filter((c) => c.mediaId !== "m_song"); + const ownList = M.credits(own, MediaLib.usageCounts(own)); + assert.equal(ownList.filter((c) => c.license.openverse === lic.openverse).length, 1); + assert.match(ownList[0].line, /— changed: noise reduced$/); assert.deepEqual(list[0].warnings, ["CC BY-SA: share the video under the same licence"]); assert.equal(list[1].needsCredit, false, "CC0 needs no credit"); doc.clips.push({ id: "c4", mediaId: "m_nd", kind: "audio", track: "A4", start: 0, in: 0, duration: 2 }); From f1b1fd99a7fff6de660da0d446f542353041ed10 Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:48:00 +0530 Subject: [PATCH 8/9] Denoise: take the licence from the file as it was when the clean-up started --- app.js | 4 +++- docs/demo/app.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 13d87f680..ea0f1c661 100644 --- a/app.js +++ b/app.js @@ -9054,6 +9054,8 @@ async function denoiseClips(clips, level) { toast(`Reducing noise (${level})…`); for (const id of bases) { const base = getMedia(id); + // the licence of the file being cleaned, read now: the entry may point at another file by the time it's done + const lic = base.license ? { ...base.license } : null; try { const r = await fetch("/api/denoise", { method: "POST", body: JSON.stringify({ src: base.src, amount: level }) }) .then(async (x) => { const j = await x.json(); if (!x.ok) throw new Error(j.error || x.status); return j; }); @@ -9061,7 +9063,7 @@ async function denoiseClips(clips, level) { if (!m) { m = { id: "m_" + uid(), name: r.name, kind: "audio", src: r.src, duration: r.duration, folderId: base.folderId || null, derivedFrom: base.id, denoise: level }; - if (base.license) m.license = { ...base.license }; // the credit stays with the sound + if (lic) m.license = lic; // the credit stays with the sound if (r.channels) m.channels = r.channels; project.media.push(m); } diff --git a/docs/demo/app.js b/docs/demo/app.js index 13d87f680..ea0f1c661 100644 --- a/docs/demo/app.js +++ b/docs/demo/app.js @@ -9054,6 +9054,8 @@ async function denoiseClips(clips, level) { toast(`Reducing noise (${level})…`); for (const id of bases) { const base = getMedia(id); + // the licence of the file being cleaned, read now: the entry may point at another file by the time it's done + const lic = base.license ? { ...base.license } : null; try { const r = await fetch("/api/denoise", { method: "POST", body: JSON.stringify({ src: base.src, amount: level }) }) .then(async (x) => { const j = await x.json(); if (!x.ok) throw new Error(j.error || x.status); return j; }); @@ -9061,7 +9063,7 @@ async function denoiseClips(clips, level) { if (!m) { m = { id: "m_" + uid(), name: r.name, kind: "audio", src: r.src, duration: r.duration, folderId: base.folderId || null, derivedFrom: base.id, denoise: level }; - if (base.license) m.license = { ...base.license }; // the credit stays with the sound + if (lic) m.license = lic; // the credit stays with the sound if (r.channels) m.channels = r.channels; project.media.push(m); } From b56333b09789c2270122afb5d73c81e1c984d30f Mon Sep 17 00:00:00 2001 From: Ronak Parmar <84374383+ronak-create@users.noreply.github.com> Date: Mon, 23 Nov 2026 16:21:47 +0530 Subject: [PATCH 9/9] Denoise: a removed original reports its error; a reused copy gets the licence --- app.js | 4 ++-- docs/demo/app.js | 4 ++-- mcp-server.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index ea0f1c661..6a9873563 100644 --- a/app.js +++ b/app.js @@ -9055,7 +9055,7 @@ async function denoiseClips(clips, level) { for (const id of bases) { const base = getMedia(id); // the licence of the file being cleaned, read now: the entry may point at another file by the time it's done - const lic = base.license ? { ...base.license } : null; + const lic = base && base.license ? { ...base.license } : null; // base: gone if removed meanwhile (caught below) try { const r = await fetch("/api/denoise", { method: "POST", body: JSON.stringify({ src: base.src, amount: level }) }) .then(async (x) => { const j = await x.json(); if (!x.ok) throw new Error(j.error || x.status); return j; }); @@ -9066,7 +9066,7 @@ async function denoiseClips(clips, level) { if (lic) m.license = lic; // the credit stays with the sound if (r.channels) m.channels = r.channels; project.media.push(m); - } + } else if (lic && !m.license) m.license = lic; // a copy made before the file had a licence swap.set(id, m.id); } catch (err) { toast(`Noise reduction failed: ${err.message || err}`); diff --git a/docs/demo/app.js b/docs/demo/app.js index ea0f1c661..6a9873563 100644 --- a/docs/demo/app.js +++ b/docs/demo/app.js @@ -9055,7 +9055,7 @@ async function denoiseClips(clips, level) { for (const id of bases) { const base = getMedia(id); // the licence of the file being cleaned, read now: the entry may point at another file by the time it's done - const lic = base.license ? { ...base.license } : null; + const lic = base && base.license ? { ...base.license } : null; // base: gone if removed meanwhile (caught below) try { const r = await fetch("/api/denoise", { method: "POST", body: JSON.stringify({ src: base.src, amount: level }) }) .then(async (x) => { const j = await x.json(); if (!x.ok) throw new Error(j.error || x.status); return j; }); @@ -9066,7 +9066,7 @@ async function denoiseClips(clips, level) { if (lic) m.license = lic; // the credit stays with the sound if (r.channels) m.channels = r.channels; project.media.push(m); - } + } else if (lic && !m.license) m.license = lic; // a copy made before the file had a licence swap.set(id, m.id); } catch (err) { toast(`Noise reduction failed: ${err.message || err}`); diff --git a/mcp-server.js b/mcp-server.js index aa7a57a2d..f34f24a4f 100644 --- a/mcp-server.js +++ b/mcp-server.js @@ -1244,7 +1244,7 @@ async function denoiseTool(args) { derivedFrom: base.id, denoise: amount }; if (base.license) m.license = { ...base.license }; // the credit stays with the sound proj.media.push(m); - } + } else if (base.license && !m.license) m.license = { ...base.license }; // a copy made before the file had a licence swap.set(id, m.id); report.push(`${id} → ${m.id} "${r.name}"${r.cached ? " (already rendered)" : ""}`); }