offmute-v2 0.0.1-opus.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/README.md +120 -0
- package/dist/browser.d.ts +740 -0
- package/dist/browser.js +1494 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1529 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +513 -0
- package/dist/index.js +1533 -0
- package/dist/index.js.map +1 -0
- package/package.json +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# offmute-v2 🎙️⏱️
|
|
2
|
+
|
|
3
|
+
**Timestamp-correct, diarized meeting transcription.** Point it at a video or audio file and get back a transcript where every speaker turn is on the right millisecond, labelled with the speaker's name (when it can be inferred) and tone — as **SRT**, **Markdown**, or **JSON**.
|
|
4
|
+
|
|
5
|
+
It's the successor to [offmute](https://github.com/southbridgeai/offmute): great diarized transcripts, but now with real timestamps.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
export GEMINI_API_KEY=... # multimodal understanding
|
|
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
|
|
15
|
+
|
|
16
|
+
No single model is good at everything, so offmute-v2 uses each for what it's best at and **fuses** them:
|
|
17
|
+
|
|
18
|
+
| Job | Tool | Why |
|
|
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 |
|
|
23
|
+
|
|
24
|
+
The LLM writes the transcript and decides who's talking; the ASR supplies the clock; an alignment pass marries them. (Details in [`docs/SPEC.md`](docs/SPEC.md).)
|
|
25
|
+
|
|
26
|
+
### Measured on a 32-minute talk (founder presentation + audience Q&A)
|
|
27
|
+
|
|
28
|
+
Against a hand-checked reference transcript:
|
|
29
|
+
|
|
30
|
+
- **Word error rate: 8.1%**
|
|
31
|
+
- **Speaker attribution: 98.8%** (word-level)
|
|
32
|
+
- **Turn-boundary timing: 0.04s median, 0.43s p90** error
|
|
33
|
+
|
|
34
|
+
In a few places it diarizes *better* than the hand-checked reference (e.g. splitting an audience question from the speaker's answer where the reference merged them).
|
|
35
|
+
|
|
36
|
+
## CLI
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx offmute-v2 <input> [options]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Option | Default | Description |
|
|
43
|
+
|--------|---------|-------------|
|
|
44
|
+
| `-i, --instructions <text>` | – | guide speaker labelling/focus, e.g. "host is Alice; group callers as 'Caller'" |
|
|
45
|
+
| `-m, --model <model>` | `gemini-flash-latest` | LLM (e.g. `gemini-pro-latest` for max quality) |
|
|
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
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { transcribe, toSRT, toMarkdown } from "offmute-v2";
|
|
63
|
+
|
|
64
|
+
const { transcript, srt, markdown } = await transcribe("meeting.mp4", {
|
|
65
|
+
instructions: "Panel of three; label by name.",
|
|
66
|
+
llmModel: "gemini-flash-latest",
|
|
67
|
+
onProgress: (e) => console.log(e.stage, e.message),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
console.log(transcript.speakers); // [{ id, label, named, description }]
|
|
71
|
+
console.log(transcript.segments[0]); // { start, end, speakerId, text, tone, ... }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Long files (>35 min) are automatically chunked with overlap and stitched back together; the whole-file ASR voice clusters keep speaker identity consistent across chunks.
|
|
75
|
+
|
|
76
|
+
**More options:** `signal: AbortSignal` to cancel (cooperatively, at stage/chunk boundaries); `onLlmCall(rec)` to observe every LLM call (`{label, promptText, responseText, usage}`); `knownSpeakers`, `subSegment`, `identifySpeakers`, `asr: "none"`. Every LLM call (prompt + response) and the raw→parsed diarization are also written to `intermediates/<name>/llm/` and `diarize.parsed.json` for inspection.
|
|
77
|
+
|
|
78
|
+
## Browser
|
|
79
|
+
|
|
80
|
+
Runs **entirely in the browser** (`offmute-v2/browser`, ~50KB, zero deps): decode with
|
|
81
|
+
ffmpeg.wasm, call the providers over `fetch`, fuse with the pure core. You hand it a
|
|
82
|
+
loaded `@ffmpeg/ffmpeg` instance and your keys — one call does the rest (chunking and
|
|
83
|
+
all):
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { FFmpeg } from "@ffmpeg/ffmpeg";
|
|
87
|
+
import { transcribeInBrowser } from "offmute-v2/browser";
|
|
88
|
+
|
|
89
|
+
const ffmpeg = new FFmpeg();
|
|
90
|
+
await ffmpeg.load();
|
|
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),
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
A runnable demo is in [`examples/browser/index.html`](examples/browser/index.html) (loads
|
|
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.
|
|
106
|
+
|
|
107
|
+
## Requirements
|
|
108
|
+
|
|
109
|
+
- Node ≥ 18 and `ffmpeg`/`ffprobe` on PATH (CLI / Node library).
|
|
110
|
+
- API keys from env or injected (`apiKeys` option): `GEMINI_API_KEY` (or `GOOGLE_API_KEY`), `ASSEMBLYAI_API_KEY`.
|
|
111
|
+
|
|
112
|
+
## Diarization levels
|
|
113
|
+
|
|
114
|
+
1. **Separation** — who speaks when. 2. **Anonymous-consistent** — Speaker A/B, stable throughout. 3. **Identification** — real names from context. offmute-v2 targets **3**, with instruction-driven grouping (e.g. "everyone except the host is 'Audience'").
|
|
115
|
+
|
|
116
|
+
## Credits
|
|
117
|
+
|
|
118
|
+
Builds on three predecessors: **offmute** (multimodal describe→transcribe, tone), **ipgu** (chunk/merge discipline, timestamp validation), **meeting-diary** (ASR word-timestamps + diarization). Created by [Southbridge](https://southbridge.ai).
|
|
119
|
+
|
|
120
|
+
License: Apache-2.0.
|