Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(cli): register STT for headless captions; update CLI docs for 1.8

PeterTakahashi8c78b1f719cd
diff --git a/docs/cli.md b/docs/cli.md
index b9a95b51c..0d0f8a598 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -10,7 +10,16 @@ record → edit the project JSON programmatically → export → MP4/GIF
## Running
-Development (after `npm run build-vite` and, for recording, the native helper build):
+Development — build once per checkout:
+
+```bash
+npm run build-vite # renderer + main
+npm run build:native:mac # capture helpers (recording)
+npm run fetch:ffmpeg:mac && npm run build:native:compositor:mac # Rust compositor (export)
+bash scripts/build-whisper-stt.sh # STT server (captions; model downloads on first run)
+```
+
+Then:
```bash
npm run cli -- <command> [options]
@@ -127,8 +136,10 @@ openscreen export demo.openscreen --json | while read line; do ...; done
| `--audio-offset <seconds>` | Delay before the voiceover starts (default 0) |
| `--json` | NDJSON progress + result on stdout |
-`--audio` re-muxes after the render: video packets are copied untouched, and the
-audio is mixed offline (OfflineAudioContext) and re-encoded to AAC. MP4 only.
+`--audio` mixes after the native render: the exported file is read back, video
+packets are copied untouched, and the audio is mixed offline
+(OfflineAudioContext) and re-encoded to AAC before overwriting the output.
+MP4 only.
In `mix` mode the original audio is ducked to 40% under the voiceover so the
sum cannot clip; use `replace` to drop the original entirely.
@@ -137,12 +148,12 @@ when it lives in the app's recordings directory or **next to the project file**.
Keep `.openscreen` files beside their media (or record via the CLI, which uses
the recordings directory).
-**`--preview-size`**: annotation font sizes and border radii are stored in
-preview-pixel space and scaled by `export size / preview size` — in the GUI the
-"preview" is the editor window, so results depend on window size. The CLI uses a
-deterministic reference box instead (the composition fitted into 1280×720).
-Authoring tip for scripts: treat annotation `fontSize` as "pixels in a
-1280-wide preview".
+**`--preview-size`** is accepted for compatibility but is a no-op on the
+native pipeline: annotation geometry is percentage-based in the scene
+description, so exports no longer depend on any preview box.
+
+**No cancel**: the native compositor has no abort mechanism — killing the CLI
+mid-export stops output but the render worker runs until process exit.
### `openscreen pack`
@@ -171,8 +182,9 @@ openscreen export demo.openscreen -o demo.mp4 # subtitles are burned in
```
Requires an audio track in the project's video (e.g. `record --mic`, or a
-voiceover mixed in with a re-recorded source). Accuracy reflects the bundled
-whisper-tiny model: strong for English, rough for other languages.
+voiceover mixed in with a re-recorded source). Transcription runs on the
+native whisper.cpp engine (ggml-small); the model downloads automatically on
+first use.
### `openscreen info`
diff --git a/electron/cli/cliMain.ts b/electron/cli/cliMain.ts
index dbf8035ab..941013108 100644
--- a/electron/cli/cliMain.ts
+++ b/electron/cli/cliMain.ts
@@ -14,6 +14,7 @@ import type {
CliSourcesResult,
} from "../../src/lib/cliContracts";
import { getSelectedDesktopSource, registerIpcHandlers } from "../ipc/handlers";
+import { registerSttIpc } from "../stt";
import { ASSET_BASE_URL_ARG } from "../windows";
import { CLI_USAGE, type CliCommand } from "./args";
@@ -506,6 +507,10 @@ export function runCli(command: CliCommand): void {
let cliWindow: BrowserWindow | null = null;
registerAppHandlersForCli(() => cliWindow);
+ // Speech-to-text backs the captions command; registered by the GUI boot
+ // path (main.ts) rather than registerIpcHandlers.
+ registerSttIpc(ipcMain);
+
// Registered by the GUI boot path (main.ts) rather than registerIpcHandlers;
// the renderer's i18n init invokes it unconditionally.
ipcMain.handle("set-locale", () => {
diff --git a/src/cli/CliCaptionsRunner.tsx b/src/cli/CliCaptionsRunner.tsx
index 7bcf21391..beee6a46d 100644
--- a/src/cli/CliCaptionsRunner.tsx
+++ b/src/cli/CliCaptionsRunner.tsx
@@ -10,15 +10,15 @@ import {
validateProjectData,
} from "@/components/video-editor/projectPersistence";
import type { AnnotationRegion, TrimRegion } from "@/components/video-editor/types";
-import { captionSegmentsToAnnotationRegions } from "./vendor/captionRegions";
import { extractMono16kFromVideoUrl } from "@/lib/captioning/extractMono16k";
+import { transcribeMono16kToSegments } from "@/lib/captioning/transcribe";
+import type { CliCaptionsRequest, CliDoneResult } from "@/lib/cliContracts";
+import { nativeBridgeClient } from "@/native";
+import { captionSegmentsToAnnotationRegions } from "./vendor/captionRegions";
import {
shiftTrimRegionsMsForCaptionBuffer,
trimLeadingSilenceMono16k,
} from "./vendor/leadingSilence";
-import { transcribeMono16kToSegments } from "@/lib/captioning/transcribe";
-import type { CliCaptionsRequest, CliDoneResult } from "@/lib/cliContracts";
-import { nativeBridgeClient } from "@/native";
/** Highest trailing number across existing region ids, so new ids never collide. */
function nextNumericIdFrom(regions: { id: string }[]): number {