Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The rest is written by hand.
| transcribe.py | /api/transcribe | 2 |
| tts.py | /api/tts | 3 |
| upscale.py | /api/media | 2 |
| vfx_link.py | /api/vfx-link | 3 |
| voice_app.py | /api/speech/app | 4 |
| webhooks.py | /api/webhooks | 5 |
| window_key.py | /api/window | 3 |
Expand Down Expand Up @@ -134,6 +135,7 @@ the automation transports.
- `package_registry.py`
- `paths.py`
- `peer_process.py`
- `pin_edit.py`
- `pixel_effects.py`
- `planar.py`
- `planar_bench.py`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ The module list and the engine commands are generated from `frontend/src` by
- `engine/media.ts`
- `engine/motion.ts`
- `engine/persistence.ts`
- `engine/pin-edit.ts`
- `engine/project.ts`
- `engine/rates.ts`
- `engine/seed.ts`
Expand Down Expand Up @@ -95,6 +96,7 @@ The module list and the engine commands are generated from `frontend/src` by
- `ui/menu-fit.ts`
- `ui/missing-media.ts`
- `ui/mode-popout.ts`
- `ui/pin-corners.ts`
- `ui/planar-workspace.ts`
- `ui/preset-grid.ts`
- `ui/preview-manipulation.ts`
Expand All @@ -120,6 +122,7 @@ The module list and the engine commands are generated from `frontend/src` by
- `ui/track-keyframes.ts`
- `ui/tracking.ts`
- `ui/upscale-dialog.ts`
- `ui/vfx-link.ts`
- `ui/viewer.ts`
- `ui/webhooks-settings.ts`
- `ui/work-area.ts`
Expand Down Expand Up @@ -151,6 +154,7 @@ and a UI module that mutates state directly is a defect.
- `clip.mask-track`
- `clip.move`
- `clip.mute`
- `clip.pinCorner`
- `clip.planar`
- `clip.planarMatte`
- `clip.planarModule`
Expand Down Expand Up @@ -184,6 +188,7 @@ and a UI module that mutates state directly is a defect.
- `history.redo`
- `history.undo`
- `media.relink`
- `media.replace`
- `project.background`
- `project.load`
- `project.rename`
Expand Down
33 changes: 32 additions & 1 deletion .docs/wiki/Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,15 @@ reference or settings change starts a fresh track. Frames are read at full size
forwards). Every estimate is checked as sound before use
(finite, the plane's box still convex and the same way round, a twentieth to twenty times its area); a step that
fails anywhere gives the prediction with no confidence, and twelve frames running near zero end the job there with
`lost` in its result, the frames before kept. The job reports `frame` and `confidence` as it goes. GET
`lost` in its result, the frames before kept. That is the default, When the track is lost: Stop; a layer's setting
`lost: "hold"` (Hold last position, 2.24.0) instead keeps the last confident position for those twelve frames and every
faint one after them until the plane is found again, marks them in the store's `held` (read back as `held`, the
frame numbers) and reports `held` in the result; the tracker's prediction is held there too, so the plane can be
found where it went out of sight. The choice is not part of what a track depends on, so changing it keeps the frames
tracked. Perspective, left unset, is on for a layer drawn as one four-cornered polygon (a screen, a sign, a pin
target) and off otherwise, so an API or MCP caller gets the same default as the workspace; a frame where a lower model
holds under 0.6 of its points is refitted in perspective from the same point pairs and kept when that holds at least
0.2 more of them (`planar.promote`), marked in `promoted`. The job reports `frame` and `confidence` as it goes. GET
/api/planar/media/<id> gives a media file's frame rate, size and count; GET /api/planar/frame/<id>?index=&width= one
frame as a JPEG.

Expand All @@ -207,6 +215,29 @@ a confidence strip under the scrubber. Shapes and the surface are kept in the re
a tracked layer's shapes or settings starts its track afresh, asked first. Done keeps the layers on the clip
(`clip.planar`, a project command with undo); the per-frame tracks stay the engine's.

Hand edits of an applied corner pin (2.24.0, `backend/app/pin_edit.py` and its twin `frontend/src/engine/pin-edit.ts`):
with Edit corners on in the inspector's Track section, the selected clip's pin shows its four corners on the preview
(`ui/pin-corners.ts`); one dragged is written into the pin's sample on that frame, or a new sample there when none is
within half a frame, so the frames either side keep their tracked corners. The pin keeps the value each moved corner
replaced (`cornerPin.edits`: t, corner, was); a double-click on a moved corner puts it back. A move that would fold
or cross the four corners is refused, since a pin draws only a convex quadrilateral. In the window it is the
`clip.pinCorner` command (one undo step); through `project.edit`, and so the MCP server's `formcut_edit`, it is
`clip.pin-corner` {clipId, t, corner, x, y} or {clipId, t, corner, reset: true}. A mesh pin is shaped in the Track
workspace instead.

A FormVFX live comp as a clip (2.24.0, `backend/app/vfx_link.py`, `ui/vfx-link.ts`): a `.fvxlink` (FormVFX's
`formvfx.link/1` descriptor) imported into the media bin is a video item whose file is the descriptor and whose record
carries `link`. The renderer asks FormVFX for each frame (GET /api/link/frame.png with `x-formvfx-local: 1`, on the
comp's own frame grid), so preview and export stay one renderer, and both export graphs leave such a clip to the
frame path. FormVFX is found on loopback only (FORMVFX_URL, else FormVFX's own engine.json, else 127.0.0.1:8250), with
no proxy from the environment and no redirect followed; the URL templates in a descriptor are never used. A link's
project must be an absolute path on this computer to a FormVFX project file that is there at import (no share, URL
scheme or `..`, its links followed and checked); later it is sent only as it then resolves, else FormVFX is given the
project id alone. With FormVFX
closed the clip is unreadable and says so, as a missing file does. Render and replace (POST /api/vfx-link/<id>/render,
a job) reads every frame and the sound and writes ProRes 4444 with PCM sound through formcut's own ffmpeg, a separate
program, ingests it, and the window points the project's clips at it (`media.replace`, one undo step).

AdjustTrack (P4): a layer's reference points remove its track's drift, as Mocha's do. Each point has a master frame
and its place there; the raw track carries it to every other frame. Where the person puts it back on its feature on a
frame, that frame keys its correction (the place less where the track carried it); the master frame's correction is
Expand Down
3 changes: 3 additions & 0 deletions .docs/wiki/Automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ WebSocket `/api/rpc/ws` sends the same JSON objects over a loopback connection.
### v0.56.0
`project.edit` adds `clips.split`, `clip.rejoin`, `clip.freeze-insert`, `clip.reattach`; magnetic tracks settle after each batch; `clip_properties` includes `reversed` and `audioStream` (which of the media's audio streams a clip plays); per-timeline formats apply to `project.export`.

### v2.24.0
`project.edit` adds `clip.pin-corner`: one corner of a clip's applied corner pin moved on one frame, `{"op": "clip.pin-corner", "clipId": "...", "t": 1.2, "corner": 2, "x": 0.71, "y": 0.83}` (t in the clip's own seconds, corner 0 to 3 from the top left clockwise, x and y as fractions of the canvas), or put back with `"reset": true` in place of x and y. It is one undo step like any edit, refuses a clip with no pin, a mesh pin, and a move that would fold or cross the four corners, and reaches agents through the MCP server's `formcut_edit`.


### v0.57.0
Title styles ride `clip.text` patches like any other style field, so the full property set is scriptable; `/api/presets/titles` lists the built-ins.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</p>

<p align="center">
<img alt="version v2.23.0" src="https://img.shields.io/badge/version-v2.23.0-eef0f4?style=flat-square">
<img alt="version v2.24.0" src="https://img.shields.io/badge/version-v2.24.0-eef0f4?style=flat-square">
<img alt="TypeScript and Vite" src="https://img.shields.io/badge/TypeScript-Vite-3178c6?style=flat-square&logo=typescript&logoColor=white">
<img alt="Python FastAPI" src="https://img.shields.io/badge/Python-FastAPI-3776ab?style=flat-square">
<img alt="macOS, Windows, Linux" src="https://img.shields.io/badge/macOS%20%C2%B7%20Windows%20%C2%B7%20Linux-native-2f7bf5?style=flat-square">
Expand Down
32 changes: 32 additions & 0 deletions backend/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@

Reasoning behind engine changes, newest first.

## 2.24.0 · perspective by default for four-cornered layers, a perspective refit when a lower model fails (`app/planar.py` `promote`, `PlanarTracker.hold`, `promoted`; `app/planar_api.py` `four_cornered`, `_settings`, `_tidy`)

- **Why.** A synthetic screen benchmark with exact corners (six clips, 1280 by 720, 120 frames) found the tracker's default, Perspective off, fits a similarity, which cannot follow a screen as it tilts: 10 to 60 px of mean corner error, and on the clip whose corners leave the frame the twelve-faint-frames rule ended the track at frame 43. With Perspective on, every clip tracked under 0.3 px mean.
- **Default.** `_settings(raw, layer)`: Perspective left unset (absent or null) is on for a layer drawn as one four-cornered polygon in add mode (`four_cornered`: no curve kind, no Bezier handles), off otherwise; what the person chose is kept. The route passes the layer, so an RPC or MCP caller gets the workspace's default. The track's signature is unchanged (the layer's own settings, as before), so an existing track is not started afresh by the new default; it carries on in perspective from where it stopped.
- **Refit.** In `_refine`, each pass's fit in the layer's model is checked: below perspective and holding under 0.6 of the points, the same LK pairs are fitted in perspective (`promote`), and that fit is used when it holds at least 0.2 more of them. The step marks the frame (`tracker.promoted`, either pass), the job keeps it in the store's `promoted` and the read returns it.
- **Seen.** The benchmark against this tree (FormCut's own runner from the bench, pointed at it), mean and max corner error in px, old default then the new default: pan, turn and tilt 27.46 / 109.2 to 0.031 / 0.27; 3.5x zoom 10.38 / 72.9 to 0.19 / 1.16; hand over the screen 26.95 / 103.9 to 0.039 / 0.41; glossy screen under changing light 26.17 / 120.4 to 0.30 / 2.27; corners leaving the frame 60.27 (lost at frame 43) to 0.084 / 0.84 with nothing lost; blur and noise 34.16 / 124.8 to 0.11 / 0.51. A similarity kept on purpose, with the refit, came to 0.50 to 1.81 px mean on five clips and 16.6 px on the glossy one. `tests/test_planar_perspective_default.py`: a 30-frame tilting plane tracks at 21.5 px mean on the old code and under 1 px now; a similarity run gives 0.34 px with the refit (23 frames promoted) and 22.3 px without.

## 2.24.0 · When the track is lost: Hold last position (`app/planar_api.py` the track job; `app/planar.py` `PlanarTracker.hold`)

- **Why.** A plane that leaves the shot for a moment (a hand across a screen, a turn away) ended the track: twelve frames under 0.05 confidence stop the job there. That stays the default, Stop. The layer's setting `lost: "hold"` keeps the track going.
- **Hold.** When the twelfth faint frame arrives, it and the eleven before it are rewritten with the last confident frame's homography and marked held; every faint frame after that is held too, until a step is confident again. The tracker's prediction is set to the held place (`hold`), so it looks for the plane where it went out of sight rather than carrying its last motion on. Held frames are kept in the store's `held`, cleared when a frame is tracked afresh, filled from either side (green screens), or cleared by DELETE; the read returns them and the job's result says how many.
- **Signature.** `lost` is left out of what a track depends on, so switching between Stop and Hold keeps the frames already tracked. A layer with no `lost` has exactly the signature it had before. `_tidy` writes `held` and `promoted` only when they hold something, so a Stop track's file has the same keys as before.
- **Seen.** `tests/test_planar_hold.py` on 12 frames of a plane then 24 of noise: Stop still ends with `lost` between frames 11 and 14 and no held frames; Hold runs to frame 35 with a single held run to the end at the last good matrix, at least 22 frames held.

## 2.24.0 · hand edits of an applied corner pin (`app/pin_edit.py` new; `app/automation.py` `clip.pin-corner`)

- **Why.** An applied pin is a track of timed samples; a corner the track put a few pixels off could only be fixed by AdjustTrack and applying again. Now one corner can be moved on one frame and kept in the pin.
- **The edit.** `edit_corner(pin, t, corner, x, y, fps)` writes the corner into the sample within half a frame of t, or a new sample at t (the others interpolated as `renderer.pin_at` draws them), so the frames either side keep their tracked corners. A fixed pin moves its point. `edits` keeps, per frame and corner, the value it replaced, once; `reset_corner` puts that back and drops the record. A move that would fold or cross the quadrilateral is refused (a pin draws only a convex one: a folded quad sent the warp through infinity and flooded the canvas when tried), so is a mesh pin, a corner outside 0 to 3 and a point more than four canvas widths off. Pure functions; `frontend/src/engine/pin-edit.ts` is the window's twin and the test runs both.
- **Surface.** `project.edit` op `clip.pin-corner` {clipId, t, corner, x, y} or {..., reset: true}, listed in `capabilities`, so agents reach it through `formcut_edit`; one undo step.
- **Seen.** `tests/test_pin_edit.py`: 14 tests, among them the edit through `project.edit`, reset and undo, the renderer drawing the moved corner on its frame and the tracked one on the next, and the engine and the window giving the same pin for five edits in Node 25.8.

## 2.24.0 · a FormVFX live comp as a clip (`app/vfx_link.py` new; `features.py`; `renderer.py` `_linked_frame`; `audio_render.py` `_live_sound`; `fast_export.py`, `fast_layers.py`; `media.py` `refuse_live`; `clip_visuals.py`)

- **Why.** FormVFX serves a composition as a live clip (Export Live Link Clip writes a `.fvxlink`; GET /api/link/info, /frame.png and /audio answer it) and FormCut had no consumer. Read from nodemode-dev/formVFX `backend/app/engine/link.py` and `routers/link.py`: format `formvfx.link/1`; the link routes need only `x-formvfx-local: 1` on loopback (their POST render needs FormVFX's own window key, so Render and replace is done here).
- **Import.** POST /api/vfx-link/import {link} or {path}: the descriptor is parsed keeping only the project, its id, the comp's id and name, size, rate and length (each bounded: sides 16 to 8192, 1 to 240 fps, up to 24 hours, so a downloaded file cannot size a render that fills the disk); its URL templates are dropped. The item is kind video, its file `<id>.fvxlink` holding the parsed descriptor, its record `link`, `source: "formvfx-link"`, and the comp's facts from FormVFX when it answers (else the descriptor's), with a thumbnail from FormVFX. A path must be a regular `.fvxlink` file, read to 64 KB at most.
- **What a link may name.** A descriptor is often a downloaded file, and FormVFX opens the project a link names. Its `project` must be an absolute path on this computer to a FormVFX project file (`.fvxproj`, `.ecproj`, `.ecprojx`): a UNC or `//` share, any URL scheme (`smb:`, `file:`), a relative path, a `..` segment, control characters or another kind of file is refused at import with a sentence saying which. At import the file must be there, its links followed and the target checked the same way. On every request the project is sent only as it resolves then; when it has gone (moved or renamed) only the project id is sent, and FormVFX matches that against its open and recent projects, as its own relinking does. The project id and a comp id are FormVFX's tokens (letters, digits, `_ . : -`, up to 128), a comp name has no control characters.
- **Where FormVFX is.** FORMVFX_URL, else FormVFX's engine.json (FORMVFX_DATA_DIR or ~/Formvfx), else 127.0.0.1:8250; anything but plain http on 127.0.0.1, localhost or ::1 with a port is passed over. httpx with `trust_env=False`, no redirects followed (a 3xx is refused), replies read to a cap (a frame to its raw RGBA size, sound to 64 MB), a frame larger than the size asked for refused, PIL's decompression-bomb error caught.
- **Frames and sound.** The renderer asks for the frame on the comp's own grid at the exact rate, held at the last frame past the comp's end, the last four kept per renderer; FormVFX closed makes the clip unreadable with what to do, as a missing file does. The mix takes the clip's sound from FormVFX from its source in (silence while FormVFX is closed). Both export graphs, the filmstrip, peaks, the source monitor frame, scenes, stabilising, proxies, reversing, freeze and detach refuse a live comp by name (409) rather than hand its JSON to ffmpeg.
- **Render and replace.** POST /api/vfx-link/<id>/render, a job: every frame and the sound (asked in 30 s chunks, padded with silence to the exact length) written by formcut's own ffmpeg, a separate program, as ProRes 4444 with its alpha and PCM sound; the job's `media` is the ingested movie, `renderedFrom` naming the live item. A failure removes the partial file and adds nothing.
- **Seen.** `tests/test_vfx_link.py`, 36 tests against a stand-in answering FormVFX's routes: the descriptor kept and refused; eight project paths refused (two shares, smb and file URLs, relative, `..`, not a project file, a newline) and three comps; a missing project file and one that is a link to a text file refused, and a project moved after import asked for by its id alone; six refused addresses and engine.json; import with FormVFX's facts and a thumbnail, the header on every request; frames 0, 3 and 7 read back by their colour; FormVFX closed; a redirect and an HTML reply refused; both export graphs refusing; Render and replace giving a 64 by 36 ProRes of 12 frames with stereo sound, each frame's colour exact, and with FormVFX closed failing with nothing added. Not run: a real FormVFX.
- **Not done.** No MCP tool for the import (an agent can call the routes); the filmstrip and waveform of a live clip are not drawn until it is rendered; a retimed or reversed live clip plays its picture through the renderer but its sound at speed 1.

## 2.23.0 · ComfyUI through the FormBridge pack (`app/formbridge.py` new; `main.py` import and include)

- **Why.** The Comfy-FormBridge-Suite README named formcut as one of its apps, and formcut had no client. The pack runs in the person's own ComfyUI and answers contract 1 under `/formbridge/v1`; this module is written from that contract.
Expand Down
Loading
Loading