fablecut 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +189 -10
- package/README.md +39 -17
- package/analyze.js +3 -96
- package/app.js +1062 -77
- package/beats.js +458 -0
- package/command-search.js +79 -0
- package/export-jobs.js +4 -2
- package/highlights.js +296 -0
- package/index.html +34 -0
- package/mcp-server.js +344 -10
- package/media-files.js +271 -0
- package/package.json +2 -2
- package/reframe.js +297 -0
- package/server.js +210 -4
- package/style.css +76 -0
- package/transcripts.js +10 -0
package/CLAUDE.md
CHANGED
|
@@ -24,6 +24,8 @@ Every Claude Code session then has these tools:
|
|
|
24
24
|
set project fields, add and open sequences) without round-tripping the document. **Prefer this for edits.**
|
|
25
25
|
- `fablecut_import_media` — copy a local file (or download an `https://` URL)
|
|
26
26
|
into `./media/` and register it. The stored `src` is always `/media/…`.
|
|
27
|
+
- `fablecut_files` — the real folders in `./media/`: list one, make folders, move or rename
|
|
28
|
+
files and folders, trash and restore (nothing is deleted). See "Media management" below.
|
|
27
29
|
- `fablecut_analyze_reference` — turn a reference video into an edit blueprint
|
|
28
30
|
(shots, beats, BPM, energy, drop) + extract its music. See "Remake a reference video".
|
|
29
31
|
- `fablecut_frame` — **look at** a moment and get back an actual image.
|
|
@@ -46,6 +48,12 @@ Every Claude Code session then has these tools:
|
|
|
46
48
|
file and switches the clip's stems to it). See "Audio mix" below.
|
|
47
49
|
- `fablecut_silence` — find the pauses in speech and, with `cut:true`, cut them out
|
|
48
50
|
(extract on the targeted tracks, stems in step). See "Audio mix" below.
|
|
51
|
+
- `fablecut_beats` — find a music clip's tempo, beat and drop; mark the beats, snap the
|
|
52
|
+
cuts to them, or re-cut a track's clips on the beat. See "Audio mix" below.
|
|
53
|
+
- `fablecut_reframe` — reframe for another shape (9:16, 1:1, 4:5): a copy of the sequence
|
|
54
|
+
on that canvas whose shots follow the subject. See "Sequences" below.
|
|
55
|
+
- `fablecut_highlights` — the best moments of long footage cut into a short edit, in a new
|
|
56
|
+
sequence. See "Sequences" below.
|
|
49
57
|
- `fablecut_transcribe` — turn speech into words with times (Whisper, in the browser),
|
|
50
58
|
read them on the timeline, find a phrase and cut it out. See "Transcripts and
|
|
51
59
|
text-based editing" below.
|
|
@@ -379,6 +387,7 @@ Examples in `library/svg/`: `sparkles.svg` (loop), `lower-third.svg`,
|
|
|
379
387
|
| `fit` | "contain" | contain · cover (fill canvas, crop overflow) · stretch · none (native px) |
|
|
380
388
|
| `cropL` `cropR` `cropT` `cropB` | 0 | % of the source trimmed off each edge |
|
|
381
389
|
| `cornerRadius` | 0 | px, rounded corners — the PiP look |
|
|
390
|
+
| `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") |
|
|
382
391
|
| `flipH`, `flipV` | false | mirror |
|
|
383
392
|
|
|
384
393
|
**Filter / color** (video/image/svg):
|
|
@@ -468,10 +477,22 @@ dropdown + Shuffle), or reproduce it from an agent by writing the same props:
|
|
|
468
477
|
| `subtitle` | Roboto | small, bottom, bg pill, `karaoke` |
|
|
469
478
|
| `boldRise` | Archivo Black | uppercase, lower third, `rise-mask` |
|
|
470
479
|
| `luxury` | Cinzel | uppercase, cream→gold gradient, wide `letterSpacing`, `clip-reveal` |
|
|
480
|
+
| `popOutline` | Montserrat 900 | uppercase, gold with a dark outline, `letter-pop` |
|
|
481
|
+
| `boxed` | Inter 800 | dark text on a white box, lower third, `word-slide` |
|
|
482
|
+
| `headline` | Montserrat 900 | uppercase, outlined, the word being said in pink (`highlight`) |
|
|
483
|
+
| `comic` | Bangers | yellow with a thick outline, tilted −3°, `bounce` |
|
|
484
|
+
| `typewriter` | Special Elite | cream, lower-left, `typewriter` |
|
|
485
|
+
| `minimal` | Inter 300 | uppercase, very wide `letterSpacing`, no shadow, `rise-mask` |
|
|
486
|
+
| `script` | Great Vibes | white→blush gradient, `clip-reveal` |
|
|
487
|
+
| `retro` | Monoton | uppercase, pink `glow`, `letter-pop` |
|
|
488
|
+
| `sticker` | Fredoka 700 | white on a violet box, tilted −2°, lower third, `word-pop` |
|
|
489
|
+
| `glitch` | Russo One | uppercase, red `glow`, `shake` |
|
|
490
|
+
| `cinematic` | Cormorant Garamond 500 | uppercase, wide `letterSpacing`, `rise-mask` |
|
|
471
491
|
|
|
472
492
|
**Rule for agents: vary the font per title — never reuse one font across a whole
|
|
473
|
-
edit.** Any Google Font name auto-loads;
|
|
474
|
-
`library/fonts/`.
|
|
493
|
+
edit.** Any Google Font name auto-loads; some display faces ship in
|
|
494
|
+
`library/fonts/`. The font picker lists about sixty Google fonts by look
|
|
495
|
+
(Display, Sans, Serif, Script & hand, Retro & mono) and loads one on first use. Placement props (`x`/`y`) are canvas-aware in the styles
|
|
475
496
|
(lower third ≈ `y: height*0.30`).
|
|
476
497
|
|
|
477
498
|
Switching the style on an **existing** title (inspector dropdown/Shuffle) only
|
|
@@ -634,6 +655,33 @@ edits the key under the playhead. Agents:
|
|
|
634
655
|
as amber bands, **Cut N** extracts them (one undo step), **Clear** removes the
|
|
635
656
|
marks. The marks drop when the timeline, a clip's file, speed or level, or the
|
|
636
657
|
frame rate changes.
|
|
658
|
+
- **Beats** — `fablecut_beats {clipId, markers?, snap?, retime?, every?, force?}`
|
|
659
|
+
listens to a music clip (an audio clip, or a video's sound) and finds its tempo
|
|
660
|
+
(BPM), a **steady beat grid** — the tempo's period, phased and fitted to the
|
|
661
|
+
hits, so it doesn't drift over a song — and the drop, all in timeline seconds
|
|
662
|
+
through the clip's in point and speed. On its own it only reports. Then, in one
|
|
663
|
+
revision: `markers:true` puts a cyan marker on every beat (other markers stay, and a
|
|
664
|
+
beat that already has one keeps it);
|
|
665
|
+
`snap:true` (or `{tracks, maxShift}`) rolls each cut on the targeted video tracks
|
|
666
|
+
to the nearest beat within half a beat — a roll, so nothing else moves and
|
|
667
|
+
linked stems follow; a cut whose clips have no spare footage to reach the beat
|
|
668
|
+
stays where it is, and the reply says how many; `retime:{track?, every?, from?}`
|
|
669
|
+
lays a track's clips (default the lowest video track with clips) back to back
|
|
670
|
+
on the beat, `every` beats each (1, 2, 4, 8 or 16; default 2), from the first
|
|
671
|
+
beat at or after `from` (default the music's start), in their order — a clip
|
|
672
|
+
whose footage runs out gets fewer beats, clips past the music keep their
|
|
673
|
+
length, and one with less than a beat of footage refuses the whole re-cut.
|
|
674
|
+
Locked clips are left alone by snap and refuse retime, unless `force:true`
|
|
675
|
+
(only when the user asked). A version is kept before snap or retime; if saving it
|
|
676
|
+
fails, the edit still goes ahead and the reply says so in a warning. A re-cut clip
|
|
677
|
+
that gets shorter loses the keyframes past its new end, and its transitions are
|
|
678
|
+
kept no longer than the clip, as with a trim. The music clip itself (and its linked
|
|
679
|
+
stems) is never re-cut, even when it sits on the track being re-cut. Cuts land
|
|
680
|
+
on whole frames. A clip with a speed ramp is refused: its music doesn't keep
|
|
681
|
+
time on the timeline. In the editor: the Inspector's **Beats** section on an
|
|
682
|
+
audio or video clip — **Find beats** shows the beat as ticks across the
|
|
683
|
+
timeline and the BPM and drop below; then **Mark**, **Snap cuts**, and
|
|
684
|
+
**Re-cut** a track every N beats (each one undo step).
|
|
637
685
|
- In the editor, each audio clip shows its **volume line** (yellow; dashed =
|
|
638
686
|
after ducking): drag it to change the level, Ctrl/Cmd-click to add a keyframe,
|
|
639
687
|
drag a point to move it, Alt-click or double-click to remove one. The corner
|
|
@@ -684,9 +732,14 @@ edit. Find matches whole words and ignores case, accents, punctuation and spacin
|
|
|
684
732
|
|
|
685
733
|
In the editor, the **Transcript** tab beside the Inspector:
|
|
686
734
|
|
|
687
|
-
- **Transcribe** works on the selected clips' files
|
|
688
|
-
|
|
689
|
-
|
|
735
|
+
- **Transcribe** works on the selected clips' files (a selection with no speech,
|
|
736
|
+
such as a title, transcribes nothing), else on every file on the timeline that
|
|
737
|
+
has no transcript yet; once every file has one (an agent may
|
|
738
|
+
have made them), it reads **Transcribe again** and redoes them all. The model
|
|
739
|
+
and the language are beside it. Progress shows below (the first time, the
|
|
740
|
+
model download), with **Cancel**. A line above the words says which model and
|
|
741
|
+
language made them: when the words look wrong, pick the language spoken and
|
|
742
|
+
the Small model, then Transcribe again.
|
|
690
743
|
- The timeline's words, in paragraphs with timecodes. Click a word to go there;
|
|
691
744
|
the word under the playhead is underlined and followed while playing. ⇧-click or
|
|
692
745
|
drag to select a run of words, then press **Delete** (or **Cut**) to extract it.
|
|
@@ -1545,8 +1598,9 @@ it in every project; **titles that arrive and leave the same way** —
|
|
|
1545
1598
|
### Media management
|
|
1546
1599
|
|
|
1547
1600
|
The Project bin knows each file's details and helps find, group and track
|
|
1548
|
-
footage.
|
|
1549
|
-
exports
|
|
1601
|
+
footage. The bin's organizing (details, favorites, tags, collections, search)
|
|
1602
|
+
changes nothing that plays or exports; moving and trashing the files themselves
|
|
1603
|
+
("Files on disk" below) does what it says.
|
|
1550
1604
|
|
|
1551
1605
|
**Metadata.** The editor reads every file in `media/` and `library/` with
|
|
1552
1606
|
ffprobe (via `GET /api/media-info`) and writes what it finds onto the media
|
|
@@ -1676,6 +1730,39 @@ proxy only changes how smoothly the preview runs, never the result.
|
|
|
1676
1730
|
be an existing file under `/media/` or `/library/` of the same kind (an
|
|
1677
1731
|
audio entry may use a video container).
|
|
1678
1732
|
|
|
1733
|
+
**Files on disk.** The bin's folders (`folders`, `folderId`) only organize
|
|
1734
|
+
entries in `project.json`; the files themselves sit in `media/` and may live
|
|
1735
|
+
in subfolders. `fablecut_files` works on those (or `POST /api/files`):
|
|
1736
|
+
|
|
1737
|
+
- `{action:"list", dir?}` (an empty call to the MCP tool lists too) lists one folder: its subfolders and files with
|
|
1738
|
+
sizes and srcs. Dot-folders (`media/.trash/`) are left out.
|
|
1739
|
+
- `{action:"mkdir", dir:"b-roll/day 1"}` makes a folder (and its parents).
|
|
1740
|
+
- `{action:"move", from, to}` moves a file or folder into an existing folder,
|
|
1741
|
+
or to a new path (a rename); `to` is required (`"/media/"` is the top of
|
|
1742
|
+
`media/`). Every project's media entries that point at a moved file are repointed (the open project gets a new revision, so the editor
|
|
1743
|
+
reloads), a media name that was the old file name follows it, and the file's
|
|
1744
|
+
transcript goes with it (a `warning` says when one couldn't be). The move is
|
|
1745
|
+
refused while a project can't be read (`force:true` moves anyway, and the file
|
|
1746
|
+
goes offline there), and a project edited meanwhile stops it (CONFLICT, try
|
|
1747
|
+
again). If a project can't be written, the move is undone; if undoing fails
|
|
1748
|
+
too, the error says where the files are and which project couldn't be put
|
|
1749
|
+
back: check them there and relink. A name that is taken (also one taken while
|
|
1750
|
+
the move runs), and links inside `media/`, are refused, never replaced.
|
|
1751
|
+
- `{action:"trash", paths:[…]}` moves files or folders into `media/.trash/<id>/files/`
|
|
1752
|
+
with a note of where they were; nothing is deleted. A file a project still
|
|
1753
|
+
uses is refused (the reply names the project and how many clips place it):
|
|
1754
|
+
`removeMedia` it first, or `force:true` to trash it anyway, and it shows as
|
|
1755
|
+
offline there until it is restored. A project whose `project.json` can't be
|
|
1756
|
+
read counts as possibly using it, so the same applies. One call can't list a
|
|
1757
|
+
folder and something inside it. When one of several fails, the reply lists the
|
|
1758
|
+
ones already trashed, with their ids, and the path it stopped at.
|
|
1759
|
+
`{action:"trash-list"}` lists the trash, `{action:"restore", id}` puts one back
|
|
1760
|
+
where it was (refused while something else has that name; a `warning` says
|
|
1761
|
+
when its trash entry couldn't be cleaned up).
|
|
1762
|
+
- Move, rename and trash only when the user asked: they change the user's
|
|
1763
|
+
folder. Versions keep the paths they were saved with, so restoring an old
|
|
1764
|
+
version after a move may need **Relink**.
|
|
1765
|
+
|
|
1679
1766
|
### Projects
|
|
1680
1767
|
|
|
1681
1768
|
One FableCut keeps any number of projects. **`./project.json` is always the
|
|
@@ -1744,7 +1831,9 @@ list short without deleting anything.
|
|
|
1744
1831
|
|
|
1745
1832
|
### Versions
|
|
1746
1833
|
|
|
1747
|
-
Every edit is saved as it happens, and undo covers the session.
|
|
1834
|
+
Every edit is saved as it happens, and undo covers the session. An edit that
|
|
1835
|
+
reaches the open editor from outside (an agent, another tab) is one undo step of
|
|
1836
|
+
its own there: Ctrl+Z takes it back first, then the user's own edits. **Versions** are
|
|
1748
1837
|
what you come back to later: full copies of a project, kept beside it, that are
|
|
1749
1838
|
never overwritten. Restoring one is not destructive either — what is there is
|
|
1750
1839
|
saved as a version first, so a restore can be undone by restoring that.
|
|
@@ -1872,10 +1961,68 @@ sequence.
|
|
|
1872
1961
|
sequence's changes on its own, sequences added and removed, and which one
|
|
1873
1962
|
was open.
|
|
1874
1963
|
|
|
1875
|
-
|
|
1964
|
+
**Reframe** — `fablecut_reframe {aspect?:"9:16"|"1:1"|"4:5"|"16:9"|"4:3"|"2:3", name?, clipIds?, follow?, smooth?, force?}`
|
|
1965
|
+
makes a copy of the open sequence on that canvas shape and opens it (the
|
|
1966
|
+
project's shorter side kept: 1920×1080 → 1080×1920 for 9:16, 1080×1080 for
|
|
1967
|
+
1:1), so the original cut stays as it was; without `aspect` it reframes the
|
|
1968
|
+
open sequence on its own canvas. Each full-frame shot — a video or still that
|
|
1969
|
+
isn't moved, scaled, cropped or keyed by hand — gets `fit:"cover"` and an `x`
|
|
1970
|
+
(or `y`) that keeps its subject in view. Frames are sampled 5 times a second at
|
|
1971
|
+
96 px; the subject is where motion (against the shot's own movement, so a pan
|
|
1972
|
+
or a flicker doesn't count), detail and colour gather, pulled gently toward
|
|
1973
|
+
the centre. A virtual camera operator then holds still while the subject
|
|
1974
|
+
stays inside a dead zone and eases after it no faster than a pan speed, and
|
|
1975
|
+
the path becomes ordinary keyframes (thinned to within ~2 px), or one steady
|
|
1976
|
+
position. Shots with no clear subject are centred. Titles, picture-in-picture,
|
|
1977
|
+
clips placed or animated by hand and locked clips (unless `force:true`) are
|
|
1978
|
+
left alone and listed in the reply — check them on the new canvas with
|
|
1979
|
+
`fablecut_frame {time}`. `follow:false` only fits and centres; `smooth` 0…1
|
|
1980
|
+
(default 0.5) holds longer and pans slower as it rises. `props.reframe` marks
|
|
1981
|
+
what Reframe did, so running it again replaces its own keys. A version is kept
|
|
1982
|
+
first. In the editor: **New sequence…** with a copy of the open sequence on
|
|
1983
|
+
another shape has **Follow the subject in each shot**; the Inspector's
|
|
1984
|
+
**Reframe** section on a video or picture of another shape than the canvas
|
|
1985
|
+
has **Follow subject**, **Centre** and Lively / Balanced / Steady (the selected
|
|
1986
|
+
clips, one undo step, with Cancel).
|
|
1987
|
+
|
|
1988
|
+
**Highlights** — `fablecut_highlights {duration?, shot?, clipIds?, mediaIds?, name?, aspect?}`
|
|
1989
|
+
finds the best moments of long footage and cuts them into a short edit: a new
|
|
1990
|
+
sequence (`Highlights 30 s`, or `name`), opened, so the timeline it came from
|
|
1991
|
+
stays as it was. It reads the video clips on the open timeline (`clipIds`
|
|
1992
|
+
limits them; `mediaIds` reads whole files instead), up to an hour of footage
|
|
1993
|
+
at a time: frames twice a second at 64 px, and the sound. Every half second is
|
|
1994
|
+
scored for movement, sound louder than the 20 s around it (a cheer, a laugh, a
|
|
1995
|
+
hit), its overall level, and a clear picture; black frames and flat colour
|
|
1996
|
+
count for little. Cuts already in the footage are found, and a moment never
|
|
1997
|
+
crosses one. It then takes the best moments of `shot` seconds (default
|
|
1998
|
+
`duration` / 8, kept within 1.5–4 s), apart in the same footage (by half a
|
|
1999
|
+
moment, at least a second) and spread over its shots, until the edit is `duration` seconds
|
|
2000
|
+
(default 30; 5…600), trims the last ones to fit exactly, and nudges each end up
|
|
2001
|
+
to 0.3 s to the quietest point near it, so no word or hit is cut through. The
|
|
2002
|
+
moments go back to back on V1 in story order, each a clip of its source with
|
|
2003
|
+
its props (a reframed clip's framing isn't carried over) and its linked sound
|
|
2004
|
+
clips beside it (their own tracks, linked again); their keyframes aren't
|
|
2005
|
+
carried over. A moment from a whole file (`mediaIds`) is one video clip that
|
|
2006
|
+
plays its own sound, with no separate audio clips. A clip played faster or
|
|
2007
|
+
slower counts by its length on the timeline: `duration` and `shot` are always
|
|
2008
|
+
seconds of the edit. In the editor (and Studio) the sound of a file longer than
|
|
2009
|
+
30 minutes isn't read, so as not to decode it whole in the browser; its picture
|
|
2010
|
+
decides. Disabled clips and clips with a speed ramp are not read. `aspect`
|
|
2011
|
+
makes the new sequence 9:16, 1:1 or 4:5: the shots are then letterboxed, and
|
|
2012
|
+
`fablecut_reframe {}` fits them and follows the subject. The reply lists each
|
|
2013
|
+
moment (its source, times, length, why it was picked and its score). A version
|
|
2014
|
+
is kept first. In the editor: the sequence menu's **Highlights…** (15, 30, 60 or
|
|
2015
|
+
90 s; a canvas, and **Follow the subject in each shot** on another shape)
|
|
2016
|
+
reads the selected video clips, else every video clip on the timeline, with
|
|
2017
|
+
progress and **Cancel**.
|
|
2018
|
+
|
|
2019
|
+
Recipes: **vertical cut of a finished edit** — `fablecut_reframe {aspect:"9:16"}`,
|
|
2020
|
+
then check the titles with `fablecut_frame`; by hand, `addSequence {name:"Reel 9:16",
|
|
1876
2021
|
from:"open", width:1080, height:1920}`, then `inSequence` ops to re-position
|
|
1877
2022
|
or re-scale the shots and `setProject {delivery:"instagram-reels"}` in it;
|
|
1878
|
-
**
|
|
2023
|
+
**reel from a long video** — `fablecut_highlights {duration:30, aspect:"9:16"}`,
|
|
2024
|
+
then `fablecut_reframe {}`, music on an audio track and `fablecut_beats {clipId:<the music>, retime:{every:2}}`,
|
|
2025
|
+
then captions; **cut-downs** — duplicate the edit as "30 s" and "15 s" and tighten each with
|
|
1879
2026
|
the trim ops inside `inSequence`; **selects reel** — an empty sequence the
|
|
1880
2027
|
user drops favourite takes on, cut into the edit from the Source monitor.
|
|
1881
2028
|
|
|
@@ -2103,6 +2250,13 @@ obvious cuts were missed, raise it if motion is being misread as cuts.
|
|
|
2103
2250
|
name?, note?, final?}` → `{version}` · `delete {version}` → `{deleted}`. `GET /api/versions/file?project=&version=`
|
|
2104
2251
|
is that version's document; `GET /api/projects/backup?id=` a project with all its versions (import it with
|
|
2105
2252
|
`POST /api/projects {action:"import", project:<the backup>}`). SSE event `versions` (`{project, action}`). See "Versions".
|
|
2253
|
+
- `POST /api/files {action, …}` — the files in `media/`: `list {dir?}` → `{dir, folders, files:[{name, src, size}]}` ·
|
|
2254
|
+
`mkdir {dir}` · `move {from, to, force?}` → `{from, to, moved:[{from, to}], repointed:[{project, open, media}], warning?}`
|
|
2255
|
+
(`from` / `to` are the item itself; `moved` lists each file in it, so it is empty for an empty folder or a no-op;
|
|
2256
|
+
409 while a project can't be read, unless `force:true`) ·
|
|
2257
|
+
`trash {paths, force?}` → `{trashed:[{id, src}], offline}` (409 while a project uses one or can't be read, unless `force:true`;
|
|
2258
|
+
a batch that stops part-way answers 400 with `trashed` and `failed`; `stillThere` lists uses whose file is still in place) ·
|
|
2259
|
+
`trash-list` → `{items}` · `restore {id}`. See "Media management".
|
|
2106
2260
|
- `GET /api/library?dir=sfx|elements|svg|fonts|presets|templates` — list library assets
|
|
2107
2261
|
- `GET /api/presets` · `GET /api/templates` — the saved presets / templates, validated (bad files skipped);
|
|
2108
2262
|
`POST /api/presets {preset}` · `POST /api/templates {template}` — validate one and save it as
|
|
@@ -2230,6 +2384,16 @@ so all takes sit at one loudness, then keep the music on its own lane and pull
|
|
|
2230
2384
|
that lane down: `{op:"setTrack", id:"A3", set:{gain:-14}}`. Then dip it under the
|
|
2231
2385
|
voice: `fablecut_auto_duck {clipIds:[<music clip>], under:["A1"], amount:-10}`.
|
|
2232
2386
|
|
|
2387
|
+
**Cut a montage to the music**: put the shots on V1 in the order you want (rough
|
|
2388
|
+
lengths are fine) and the music on an audio lane, then
|
|
2389
|
+
`fablecut_beats {clipId:<the music>, retime:{every:2}}` — each shot gets two beats
|
|
2390
|
+
where its footage allows (fewer when it runs out; clips past the music keep their
|
|
2391
|
+
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;
|
|
2392
|
+
re-cut the part after the drop separately with `retime:{from:<the drop>, every:1}`.
|
|
2393
|
+
For an edit whose cuts are already chosen, `snap:true` just nudges each one onto
|
|
2394
|
+
the nearest beat (cuts on untargeted tracks, beside locked clips, or without spare
|
|
2395
|
+
footage to reach it stay where they are; the reply counts them). Check a cut with `fablecut_frame` before exporting.
|
|
2396
|
+
|
|
2233
2397
|
**Tighten a talking-head take**: lock the music lane (`setProject {lockedTracks:["A3"]}`),
|
|
2234
2398
|
then `fablecut_silence {clipIds:[<the take>]}` to see the pauses (it does the
|
|
2235
2399
|
listening; `fablecut_frame` only shows the picture, handy to check a cut won't land
|
|
@@ -2409,6 +2573,16 @@ cannot produce a one-frame black file.
|
|
|
2409
2573
|
3. IN–OUT, OUT only → from the start to `outPoint`
|
|
2410
2574
|
4. IN–OUT, both → the range between them
|
|
2411
2575
|
|
|
2576
|
+
**Save as** at the top of the dialog names the file. It starts as the name the
|
|
2577
|
+
export would get (the preset's filename pattern, `{project}_…`); type over it
|
|
2578
|
+
and that name is used for this export (blank goes back to the default). Fast and
|
|
2579
|
+
WebCodecs exports add a number when the name is taken in `exports/`; a Realtime
|
|
2580
|
+
export is a browser download, which the browser names. Enter renders. **Don't ask
|
|
2581
|
+
again** beside the buttons makes the Export button render straight away with the
|
|
2582
|
+
last engine and preset under the default name (the dialog opens instead when one
|
|
2583
|
+
of them is gone or the range is empty); **Settings → Ask before exporting** brings the
|
|
2584
|
+
dialog back (stored in this browser).
|
|
2585
|
+
|
|
2412
2586
|
**Agents export with `fablecut_export`** (or `POST /api/export/request`). It is
|
|
2413
2587
|
the same Fast export as the button — same compositor, audio mix and encoding
|
|
2414
2588
|
profile — so it needs ffmpeg on PATH. The job goes to an open editor tab (the
|
|
@@ -2424,6 +2598,11 @@ agent last wrote, so an export right after a patch includes that patch.
|
|
|
2424
2598
|
settings (`{preset:"youtube", delivery:{fps:60, video:{rate:"vbr", bitrate:16000}}}`).
|
|
2425
2599
|
`profile:"hq"` picks a raw encoding profile instead. With neither, `project.delivery`
|
|
2426
2600
|
is used when set, else `project.encodeProfile`, else the server's default profile.
|
|
2601
|
+
- `name:"salon-promo-15s"` names the file (no extension), the answer the Export dialog asks
|
|
2602
|
+
the user for. Without it the preset's pattern starts with the project's name, so name the
|
|
2603
|
+
file after what it is whenever the project holds more than this one video. Only the name
|
|
2604
|
+
changes — the preset, delivery or encoding profile the export uses stays the same; not with
|
|
2605
|
+
`outputs` (each output has its own `filename`).
|
|
2427
2606
|
- `outputs:true` exports the project's checked batch outputs; `outputs:[{preset:"master"},
|
|
2428
2607
|
{preset:"youtube"}, {preset:"instagram-reels"}, …]` exports a list. One render per
|
|
2429
2608
|
frame rate; the reply lists every file (or why one failed).
|
package/README.md
CHANGED
|
@@ -32,13 +32,6 @@ Zero npm dependencies. One `node server.js`. That's it.
|
|
|
32
32
|
|
|
33
33
|

|
|
34
34
|
|
|
35
|
-
## Sponsors
|
|
36
|
-
|
|
37
|
-
<a href="https://fluxionai.space/register?source=github&campaign=github-sidrune-fablecut&promo=SDRFABLECUT" target="_blank" rel="noopener noreferrer sponsored">
|
|
38
|
-
<img src="docs/sponsors/sidrune-ai-banner.png" alt="Sidrune AI — one API for GPT, Claude and other leading AI models" width="640">
|
|
39
|
-
</a>
|
|
40
|
-
|
|
41
|
-
**[Sidrune AI](https://fluxionai.space/register?source=github&campaign=github-sidrune-fablecut&promo=SDRFABLECUT)** — One API for GPT, Claude, and other leading AI models. Sign up and get $3 in API credit.
|
|
42
35
|
|
|
43
36
|
## Why it's interesting
|
|
44
37
|
|
|
@@ -49,6 +42,15 @@ can edit video, and the open browser UI hot-reloads within ~150 ms via
|
|
|
49
42
|
server-sent events. A human and an agent can work on the same timeline at the
|
|
50
43
|
same time.
|
|
51
44
|
|
|
45
|
+
**Taking back what the agent did.** Every agent edit is one undo step of its
|
|
46
|
+
own: Ctrl+Z takes back the agent's last change first (and says so), then
|
|
47
|
+
goes on to yours, so the two never get mixed. For bigger rollbacks there are
|
|
48
|
+
**Versions**: one is kept when an agent starts editing (again at most every
|
|
49
|
+
10 minutes while it works), before it rewrites the whole project, before every
|
|
50
|
+
big operation (cutting silences, snapping to the beat, reframing), and every
|
|
51
|
+
10 minutes while you edit. Restore one from the Versions panel, or ask the agent
|
|
52
|
+
(`fablecut_versions`), and compare any version with now first.
|
|
53
|
+
|
|
52
54
|
## Features
|
|
53
55
|
|
|
54
56
|
**Editing**
|
|
@@ -56,6 +58,9 @@ same time.
|
|
|
56
58
|
- Video + audio tracks (default 3+4; add more with **+V** / **+A** in the track
|
|
57
59
|
header; right-click an empty header → **Remove track**), drag/trim/split/snap,
|
|
58
60
|
undo/redo
|
|
61
|
+
- **Search** (**Ctrl/Cmd+K**, or the magnifier in the top bar) — one box that finds
|
|
62
|
+
toolbar actions, panels, Settings, the selected clip's Inspector sections, media,
|
|
63
|
+
clips and keyboard shortcuts; Enter runs the one you picked
|
|
59
64
|
- **Settings** (cog in the top bar) — optional prefs stored in this browser via
|
|
60
65
|
`localStorage`. Enable **Link timeline and Project bin selection** so picking a
|
|
61
66
|
timeline clip highlights its media in Project, and clicking a Project item
|
|
@@ -127,10 +132,22 @@ same time.
|
|
|
127
132
|
Strong) measures the file's noise floor and renders a cleaned copy with
|
|
128
133
|
ffmpeg; the clip's audio switches to it and **Off** switches back. Agents
|
|
129
134
|
use `fablecut_denoise`.
|
|
135
|
+
- **Reframe** — make a 9:16, 1:1 or 4:5 copy of your edit whose shots follow
|
|
136
|
+
the subject: a virtual camera pans after what matters in each shot and
|
|
137
|
+
writes ordinary position keys you can still edit. From **New sequence…**
|
|
138
|
+
or the Inspector's **Reframe** section; agents use `fablecut_reframe`.
|
|
139
|
+
- **Highlights** — the best moments of long footage (movement, sound, a
|
|
140
|
+
clear picture) cut into a short edit in a new sequence, in story order and
|
|
141
|
+
never across a cut. From the sequence menu's **Highlights…**; agents use
|
|
142
|
+
`fablecut_highlights`.
|
|
130
143
|
- **Silence removal** — the inspector's **Silence** section (or right-click →
|
|
131
144
|
**Find silences**) listens to a take and marks every pause on the timeline;
|
|
132
145
|
**Cut** extracts them all in one undo step, keeping a little quiet beside
|
|
133
146
|
each phrase so words aren't clipped. Agents use `fablecut_silence`.
|
|
147
|
+
- **Beats** — the inspector's **Beats** section finds a music clip's tempo, a
|
|
148
|
+
steady beat grid and the drop, and shows the beat across the timeline. Mark
|
|
149
|
+
the beats, snap every cut onto the nearest one, or re-cut a track so each
|
|
150
|
+
shot lasts 1, 2, 4, 8 or 16 beats. Agents use `fablecut_beats`.
|
|
134
151
|
- **Transcripts and text-based editing** — the **Transcript** tab turns speech
|
|
135
152
|
into words with times, in the browser (Whisper; the model downloads once and
|
|
136
153
|
the audio never leaves your machine). Click a word to go there, select words
|
|
@@ -275,9 +292,10 @@ same time.
|
|
|
275
292
|
|
|
276
293
|
**Text**
|
|
277
294
|
|
|
278
|
-
- **Title styles** — one-tap cohesive looks (Impact, Elegant, Kinetic cut, Neon,
|
|
279
|
-
|
|
280
|
-
automatically instead of defaulting to one flat style
|
|
295
|
+
- **Title styles** — twenty one-tap cohesive looks (Impact, Elegant, Kinetic cut, Neon,
|
|
296
|
+
Luxury, Comic, Typewriter, Sticker, Cinematic, and more); new titles vary the font,
|
|
297
|
+
placement and animation automatically instead of defaulting to one flat style. The
|
|
298
|
+
font picker groups about sixty Google fonts by look, and any other loads by name
|
|
281
299
|
- Kinetic captions: typewriter, word-pop, word-slide, karaoke, **letter-pop**,
|
|
282
300
|
**wave**, **bounce**, **shake**, **clip-reveal**, **zoom-in**, **font-cut**
|
|
283
301
|
(rhythmic typeface cuts), **rise-mask**
|
|
@@ -361,8 +379,12 @@ same time.
|
|
|
361
379
|
- Realtime MediaRecorder fallback when ffmpeg or WebCodecs isn't available
|
|
362
380
|
- Agents export too: `fablecut_export` runs the Fast export in the open editor,
|
|
363
381
|
or in a headless Chrome / Edge the server starts, and returns the file path;
|
|
364
|
-
`preset` and `delivery` pick and adjust a delivery preset; `
|
|
365
|
-
|
|
382
|
+
`preset` and `delivery` pick and adjust a delivery preset; `name` names the
|
|
383
|
+
file (only the name changes; not with `outputs`); `outputs` makes several
|
|
384
|
+
files in one go
|
|
385
|
+
- **Save as** at the top of the Export dialog names the file; **Don't ask again**
|
|
386
|
+
makes the Export button render straight away with the last settings
|
|
387
|
+
(Settings → Ask before exporting brings the dialog back)
|
|
366
388
|
- Export **Range** dropdown: Entire timeline or IN–OUT (defaults to IN–OUT when
|
|
367
389
|
markers are set). Effective IN/OUT export bounds are clamped to `projDur()`.
|
|
368
390
|
|
|
@@ -380,7 +402,7 @@ cd FableCut
|
|
|
380
402
|
node server.js # → http://localhost:7777
|
|
381
403
|
```
|
|
382
404
|
|
|
383
|
-
Requirements: **Node
|
|
405
|
+
Requirements: **Node 22+** and a Chromium-based browser. **ffmpeg on PATH** is
|
|
384
406
|
optional but recommended (fast export + upload remuxing). AI background
|
|
385
407
|
removal fetches its model from a CDN on first use.
|
|
386
408
|
|
|
@@ -403,7 +425,7 @@ you choose. Leave it unset and everything stays in the repo, exactly as before.
|
|
|
403
425
|
|
|
404
426
|
That registers the MCP server for you and adds three skills — `edit-video`,
|
|
405
427
|
`remake-reel` and `motion-graphics`. Your timeline and footage live in the plugin's own data
|
|
406
|
-
directory, so an update never touches them. Node
|
|
428
|
+
directory, so an update never touches them. Node 22+ and (optionally) ffmpeg
|
|
407
429
|
still need to be on your machine.
|
|
408
430
|
|
|
409
431
|
## Driving it with an AI agent
|
|
@@ -465,13 +487,13 @@ Three equivalent control surfaces:
|
|
|
465
487
|
|
|
466
488
|
The server is intentionally client-neutral. It speaks MCP over stdio and
|
|
467
489
|
does not require Claude-specific environment variables. With a clone, keep
|
|
468
|
-
the path absolute. Node
|
|
490
|
+
the path absolute. Node 22 or newer either way.
|
|
469
491
|
|
|
470
492
|
Tools: `fablecut_status` (auto-starts the editor), `fablecut_docs`,
|
|
471
493
|
`fablecut_get_project`, `fablecut_set_project`, `fablecut_patch_project`,
|
|
472
|
-
`fablecut_import_media`, `fablecut_analyze_reference`, `fablecut_frame`,
|
|
494
|
+
`fablecut_import_media`, `fablecut_files`, `fablecut_analyze_reference`, `fablecut_frame`,
|
|
473
495
|
`fablecut_encode_profiles`, `fablecut_normalize_audio`, `fablecut_auto_duck`,
|
|
474
|
-
`fablecut_denoise`, `fablecut_silence`, `fablecut_transcribe`, `fablecut_captions`, `fablecut_export`, `fablecut_scopes`, `fablecut_track`.
|
|
496
|
+
`fablecut_denoise`, `fablecut_silence`, `fablecut_beats`, `fablecut_reframe`, `fablecut_highlights`, `fablecut_transcribe`, `fablecut_captions`, `fablecut_export`, `fablecut_scopes`, `fablecut_track`.
|
|
475
497
|
|
|
476
498
|
FableCut is also published on the **official MCP registry** as
|
|
477
499
|
[`io.github.ronak-create/fablecut`](https://registry.modelcontextprotocol.io/v0/servers?search=fablecut)
|
package/analyze.js
CHANGED
|
@@ -15,6 +15,7 @@ const fs = require("fs");
|
|
|
15
15
|
const path = require("path");
|
|
16
16
|
const { spawn } = require("child_process");
|
|
17
17
|
const Stats = require("./frame-stats");
|
|
18
|
+
const Beats = require("./beats");
|
|
18
19
|
|
|
19
20
|
const SR = 22050; // analysis sample rate
|
|
20
21
|
const HOP = 512; // onset-envelope hop size (~23 ms)
|
|
@@ -86,103 +87,9 @@ async function decodePCM(file) {
|
|
|
86
87
|
return new Int16Array(buf.buffer, buf.byteOffset, Math.floor(buf.length / 2));
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
/* beats, BPM, energy curve and drop: beats.js, shared with the editor's Beats section and fablecut_beats */
|
|
89
91
|
function analyzeAudio(pcm) {
|
|
90
|
-
|
|
91
|
-
if (nFrames < 20) return { beats: [], bpm: null, energy: { step: 0.5, values: [] }, drop: null };
|
|
92
|
-
|
|
93
|
-
// frame energies
|
|
94
|
-
const E = new Float64Array(nFrames);
|
|
95
|
-
for (let i = 0; i < nFrames; i++) {
|
|
96
|
-
let s = 0;
|
|
97
|
-
const o = i * HOP;
|
|
98
|
-
for (let j = 0; j < WIN; j++) { const x = pcm[o + j] / 32768; s += x * x; }
|
|
99
|
-
E[i] = s / WIN;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// onset envelope: energy rise vs. trailing average
|
|
103
|
-
const O = new Float64Array(nFrames);
|
|
104
|
-
for (let i = 1; i < nFrames; i++) {
|
|
105
|
-
let m = 0, k = 0;
|
|
106
|
-
for (let j = Math.max(0, i - 8); j < i; j++) { m += E[j]; k++; }
|
|
107
|
-
O[i] = Math.max(0, E[i] - m / k);
|
|
108
|
-
}
|
|
109
|
-
let oMax = 0;
|
|
110
|
-
for (let i = 0; i < nFrames; i++) if (O[i] > oMax) oMax = O[i];
|
|
111
|
-
if (oMax > 0) for (let i = 0; i < nFrames; i++) O[i] /= oMax;
|
|
112
|
-
|
|
113
|
-
// peak-pick beats: local max, above an adaptive floor, min 0.25 s apart
|
|
114
|
-
const frameT = (i) => Math.round(((i * HOP + WIN / 2) / SR) * 1000) / 1000;
|
|
115
|
-
const minGap = Math.round(0.25 * SR / HOP);
|
|
116
|
-
const halfWin = Math.round(1.0 * SR / HOP);
|
|
117
|
-
const beats = [];
|
|
118
|
-
let last = -minGap;
|
|
119
|
-
for (let i = 3; i < nFrames - 3; i++) {
|
|
120
|
-
if (O[i] < 0.05) continue;
|
|
121
|
-
let isMax = true;
|
|
122
|
-
for (let j = -3; j <= 3; j++) if (O[i + j] > O[i]) { isMax = false; break; }
|
|
123
|
-
if (!isMax) continue;
|
|
124
|
-
let m = 0, k = 0;
|
|
125
|
-
for (let j = Math.max(0, i - halfWin); j < Math.min(nFrames, i + halfWin); j++) { m += O[j]; k++; }
|
|
126
|
-
if (O[i] < (m / k) * 1.5) continue;
|
|
127
|
-
if (i - last < minGap) continue;
|
|
128
|
-
beats.push(frameT(i));
|
|
129
|
-
last = i;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// BPM: autocorrelation of the onset envelope over 60–200 BPM lags,
|
|
133
|
-
// with a mild prior toward ~120; fold octaves into 70–180.
|
|
134
|
-
let bpm = null;
|
|
135
|
-
const lagMin = Math.round(60 / 200 * SR / HOP), lagMax = Math.round(60 / 60 * SR / HOP);
|
|
136
|
-
let best = 0, bestLag = 0;
|
|
137
|
-
for (let lag = lagMin; lag <= Math.min(lagMax, nFrames - 1); lag++) {
|
|
138
|
-
let s = 0;
|
|
139
|
-
for (let i = 0; i + lag < nFrames; i++) s += O[i] * O[i + lag];
|
|
140
|
-
const cand = 60 / (lag * HOP / SR);
|
|
141
|
-
const w = Math.exp(-0.5 * Math.pow(Math.log2(cand / 120) / 1.0, 2));
|
|
142
|
-
if (s * w > best) { best = s * w; bestLag = lag; }
|
|
143
|
-
}
|
|
144
|
-
if (bestLag) {
|
|
145
|
-
bpm = 60 / (bestLag * HOP / SR);
|
|
146
|
-
while (bpm < 70) bpm *= 2;
|
|
147
|
-
while (bpm > 180) bpm /= 2;
|
|
148
|
-
// refine: if the picked beats are regular, the median inter-beat interval
|
|
149
|
-
// is a much finer tempo estimate than the autocorrelation lag grid
|
|
150
|
-
if (beats.length >= 6) {
|
|
151
|
-
const gaps = beats.slice(1).map((t, i) => t - beats[i]).sort((a, b) => a - b);
|
|
152
|
-
const med = gaps[Math.floor(gaps.length / 2)];
|
|
153
|
-
const spread = gaps[Math.floor(gaps.length * 0.85)] - gaps[Math.floor(gaps.length * 0.15)];
|
|
154
|
-
if (med > 0 && spread < med * 0.15) {
|
|
155
|
-
// full span / count averages out the hop-grid quantization of each beat
|
|
156
|
-
let refined = 60 / ((beats[beats.length - 1] - beats[0]) / (beats.length - 1));
|
|
157
|
-
while (refined < 70) refined *= 2;
|
|
158
|
-
while (refined > 180) refined /= 2;
|
|
159
|
-
if (Math.abs(refined - bpm) / bpm < 0.15) bpm = refined;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
bpm = Math.round(bpm * 10) / 10;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// loudness curve, one value per 0.5 s, normalized 0–100
|
|
166
|
-
const step = 0.5;
|
|
167
|
-
const perStep = Math.round(step * SR / HOP);
|
|
168
|
-
const values = [];
|
|
169
|
-
for (let i = 0; i < nFrames; i += perStep) {
|
|
170
|
-
let s = 0, k = 0;
|
|
171
|
-
for (let j = i; j < Math.min(nFrames, i + perStep); j++) { s += Math.sqrt(E[j]); k++; }
|
|
172
|
-
values.push(k ? s / k : 0);
|
|
173
|
-
}
|
|
174
|
-
const vMax = Math.max(...values, 1e-9);
|
|
175
|
-
const energy = values.map((v) => Math.round(v / vMax * 100));
|
|
176
|
-
|
|
177
|
-
// the drop: biggest sustained energy rise (skip the very start)
|
|
178
|
-
let drop = null, bestRise = 0;
|
|
179
|
-
for (let i = 2; i < energy.length - 1; i++) {
|
|
180
|
-
const before = (energy[i - 2] + energy[i - 1]) / 2;
|
|
181
|
-
const after = (energy[i] + energy[Math.min(i + 1, energy.length - 1)]) / 2;
|
|
182
|
-
if (after - before > bestRise && after > 55) { bestRise = after - before; drop = Math.round(i * step * 10) / 10; }
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return { beats, bpm, energy: { step, values: energy }, drop };
|
|
92
|
+
return Beats.analyze(pcm, { scale: 1 / 32768 });
|
|
186
93
|
}
|
|
187
94
|
|
|
188
95
|
/* ── Extract the reference's music track into its own audio file ── */
|