diff --git a/README.md b/README.md index 55ea602..176e2ca 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,23 @@ music, rendered to MP4 for TikTok, Reels, Shorts, LinkedIn and YouTube.** ## What it does You drop in screen recordings or screenshots of your app. Motion Studio puts them in a device (phone, two phones, -tablet, browser window or full screen) and animates everything around them: +tablet, browser window, full screen, or no device at all with the text centered) and animates everything around them: - **Starters** for the usual promo videos (app launch, how-to in 3 steps, before/after, website tour, quick tip), filled with your own clips so you start from a finished video instead of an empty timeline - **Headlines** that rise in word by word, with an accent color (`*like this*`) - **Callouts** with icons, counters and a live dot, dragged into place on the preview +- **Transitions** between clips (crossfade, slide, whip, zoom, blur, flash, spin) and **keyframes** to move, scale, + rotate and fade a clip over time +- **Talking-head edits**: keep a clip's sound, **cut the silences** out of it in one click, and **cut words** + out of the video by clicking them in the captions +- **Demo recording**: operate your web app or Android phone inside Motion Studio and record it, with every tap, swipe + and long press logged (also the ones you make on the phone itself) and turned into animated touches, and demo data (a made-up persona) typed into the forms +- **Background scenery**: rings, blurred colors, aurora, grid, color gradient, spotlight or plain, and the background can change during the video with a crossfade +- **Headline effects**: every headline can come in (up, from above, fade, pop, from the left, sharpen) and go out (up, down, fade, blur, shrink, to the right) in its own way, or the same for all texts at once - **Zooms** onto a point you click, and **taps / clicks** that show where to look -- **Captions** in four styles (pop, karaoke, block, classic), made from the voice-over or imported from `.srt`/`.vtt` +- **Captions** in four styles (pop, karaoke, block, classic), made from the voice-over, from any audio track with + **speech recognition** (Whisper, on your own computer, every word at its exact moment) or imported from `.srt`/`.vtt` - **Voice-over** from text (Kokoro / Piper TTS), plus a **music bed** that fades, ducks under the voice and carves an EQ pocket for it, so speech stays clear while the music stays full - **Beat detection**: snap cuts and callouts to the music @@ -109,10 +118,10 @@ Everything below is open for grabs. Comment on (or open) an issue so others know **Bigger features** - šŸŽ **macOS and Linux builds**: the code is cross-platform, but packaging and testing aren't there yet -- šŸŽ™ļø **Exact word timing** for captions with Whisper (`hyperframes transcribe`) instead of estimates +- šŸŽ™ļø **Whisper on macOS and Linux**: Windows installs whisper.cpp by itself, elsewhere it has to be installed by hand - 🧪 **More tests**: the modules (`npm test`) and the timeline basics (`npm run test:ui`) are covered; rendering and most of the inspector aren't yet -- šŸŽžļø **Transitions between clips**: crossfades, slides and whip pans on the device screen +- šŸŽžļø **Keyframes on more than clips**: callouts, headlines and the device - šŸ–¼ļø **Templates**: save a video as a reusable starting point for the next one Found a bug? [Open an issue](https://github.com/tinygusie2/motion-studio/issues/new/choose). Have an idea? diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 35c83f8..6387989 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -37,6 +37,10 @@ http://localhost:3400. That's the quickest way to develop the UI. - `src/template.mjs`: the composition (HTML, CSS and the GSAP timeline), the layouts, the formats and clip placement. - `src/audio.mjs`: the music bed mix (fades, ducking under the voice) as a HyperFrames volume lane. It is shared with the UI at `/lib/audio.mjs`. +- `src/keyframes.mjs`: clip keyframes (easings, interpolation, the GSAP plan). It is shared with the UI at `/lib/keyframes.mjs`. +- `src/edit.mjs`, `src/silence.mjs`: cutting time out of a video, and finding silences. Shared with the UI at `/lib/edit.mjs` and `/lib/silence.mjs`. +- `src/demo-session.mjs`, `src/demo-web.mjs`, `src/demo-android.mjs`, `src/cdp.mjs`, `src/gestures.mjs`, `src/demo.mjs`: recording a demo of an app (see below); `ui/demo.js` is its window. `gestures` and `demo` are shared with the UI. +- `src/whisper.mjs`: finding, installing and running whisper.cpp for speech recognition. - `src/captions.mjs`: captions (word timing, grouping, splitting, SRT/VTT). It is shared with the UI at `/lib/captions.mjs`. - `ui/editor.js`: the editor (timeline, inspector, library, dialogs, keyboard). @@ -61,13 +65,16 @@ or when the rows change shape. ## Projects (workspaces) -Every project is a folder. Motion Studio can switch between them (Bestand → Projecten, Ctrl+O). +Every project is a folder. Motion Studio can switch between them (Bestand → Projecten, Ctrl+O). In that dialog a +project can be taken off the list (`POST /api/workspace/remove`, the folder stays) or, in the app, moved to the +recycle bin (`trash: true`, through the `trash` function `main.mjs` passes to `startServer`; only folders with a +`studio.json`, and the server refuses when it has no such function). The open project gives way to the next one on the list. | Path | What | | --- | --- | | `studio.json` | `{ name, defaultBrand }` | | `brands/.json` | name, url, lang, `logo` (file in `assets/brand/`), `font` (file in `assets/fonts/`), `theme` colors, `chipColors`, `pills`, `endNameSize`, `renderPrefix`, `css`, `captions` (default caption style) | -| `specs/.json` | one video: `brand`, `layout`, `dur`, `end`, `heads`, `clips` (each with `tr`/`trDur` for its transition), `clips2`, `chips`, `zooms`, `taps`, `markers`, `vo`, `audio`, `audioVol`, `music`, `subs`, `captions`, `formats`, `tagline` | +| `specs/.json` | one video: `brand`, `layout`, `dur`, `end`, `heads`, `clips` (each with `tr`/`trDur` for its transition, `kf` for its keyframes and `sound`/`vol` for its own sound), `clips2`, `chips`, `zooms`, `taps`, `markers`, `vo`, `audio`, `audioVol`, `music`, `subs`, `captions`, `formats`, `tagline` | | `assets/clips/` | screen recordings (converted to H.264 on upload) and screenshots (png/jpg); deleted files go to `.trash/` | | `assets/vo/` | audio (voice and music); generated voice-overs land here; deleted files go to `.trash/` | | `renders/` | finished MP4s (`-[-4x5\|-1x1\|-16x9].mp4`), plus a `.srt` when the video has captions | @@ -100,6 +107,12 @@ A new app with a different UI usually needs a different frame around the recordi The editor picks up new layouts automatically. Add an icon for yours in `LAYOUT_ICONS` in `ui/editor.js`. +The `text` layout has no visible device: the device element stays in the page (so clips and their sound keep working) but is `display: none`, and `#root.is-text` centers the headlines, sized to the format (`TS` in `build`). It covers the frame like `full` in `stageFit`, is left out of the Demo Studio's device list, and works in every format. + +Headline effects live in `src/headfx.mjs`: a table of GSAP vars per way of coming in (`h.fxIn`) and going out (`h.fxOut`), applied to the words of a headline. `headPlan` gives the page only the effects in use, and headlines whose effect would be cut by the words' clipping mask (scale, blur, fades) get the class `open`. An unknown name falls back to the default (rise / lift). + +Background scenery lives in `src/backgrounds.mjs`: `v.bg` is the style the video starts with, `v.bgs = [{ t, style }]` changes it (a crossfade of `bgFade` seconds, times move with cuts). Every style in use is a `.bgl` layer behind everything (the ring scene is the original glow and rings, wrapped in `#bgl-orbit`), with slow GSAP drifts; the page only contains the layers a video uses. + ## Captions `subs` holds caption blocks `{ t, out, text }` (`*stars*` = accent color). Blocks come from three places: the @@ -107,6 +120,25 @@ voice-over lines (automatically after the first voice-over, or via "Uit voice-ov or blocks added by hand. Word times inside a block are estimated from word length, so moving a block's in or out point re-times its words. +A block made by speech recognition also has `wo`: each word's start in seconds after the block's start. Those exact +times are used while the text still has as many words (fixing a typo keeps them, rewriting the sentence falls back +to the estimate), they move with the block, and splitting a block splits them too (`timeWords`, `splitSub`). + +### Speech recognition + +*Captions → Uit audio* (or the Edit menu) runs [whisper.cpp](https://github.com/ggml-org/whisper.cpp) on the +video's voice/audio track (`POST /api/transcribe/`, a job like render and voice-over). `src/whisper.mjs` finds +`whisper-cli` and a model (Settings `whisperCli` / `whisperModelFile` / `whisperModel`, then +`~/.motion-studio/whisper/`, then PATH). When they are missing the editor asks first and then runs +`POST /api/whisper/install`: a pinned whisper.cpp release (Windows x64 only; elsewhere install it yourself) and a +ggml model from Hugging Face, checked against the sha256 Hugging Face publishes. Nothing is downloaded before the +user agrees, and the audio never leaves the computer. + +The server converts the audio to 16 kHz mono with ffmpeg, runs `whisper-cli … -ml 1 -sow -oj` (one word per entry) +with automatic language detection, and caches the JSON per file version, model and language in `vo/whisper/`. +`wordsFromWhisper()` and `subsFromWords()` in `src/captions.mjs` turn that into caption blocks (new block after a +pause, after a sentence end, or when it gets long). The job returns the blocks; the editor puts them in the spec +with `commit`, so undo works. The style comes from `captionDefaults` < `brand.captions` < `video.captions`. It covers: - `style` (`pop`, `karaoke`, `box`, `plain`) @@ -157,13 +189,100 @@ enlarged. The ideal source size is twice the screen size. ## Clip transitions -By default one clip cuts hard to the next. A clip's `tr` (`fade`, `slide`, `whip` or `zoom`, see `transitions` in +By default one clip cuts hard to the next. A clip's `tr` (`fade`, `slide`, `slideup`, `whip`, `zoom`, `blur`, `flash` or `spin`, see `transitions` in `src/template.mjs`) and optional `trDur` (seconds) set how it comes in. The cut stays at the incoming clip's `start`: the clip that was showing there (or ended at most 0.1 s before) is held on screen `trDur` seconds longer, by extending its `data-duration`, and both animate on the GSAP timeline while they overlap. Clips then stack by their start, so the incoming one is on top. Without a clip before it, the clip only animates in over the screen background. `clipTransitions()` plans this per device. +## Clip sound and cutting + +Uploaded videos keep their sound (AAC). A clip plays it when it has `sound: true` (`vol`, 0..1, is its level): the +`