offmute-v2 0.0.1-opus.0 β 0.0.1
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/README.md +135 -88
- package/dist/browser.browser.js +1149 -0
- package/dist/browser.browser.js.map +1 -0
- package/dist/browser.d.ts +437 -657
- package/dist/cli.cjs +2018 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.js +1823 -1361
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +2035 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +371 -0
- package/dist/index.d.ts +311 -453
- package/dist/index.js +1839 -1383
- package/dist/index.js.map +1 -1
- package/package.json +48 -36
- package/dist/browser.js +0 -1494
- package/dist/browser.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,120 +1,167 @@
|
|
|
1
|
-
# offmute-v2
|
|
1
|
+
# offmute-v2
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Best-in-class diarized meeting transcription. A video/audio file (plus optional
|
|
4
|
+
instructions) goes in; a **timestamp-correct, diarized transcript with tone/behavior
|
|
5
|
+
labels** comes out β as SRT, Markdown, and JSON.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Runs as an **npx CLI**, a **Node library**, and **in the browser**.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export ASSEMBLYAI_API_KEY=... # word-level timing
|
|
10
|
-
npx offmute-v2 meeting.mp4 -i "Two founders chatting; label them by name."
|
|
11
|
-
# β meeting.srt meeting.md meeting.json
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Why it's accurate
|
|
9
|
+
> Living context: `intermediates/process_log_thoughts_ideas_hypotheses_and_scratch_space.md`
|
|
10
|
+
> (hypotheses, findings, gotchas) and `docs/spec.md` (design). Re-read when context compresses.
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
## Results (verified on test-files/1: 32min talk + audience Q&A)
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|-----|------|-----|
|
|
20
|
-
| **WHEN** β word-level timestamps | ASR (AssemblyAI) | sub-second accurate; LLM timestamps drift minutes over a long file |
|
|
21
|
-
| **WHO / HOW** β names, tone, hard audio | multimodal LLM (Gemini) | infers names from context, hears tone, handles crowds/interruptions; raw ASR diarization can't |
|
|
22
|
-
| **fuse** | token alignment | maps the LLM's words onto the ASR's timestamps |
|
|
14
|
+
End-to-end pipeline vs the hand-checked reference SRT (38 entries):
|
|
23
15
|
|
|
24
|
-
|
|
16
|
+
| metric | result |
|
|
17
|
+
|---|---|
|
|
18
|
+
| word accuracy (WER) | **86.5%** (WER 0.135) |
|
|
19
|
+
| reference coverage | **38/38** entries covered |
|
|
20
|
+
| boundary timing | **median 0.00s, p90 2.16s** |
|
|
21
|
+
| speaker accuracy | **94%** |
|
|
22
|
+
| alignment | 326/326 segments aligned to ASR word timing |
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
Speaker diarization correctly separates the presenter (named **Rishi** via the
|
|
25
|
+
identification pass) from 3 audience questioners, merging an AssemblyAI over-split of
|
|
26
|
+
the presenter into two speakers.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
## How it works
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
- **Speaker attribution: 98.8%** (word-level)
|
|
32
|
-
- **Turn-boundary timing: 0.04s median, 0.43s p90** error
|
|
30
|
+
A **hybrid** of two complementary strengths (the `inspirations/` projects each had one):
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
- **Multimodal LLM** (Gemini) β best *content*: verbatim text, tone, diarization through
|
|
33
|
+
interruptions, speaker identification via context. Coarse timestamps only.
|
|
34
|
+
- **Timestamped transcriber** (AssemblyAI Universal-2) β best *timing*: word-accurate
|
|
35
|
+
timestamps + clean speaker separation over the whole file. No tone/context.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
```
|
|
38
|
+
preprocess β describe β llm-transcribe (per chunk) β timestamped (whole file)
|
|
39
|
+
β
|
|
40
|
+
align (edit-distance: LLM text β ASR word times)
|
|
41
|
+
β
|
|
42
|
+
gap-fill (recover dropped content from ASR)
|
|
43
|
+
β
|
|
44
|
+
consistency (merge ASR over-splits via LLM labels)
|
|
45
|
+
β
|
|
46
|
+
identify (optional, DeepSeek: name speakers from content)
|
|
47
|
+
β
|
|
48
|
+
finalize (dedup, overlap fix, clamp, format SRT/MD/JSON)
|
|
40
49
|
```
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| `--asr <provider>` | `assemblyai` | `assemblyai` or `none` (LLM-only timing, less precise) |
|
|
47
|
-
| `--no-video` | β | ignore the video track (audio only) |
|
|
48
|
-
| `--keyframes <n>` | `8` | video frames sampled for visual context |
|
|
49
|
-
| `--no-sub-segment` | β | keep whole speaker turns instead of subtitle-sized cues |
|
|
50
|
-
| `--no-identify` | β | skip the speaker name-resolution pass |
|
|
51
|
-
| `--thinking-level <lvl>` | `MINIMAL` | `MINIMAL\|LOW\|MEDIUM\|HIGH` (MINIMAL is best for transcription) |
|
|
52
|
-
| `-o, --out <dir>` | `.` | where to write outputs |
|
|
53
|
-
| `-f, --format <fmt>` | `all` | `srt \| md \| json \| all` |
|
|
54
|
-
| `--intermediates-dir <dir>` | `.offmute_<name>` | cache dir (resumable) |
|
|
55
|
-
| `--no-cache` | β | ignore cached intermediates |
|
|
56
|
-
|
|
57
|
-
Intermediates (extracted audio, ASR JSON, raw LLM output, keyframes) are saved and reused, so re-runs are cheap and interrupted runs resume.
|
|
58
|
-
|
|
59
|
-
## Library
|
|
51
|
+
**The alignment** is the key idea (ts-aligner approach): align the whole chunk's LLM
|
|
52
|
+
token stream against the ASR word stream in one edit-distance DP pass, then split back
|
|
53
|
+
into segments β long ordered sequences pin common words unambiguously and transfer
|
|
54
|
+
accurate word timestamps onto the richer LLM text.
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
**Gap-fill** recovers content the LLM dropped: where ASR has speech in a time gap not
|
|
57
|
+
covered by any LLM segment (e.g. a dropped opening word), an ASR fallback segment is
|
|
58
|
+
inserted β so nothing the ASR heard is lost.
|
|
63
59
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
onProgress: (e) => console.log(e.stage, e.message),
|
|
68
|
-
});
|
|
60
|
+
**Timestamped providers**: AssemblyAI Universal-2 (default β diarization + word
|
|
61
|
+
timestamps) or Groq Whisper (`--timestamped whisper-groq` β free/fast word timestamps,
|
|
62
|
+
no diarization; consistency then groups by LLM label).
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
console.log(transcript.segments[0]); // { start, end, speakerId, text, tone, ... }
|
|
72
|
-
```
|
|
64
|
+
## Diarization levels (selectable via `--level`)
|
|
73
65
|
|
|
74
|
-
|
|
66
|
+
1. **Separation** β who speaks when (ASR speakers).
|
|
67
|
+
2. **Anonymous-but-consistent** β Speaker A/B throughout (ASR speakers merged by LLM label; default).
|
|
68
|
+
3. **Identification** β named speakers via content cues (DeepSeek).
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
### npx CLI
|
|
73
|
+
```bash
|
|
74
|
+
export GEMINI_API_KEY=... # multimodal transcription
|
|
75
|
+
export ASSEMBLYAI_API_KEY=... # timestamped transcription
|
|
76
|
+
export DEEPSEEK_API_KEY=... # optional, for --level 3 identification
|
|
77
|
+
|
|
78
|
+
npx offmute-v2 meeting.mov # default: flash model, level 2
|
|
79
|
+
npx offmute-v2 meeting.mov --model gemini-2.5-pro # higher quality
|
|
80
|
+
npx offmute-v2 meeting.mov --level 3 # name speakers
|
|
81
|
+
npx offmute-v2 meeting.mov -i "focus on action items, note accents"
|
|
82
|
+
npx offmute-v2 meeting.mov --passes align,consistency,finalize # resume from intermediates
|
|
83
|
+
npx offmute-v2 meeting.mov --only-chunk 2 # debug one chunk
|
|
84
|
+
```
|
|
77
85
|
|
|
78
|
-
|
|
86
|
+
Key options: `--passes`, `--level <1|2|3>`, `--model`, `--timestamped assemblyai|whisper-groq`,
|
|
87
|
+
`--formats srt,md,json`, `--chunk-seconds`, `--overlap-seconds`, `--concurrency`,
|
|
88
|
+
`--instructions`, `--force`, `--only-chunk`, `--reasoner`.
|
|
79
89
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
90
|
+
### Node library
|
|
91
|
+
```ts
|
|
92
|
+
import { transcribe } from "offmute-v2";
|
|
93
|
+
const result = await transcribe("meeting.mov", {
|
|
94
|
+
model: "gemini-2.5-flash",
|
|
95
|
+
level: 3,
|
|
96
|
+
instructions: "...",
|
|
97
|
+
apiKeys: { gemini: "...", assemblyai: "...", deepseek: "..." }, // injectable
|
|
98
|
+
formats: ["srt", "md", "json"],
|
|
99
|
+
});
|
|
100
|
+
// result.segments: Segment[], result.speakers: SpeakerInfo[]
|
|
101
|
+
```
|
|
84
102
|
|
|
103
|
+
### Browser
|
|
85
104
|
```ts
|
|
86
|
-
import {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const { srt, markdown, transcript } = await transcribeInBrowser(file /* File/Blob */, {
|
|
93
|
-
ffmpeg,
|
|
94
|
-
apiKeys: { gemini: GEMINI_KEY, assemblyai: ASSEMBLYAI_KEY }, // injected by the host
|
|
95
|
-
instructions: "Host is Alice; label callers as 'Caller'.",
|
|
96
|
-
useVideo: true,
|
|
97
|
-
onProgress: (e) => console.log(e.stage, e.message),
|
|
105
|
+
import { transcribeBrowser } from "offmute-v2/browser";
|
|
106
|
+
// audio = mono Blob (extract from video via ffmpeg.wasm first)
|
|
107
|
+
const result = await transcribeBrowser({
|
|
108
|
+
audio, geminiApiKey, assemblyaiApiKey,
|
|
109
|
+
model: "gemini-2.5-flash", level: 3, deepseekApiKey,
|
|
98
110
|
});
|
|
99
111
|
```
|
|
112
|
+
The core (align/consistency/identify/finalize/format) is pure TS with no node deps and
|
|
113
|
+
bundles to ~35KB with zero node-only imports. The browser build uses fetch-based
|
|
114
|
+
providers (Gemini inline base64 + AssemblyAI REST). Best for audio β€ ~20MB inline; for
|
|
115
|
+
longer files, chunk with ffmpeg.wasm and call the stages directly.
|
|
100
116
|
|
|
101
|
-
|
|
102
|
-
ffmpeg.wasm from a CDN). Lower-level pieces (`GeminiFetchClient`, `transcribeWithAssemblyAIFetch`,
|
|
103
|
-
`extractAudioWasm`, and the pure `assembleTranscript`) are exported too β see
|
|
104
|
-
[`docs/BROWSER.md`](docs/BROWSER.md). The fetch providers are isomorphic, so they work in
|
|
105
|
-
Node 18+ as well.
|
|
117
|
+
## Architecture
|
|
106
118
|
|
|
107
|
-
|
|
119
|
+
```
|
|
120
|
+
src/
|
|
121
|
+
core/ types, config (models, key resolution, chunk planning), pipeline
|
|
122
|
+
audio/ ffmpeg wrapper (probe, audio, chunk, scene-aware keyframes, silence)
|
|
123
|
+
providers/ gemini (SDK), gemini-fetch + assemblyai-fetch (browser), openai-compat (DeepSeek/Groq)
|
|
124
|
+
transcribe/ llm transcription (prompt + JSON schema), describe (roster)
|
|
125
|
+
align/ normalize, edit-distance DP, aligner (flat-sequence alignment)
|
|
126
|
+
diarize/ consistency (merge by LLM label), identify (DeepSeek naming)
|
|
127
|
+
finalize/ dedup, overlap fix + clamp, format (SRT/MD/JSON with block-breaking)
|
|
128
|
+
eval/ scorer (WER, coverage, timing, speaker agreement vs reference)
|
|
129
|
+
utils/ time, srt, logger
|
|
130
|
+
scripts/ per-stage test scripts + eval
|
|
131
|
+
tests/ vitest unit tests (align, finalize)
|
|
132
|
+
```
|
|
108
133
|
|
|
109
|
-
|
|
110
|
-
|
|
134
|
+
Every pipeline stage persists intermediates to disk and is **resumable** (skips work
|
|
135
|
+
whose output exists unless `--force`); the run is **stoppable** β results so far are
|
|
136
|
+
always on disk.
|
|
111
137
|
|
|
112
|
-
##
|
|
138
|
+
## Development
|
|
139
|
+
```bash
|
|
140
|
+
npm install
|
|
141
|
+
npm run typecheck && npm run lint && npm test # 16 unit tests
|
|
142
|
+
npm run dev # tsx src/cli.ts
|
|
143
|
+
npm run build # tsup β dist/ (node + browser bundles)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Requirements
|
|
147
|
+
- Node β₯ 20, ffmpeg/ffprobe in PATH.
|
|
148
|
+
- API keys: `GEMINI_API_KEY` (or `GOOGLE_API_KEY`), `ASSEMBLYAI_API_KEY`. `DEEPSEEK_API_KEY` optional (level 3). `GROQ_API_KEY` optional (whisper-groq fallback).
|
|
113
149
|
|
|
114
|
-
|
|
150
|
+
## Eval
|
|
151
|
+
```bash
|
|
152
|
+
npx tsx scripts/eval.ts path/to/output.json # score a run vs the reference SRT
|
|
153
|
+
```
|
|
115
154
|
|
|
116
|
-
##
|
|
155
|
+
## Reviews, fixes & receipts
|
|
156
|
+
This build (the **GLM** branch) was reviewed and iterated in the open. The receipts:
|
|
157
|
+
- **Spec & plan:** [`docs/spec.md`](docs/spec.md)
|
|
158
|
+
- **Round 1** (run-through): [`docs/review-1/human-review.md`](docs/review-1/human-review.md) β fixes in [`docs/review-1/review-fixes.md`](docs/review-1/review-fixes.md)
|
|
159
|
+
- **Round 2** (code read + independent review): [`docs/review-2/human-review.md`](docs/review-2/human-review.md), [`docs/review-2/REVIEW.md`](docs/review-2/REVIEW.md), [`docs/review-2/REVIEWER_GUIDE.md`](docs/review-2/REVIEWER_GUIDE.md) β fixes in [`docs/review-2/review-fixes.md`](docs/review-2/review-fixes.md)
|
|
160
|
+
- **Response to the GLM-vs-Opus comparison:** [`docs/comparison-response.md`](docs/comparison-response.md)
|
|
161
|
+
- **Dev journal:** [`intermediates/process_log_thoughts_ideas_hypotheses_and_scratch_space.md`](intermediates/process_log_thoughts_ideas_hypotheses_and_scratch_space.md)
|
|
162
|
+
- **Releasing / npm tags:** [`RELEASING.md`](RELEASING.md)
|
|
117
163
|
|
|
118
|
-
|
|
164
|
+
The Opus-built variant lives on the [`opus`](../../tree/opus) branch; the experiment overview is on [`master`](../../tree/master).
|
|
119
165
|
|
|
120
|
-
License
|
|
166
|
+
## License
|
|
167
|
+
Apache-2.0.
|