offmute-v2 0.0.4 → 0.0.5
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 +49 -44
- package/dist/cli.cjs +79 -27
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +87 -35
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +74 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +80 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,17 +28,19 @@ and **fuses** them.
|
|
|
28
28
|
export GEMINI_API_KEY=... # multimodal understanding (or GOOGLE_API_KEY)
|
|
29
29
|
export ASSEMBLYAI_API_KEY=... # word-level timing
|
|
30
30
|
|
|
31
|
-
npx offmute-v2 meeting.mp4
|
|
32
|
-
# → meeting.
|
|
31
|
+
npx offmute-v2 meeting.mp4 --instructions "Panel of founders; label them by name."
|
|
32
|
+
# → meeting.md (written right next to meeting.mp4)
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
That's it. `bunx offmute-v2 meeting.mp4` works too.
|
|
36
36
|
|
|
37
37
|
## What you get
|
|
38
38
|
|
|
39
|
-
A clean, sub-second-aligned, speaker-labelled transcript with tone
|
|
39
|
+
A clean, sub-second-aligned, speaker-labelled transcript with tone. By default offmute-v2 writes a
|
|
40
|
+
**single `meeting.md` next to your input file** — add `--formats srt,md,json` (and/or `-o <dir>`) for
|
|
41
|
+
SubRip subtitles and JSON. The same content, three ways:
|
|
40
42
|
|
|
41
|
-
**`meeting.srt`** (drop straight onto the video):
|
|
43
|
+
**`meeting.srt`** (`--formats srt` — drop straight onto the video):
|
|
42
44
|
|
|
43
45
|
```srt
|
|
44
46
|
1
|
|
@@ -50,34 +52,36 @@ Speaker D: GPU
|
|
|
50
52
|
Presenter: And I'm inspired. I think I'm going to apply to NTU this fall. (confident, joking)
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
**`meeting.md`** (skimmable, grouped by speaker, with talk-time):
|
|
55
|
+
**`meeting.md`** (the **default** — skimmable, grouped by speaker, with talk-time):
|
|
54
56
|
|
|
55
57
|
```markdown
|
|
56
|
-
|
|
58
|
+
_Duration: 1914s · Speakers: 5_
|
|
57
59
|
|
|
58
60
|
## Speakers
|
|
61
|
+
|
|
59
62
|
- **Presenter** (1461s)
|
|
60
|
-
- **Speaker B** (97s)
|
|
63
|
+
- **Speaker B** (97s) · **Speaker C** (87s) · ...
|
|
61
64
|
|
|
62
65
|
## Transcript
|
|
66
|
+
|
|
63
67
|
[00:00] **Speaker D**: GPU
|
|
64
|
-
[00:01] **Presenter**
|
|
68
|
+
[00:01] **Presenter** _(confident, joking)_: And I'm inspired. I think I'm going to apply to NTU this fall.
|
|
65
69
|
```
|
|
66
70
|
|
|
67
|
-
**`meeting.json`** — every segment with `start`/`end`, `speaker`, `text`,
|
|
68
|
-
`confidence`, and word-level timings — for downstream tooling.
|
|
71
|
+
**`meeting.json`** (`--formats json`) — every segment with `start`/`end`, `speaker`, `text`,
|
|
72
|
+
`tone[]`, `timingSource`, `confidence`, and word-level timings — for downstream tooling.
|
|
69
73
|
|
|
70
74
|
## Why it's accurate
|
|
71
75
|
|
|
72
|
-
LLMs are brilliant at
|
|
76
|
+
LLMs are brilliant at _understanding_ speech (who's talking, through interruptions, in a crowd,
|
|
73
77
|
with tone) but [terrible at timestamps](#how-it-works). ASR models are the opposite: sub-second
|
|
74
78
|
timing, but mediocre diarization and no sense of tone. offmute-v2 runs **both** and marries them:
|
|
75
79
|
|
|
76
|
-
| Job
|
|
77
|
-
|
|
78
|
-
| **WHO / HOW** — speakers, names, tone, hard audio | multimodal **LLM** (Gemini)
|
|
79
|
-
| **WHEN** — word-level timestamps
|
|
80
|
-
| **fuse**
|
|
80
|
+
| Job | Tool | Why |
|
|
81
|
+
| ------------------------------------------------- | ----------------------------------- | --------------------------------------------------------------------- |
|
|
82
|
+
| **WHO / HOW** — speakers, names, tone, hard audio | multimodal **LLM** (Gemini) | infers names from context, hears tone, handles crowds & interruptions |
|
|
83
|
+
| **WHEN** — word-level timestamps | **ASR** (AssemblyAI / Groq Whisper) | sub-second accurate; LLM timestamps drift _minutes_ over a long file |
|
|
84
|
+
| **fuse** | edit-distance **alignment** | transfers the ASR's clock onto the LLM's richer words |
|
|
81
85
|
|
|
82
86
|
```mermaid
|
|
83
87
|
flowchart LR
|
|
@@ -111,7 +115,7 @@ and an independent re-score live in [`docs/`](#receipts--how-this-repo-was-built
|
|
|
111
115
|
the path is printed each run, and `-i <dir>` keeps it wherever you like). Re-runs skip finished
|
|
112
116
|
work, Ctrl-C leaves partials. The cache is keyed on the input **and** the config, so changing
|
|
113
117
|
`--model` never serves you a stale transcript.
|
|
114
|
-
- 🔀 **Pluggable providers** — Gemini for the LLM; AssemblyAI
|
|
118
|
+
- 🔀 **Pluggable providers** — Gemini for the LLM; AssemblyAI _or_ Groq Whisper for timing.
|
|
115
119
|
- 🌐 **Runs in the browser** — a pure, node-free core + `fetch` providers + ffmpeg.wasm.
|
|
116
120
|
- 🔎 **Fully inspectable** — every LLM prompt+response is logged to `llm-calls.jsonl`; all
|
|
117
121
|
intermediates are plain JSON.
|
|
@@ -124,20 +128,20 @@ and an independent re-score live in [`docs/`](#receipts--how-this-repo-was-built
|
|
|
124
128
|
npx offmute-v2 <input> [options]
|
|
125
129
|
```
|
|
126
130
|
|
|
127
|
-
| Option
|
|
128
|
-
|
|
129
|
-
| `-o, --output <dir>`
|
|
130
|
-
| `--instructions <text>`
|
|
131
|
-
| `--model <name>`
|
|
132
|
-
| `--level <1\|2\|3>`
|
|
133
|
-
| `--timestamped <p>`
|
|
134
|
-
| `--reasoner <name>`
|
|
135
|
-
| `--chunk-seconds <n>`
|
|
136
|
-
| `--formats <list>`
|
|
137
|
-
| `--passes <list>`
|
|
138
|
-
| `--force`
|
|
139
|
-
| `--only-chunk <n>`
|
|
140
|
-
| `-i, --intermediates <dir>` | auto
|
|
131
|
+
| Option | Default | Description |
|
|
132
|
+
| --------------------------- | ------------------ | ------------------------------------------------------------------------------------- |
|
|
133
|
+
| `-o, --output <dir>` | _next to input_ | where to write the transcript(s); default is the input file's own folder |
|
|
134
|
+
| `--instructions <text>` | – | guide diarization / labelling, e.g. `"host is Alice; group callers as 'Caller'"` |
|
|
135
|
+
| `--model <name>` | `gemini-3.1-pro-preview` | multimodal LLM; use `gemini-2.5-flash` / `gemini-flash-latest` for faster/cheaper runs |
|
|
136
|
+
| `--level <1\|2\|3>` | `2` | 1 = separation · 2 = stable anon · 3 = identify names |
|
|
137
|
+
| `--timestamped <p>` | `assemblyai` | timing provider: `assemblyai` · `whisper-groq` · `none` |
|
|
138
|
+
| `--reasoner <name>` | `deepseek-chat` | text model for the name-identification pass (level 3) |
|
|
139
|
+
| `--chunk-seconds <n>` | `600` | chunk length · `--overlap-seconds` (default `60`) |
|
|
140
|
+
| `--formats <list>` | `md` | which outputs to write (`srt`, `md`, `json`) |
|
|
141
|
+
| `--passes <list>` | all | run/resume a subset of stages |
|
|
142
|
+
| `--force` | – | ignore caches and recompute |
|
|
143
|
+
| `--only-chunk <n>` | – | process a single chunk (debugging) |
|
|
144
|
+
| `-i, --intermediates <dir>` | auto | cache dir (auto-derived per input) |
|
|
141
145
|
|
|
142
146
|
```bash
|
|
143
147
|
npx offmute-v2 meeting.mp4 --level 3 # name the speakers
|
|
@@ -148,18 +152,19 @@ npx offmute-v2 meeting.mp4 --passes align,consistency,finalize # resume from c
|
|
|
148
152
|
|
|
149
153
|
### Library
|
|
150
154
|
|
|
151
|
-
The primary line takes a single options object
|
|
155
|
+
The primary line takes a single options object. Only `input` is required — `outputDir` defaults to
|
|
156
|
+
the input file's folder and `formats` defaults to `["md"]`:
|
|
152
157
|
|
|
153
158
|
```ts
|
|
154
159
|
import { transcribe } from "offmute-v2";
|
|
155
160
|
|
|
156
161
|
const { segments, speakers, metadata } = await transcribe({
|
|
157
162
|
input: "meeting.mp4",
|
|
158
|
-
outputDir: "./out",
|
|
163
|
+
// outputDir: "./out", // optional — defaults next to the input
|
|
159
164
|
model: "gemini-flash-latest",
|
|
160
165
|
level: 3,
|
|
161
166
|
instructions: "Three-person panel; label by name.",
|
|
162
|
-
formats: ["srt", "md", "json"],
|
|
167
|
+
formats: ["srt", "md", "json"], // optional — defaults to ["md"]
|
|
163
168
|
apiKeys: { gemini: "...", assemblyai: "..." }, // optional; falls back to env
|
|
164
169
|
});
|
|
165
170
|
|
|
@@ -195,14 +200,14 @@ debuggable):
|
|
|
195
200
|
so nothing is dropped.
|
|
196
201
|
7. **consistency** — the ASR voice clusters act as a global backbone, merging the LLM's per-chunk
|
|
197
202
|
labels into stable speakers (and fixing ASR over-splits).
|
|
198
|
-
8. **identify**
|
|
203
|
+
8. **identify** _(level 3)_ — a reasoning model maps `Speaker A` → real names using context + a
|
|
199
204
|
voice-cluster hint.
|
|
200
205
|
9. **finalize** — overlap fixes, clamping, readable subtitle-sized blocks, and SRT/MD/JSON.
|
|
201
206
|
|
|
202
207
|
> [!NOTE]
|
|
203
208
|
> The hard parts of this problem are **chunk overlap** and **alignment**. offmute-v2 partitions
|
|
204
|
-
> overlap by
|
|
205
|
-
> double-printed at seams, and aligns the
|
|
209
|
+
> overlap by _ownership_ (each word is emitted by exactly one chunk) so sentences are never
|
|
210
|
+
> double-printed at seams, and aligns the _whole_ chunk in one DP pass so common words like "it"
|
|
206
211
|
> can't mis-match to a later occurrence.
|
|
207
212
|
|
|
208
213
|
## Built twice, in the open: GLM vs Opus
|
|
@@ -212,11 +217,11 @@ prompt**, by two different models running in **Claude Code** — a head-to-head
|
|
|
212
217
|
AI-resistant build (fusing the ideas of [offmute], [meeting-diary], and [ipgu] into one
|
|
213
218
|
timestamp-accurate diarizer):
|
|
214
219
|
|
|
215
|
-
| Branch
|
|
216
|
-
|
|
220
|
+
| Branch | Built by | npm tag | What it is |
|
|
221
|
+
| ----------------------------- | ---------------------------- | ------------------- | ---------------------------------------------- |
|
|
217
222
|
| [`master`](../../tree/master) | GLM line + post-launch fixes | `offmute-v2@latest` | the daily-driven, hardened build (this README) |
|
|
218
|
-
| [`glm`](../../tree/glm)
|
|
219
|
-
| [`opus`](../../tree/opus)
|
|
223
|
+
| [`glm`](../../tree/glm) | **GLM-5.2** | `offmute-v2@glm` | the frozen GLM experiment build |
|
|
224
|
+
| [`opus`](../../tree/opus) | **Claude Opus 4.8** | `offmute-v2@opus` | the frozen Opus experiment build |
|
|
220
225
|
|
|
221
226
|
```bash
|
|
222
227
|
npx offmute-v2@glm meeting.mp4 # the GLM build, exactly as submitted
|
|
@@ -242,10 +247,10 @@ Everything is open for inspection:
|
|
|
242
247
|
## Diarization levels
|
|
243
248
|
|
|
244
249
|
1. **Separation** — who speaks when.
|
|
245
|
-
2. **Anonymous-consistent** — `Speaker A/B`, stable across the whole file
|
|
250
|
+
2. **Anonymous-consistent** — `Speaker A/B`, stable across the whole file _(default)_.
|
|
246
251
|
3. **Identification** — real names inferred from context (needs `DEEPSEEK_API_KEY`, or point
|
|
247
|
-
`--reasoner` at another provider). Use `--instructions` to steer (e.g.
|
|
248
|
-
host is 'Audience'"
|
|
252
|
+
`--reasoner` at another provider). Use `--instructions` to steer (e.g. _"everyone except the
|
|
253
|
+
host is 'Audience'"_).
|
|
249
254
|
|
|
250
255
|
## Requirements
|
|
251
256
|
|
package/dist/cli.cjs
CHANGED
|
@@ -54,12 +54,14 @@ var MODELS = {
|
|
|
54
54
|
gemini25Pro: "gemini-2.5-pro",
|
|
55
55
|
gemini25Flash: "gemini-2.5-flash",
|
|
56
56
|
gemini3Pro: "gemini-3-pro-preview",
|
|
57
|
+
gemini31Pro: "gemini-3.1-pro-preview",
|
|
58
|
+
geminiFlashLatest: "gemini-flash-latest",
|
|
57
59
|
deepseek: "deepseek-chat",
|
|
58
60
|
deepseekReasoner: "deepseek-reasoner",
|
|
59
61
|
gpt4o: "gpt-4o",
|
|
60
62
|
claudeSonnet: "claude-sonnet-4-5"
|
|
61
63
|
};
|
|
62
|
-
var DEFAULT_TRANSCRIBE_MODEL = MODELS.
|
|
64
|
+
var DEFAULT_TRANSCRIBE_MODEL = MODELS.gemini31Pro;
|
|
63
65
|
var DEFAULT_REASONER_MODEL = MODELS.deepseek;
|
|
64
66
|
function resolveKeys(injected) {
|
|
65
67
|
const env = process.env;
|
|
@@ -76,7 +78,8 @@ function resolveKeys(injected) {
|
|
|
76
78
|
function resolveOptions(opts2) {
|
|
77
79
|
return {
|
|
78
80
|
input: opts2.input,
|
|
79
|
-
|
|
81
|
+
// Default: write next to the input file (e.g. meeting.md beside meeting.mp4) — no ./output folder.
|
|
82
|
+
outputDir: opts2.outputDir ?? (0, import_node_path.dirname)((0, import_node_path.resolve)(opts2.input)),
|
|
80
83
|
intermediatesDir: opts2.intermediatesDir ?? deriveIntermediatesDir(opts2.input),
|
|
81
84
|
instructions: opts2.instructions,
|
|
82
85
|
knownSpeakers: opts2.knownSpeakers,
|
|
@@ -96,7 +99,7 @@ function resolveOptions(opts2) {
|
|
|
96
99
|
screenshotCount: opts2.screenshotCount ?? 6,
|
|
97
100
|
concurrency: opts2.concurrency ?? 4,
|
|
98
101
|
saveIntermediates: opts2.saveIntermediates ?? true,
|
|
99
|
-
formats: opts2.formats ?? ["
|
|
102
|
+
formats: opts2.formats ?? ["md"],
|
|
100
103
|
diarizationLevel: opts2.diarizationLevel ?? 2,
|
|
101
104
|
apiKeys: opts2.apiKeys,
|
|
102
105
|
model: opts2.model,
|
|
@@ -1724,10 +1727,9 @@ function has(passes2, p) {
|
|
|
1724
1727
|
}
|
|
1725
1728
|
async function transcribe(opts2) {
|
|
1726
1729
|
if (!opts2 || typeof opts2.input !== "string" || opts2.input.length === 0) {
|
|
1727
|
-
throw new Error(
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
throw new Error("transcribe(options): 'outputDir' (directory for outputs) is required");
|
|
1730
|
+
throw new Error(
|
|
1731
|
+
"transcribe(options): 'input' (path to the audio/video file) is required"
|
|
1732
|
+
);
|
|
1731
1733
|
}
|
|
1732
1734
|
const options = resolveOptions(opts2);
|
|
1733
1735
|
const keys = resolveKeys(options.apiKeys);
|
|
@@ -1737,12 +1739,16 @@ async function transcribe(opts2) {
|
|
|
1737
1739
|
}
|
|
1738
1740
|
(0, import_node_fs4.mkdirSync)(options.intermediatesDir, { recursive: true });
|
|
1739
1741
|
(0, import_node_fs4.mkdirSync)(options.outputDir, { recursive: true });
|
|
1740
|
-
logger.info(
|
|
1742
|
+
logger.info(
|
|
1743
|
+
`intermediates: ${(0, import_node_path5.resolve)(options.intermediatesDir)} (file://${(0, import_node_path5.resolve)(options.intermediatesDir)})`
|
|
1744
|
+
);
|
|
1741
1745
|
setLlmLogPath(options.llmLog ? `${options.intermediatesDir}/llm-calls.jsonl` : null);
|
|
1742
1746
|
const sourcePath = `${options.intermediatesDir}/source.json`;
|
|
1743
1747
|
const sig = inputSignature(options.input);
|
|
1744
1748
|
const cfgSig = configSignature(opts2);
|
|
1745
|
-
const prevSig = readJson(
|
|
1749
|
+
const prevSig = readJson(
|
|
1750
|
+
sourcePath
|
|
1751
|
+
);
|
|
1746
1752
|
const inputChanged = !prevSig || prevSig.signature !== sig;
|
|
1747
1753
|
const configChanged = !prevSig || prevSig.config !== cfgSig;
|
|
1748
1754
|
if (inputChanged && prevSig) {
|
|
@@ -1826,7 +1832,13 @@ async function transcribe(opts2) {
|
|
|
1826
1832
|
if ((0, import_node_fs4.existsSync)(p)) files.push({ path: p });
|
|
1827
1833
|
}
|
|
1828
1834
|
}
|
|
1829
|
-
description = await describeMeeting(
|
|
1835
|
+
description = await describeMeeting(
|
|
1836
|
+
client,
|
|
1837
|
+
models.transcribe,
|
|
1838
|
+
files,
|
|
1839
|
+
(0, import_node_path5.basename)(options.input),
|
|
1840
|
+
options.instructions
|
|
1841
|
+
);
|
|
1830
1842
|
writeJson(descPath, description);
|
|
1831
1843
|
logger.info(`description: ${description.description.slice(0, 120)}...`);
|
|
1832
1844
|
}
|
|
@@ -1839,27 +1851,39 @@ async function transcribe(opts2) {
|
|
|
1839
1851
|
let silences = [];
|
|
1840
1852
|
try {
|
|
1841
1853
|
silences = await detectSilence(audioPath, { noiseDb: -15, minDuration: 0.3 });
|
|
1842
|
-
if (silences.length < 3)
|
|
1854
|
+
if (silences.length < 3)
|
|
1855
|
+
silences = await detectSilence(audioPath, { noiseDb: -12, minDuration: 0.25 });
|
|
1843
1856
|
} catch {
|
|
1844
1857
|
}
|
|
1845
1858
|
chunks = planChunks(duration, options.chunkDurationSec, options.chunkOverlapSec);
|
|
1846
1859
|
if (silences.length > 3) {
|
|
1847
1860
|
chunks = chunks.map((c) => {
|
|
1848
|
-
const snapped = snapToSilence(
|
|
1861
|
+
const snapped = snapToSilence(
|
|
1862
|
+
c.start,
|
|
1863
|
+
silences,
|
|
1864
|
+
Math.min(10, options.chunkOverlapSec / 2)
|
|
1865
|
+
);
|
|
1849
1866
|
return { ...c, start: snapped, trustedStart: snapped + c.overlapWithPrevious };
|
|
1850
1867
|
});
|
|
1851
1868
|
}
|
|
1852
1869
|
}
|
|
1853
1870
|
const tagWith = (r, chunk) => ({
|
|
1854
1871
|
...r,
|
|
1855
|
-
segments: r.segments.map((s) => ({
|
|
1872
|
+
segments: r.segments.map((s) => ({
|
|
1873
|
+
...s,
|
|
1874
|
+
chunkIndex: chunk.index,
|
|
1875
|
+
trustedStart: chunk.trustedStart
|
|
1876
|
+
}))
|
|
1856
1877
|
});
|
|
1857
1878
|
let llmChunkResults = [];
|
|
1858
1879
|
if (has(passes2, "llm-transcribe")) {
|
|
1859
1880
|
logger.info("=== llm-transcribe ===");
|
|
1860
1881
|
let runChunks = chunks;
|
|
1861
|
-
if (options.onlyChunk !== void 0)
|
|
1862
|
-
|
|
1882
|
+
if (options.onlyChunk !== void 0)
|
|
1883
|
+
runChunks = chunks.filter((c) => c.index === options.onlyChunk);
|
|
1884
|
+
logger.info(
|
|
1885
|
+
`${runChunks.length} chunks (${options.chunkDurationSec}s, ${options.chunkOverlapSec}s overlap)`
|
|
1886
|
+
);
|
|
1863
1887
|
const client = new GeminiClient(keys.gemini);
|
|
1864
1888
|
const llmDir = `${options.intermediatesDir}/llm`;
|
|
1865
1889
|
(0, import_node_fs4.mkdirSync)(llmDir, { recursive: true });
|
|
@@ -1883,7 +1907,9 @@ async function transcribe(opts2) {
|
|
|
1883
1907
|
previousTail = prev.segments.slice(-6).map((s) => `${s.speaker}: ${s.text}`).join("\n");
|
|
1884
1908
|
}
|
|
1885
1909
|
}
|
|
1886
|
-
logger.info(
|
|
1910
|
+
logger.info(
|
|
1911
|
+
`chunk ${chunk.index}: transcribing [${chunk.start.toFixed(0)}-${chunk.end.toFixed(0)}]s...`
|
|
1912
|
+
);
|
|
1887
1913
|
const result2 = await transcribeChunk(
|
|
1888
1914
|
client,
|
|
1889
1915
|
models.transcribe,
|
|
@@ -1900,7 +1926,10 @@ async function transcribe(opts2) {
|
|
|
1900
1926
|
{ chunkDurationSec: chunk.end - chunk.start, validationRetries: 1 }
|
|
1901
1927
|
);
|
|
1902
1928
|
writeJson(parsedPath, result2);
|
|
1903
|
-
(0, import_node_fs4.writeFileSync)(
|
|
1929
|
+
(0, import_node_fs4.writeFileSync)(
|
|
1930
|
+
`${llmDir}/chunk_${String(chunk.index).padStart(2, "0")}_raw.json`,
|
|
1931
|
+
result2.raw
|
|
1932
|
+
);
|
|
1904
1933
|
return tagWith(result2, chunk);
|
|
1905
1934
|
});
|
|
1906
1935
|
const errored = llmChunkResults.filter((r) => r.error);
|
|
@@ -1945,8 +1974,14 @@ async function transcribe(opts2) {
|
|
|
1945
1974
|
writeJson(`${options.intermediatesDir}/timestamped.json`, asrResult);
|
|
1946
1975
|
} else {
|
|
1947
1976
|
logger.info("=== timestamped (AssemblyAI) ===");
|
|
1948
|
-
if (!keys.assemblyai)
|
|
1949
|
-
|
|
1977
|
+
if (!keys.assemblyai)
|
|
1978
|
+
throw new Error(
|
|
1979
|
+
"ASSEMBLYAI_API_KEY is required for the timestamped pass (or use --timestamped whisper-groq)"
|
|
1980
|
+
);
|
|
1981
|
+
const aai = new AssemblyAIProvider({
|
|
1982
|
+
apiKey: keys.assemblyai,
|
|
1983
|
+
cacheDir: `${options.intermediatesDir}/assemblyai`
|
|
1984
|
+
});
|
|
1950
1985
|
asrResult = await aai.transcribe(audioPath);
|
|
1951
1986
|
writeJson(`${options.intermediatesDir}/timestamped.json`, asrResult);
|
|
1952
1987
|
}
|
|
@@ -1990,7 +2025,11 @@ async function transcribe(opts2) {
|
|
|
1990
2025
|
}
|
|
1991
2026
|
if (options.diarizationLevel >= 3 && has(passes2, "identify") && keys.deepseek && description) {
|
|
1992
2027
|
logger.info("=== identify (DeepSeek) ===");
|
|
1993
|
-
const dsClient = OpenAICompatClient.fromProvider(
|
|
2028
|
+
const dsClient = OpenAICompatClient.fromProvider(
|
|
2029
|
+
"deepseek",
|
|
2030
|
+
keys.deepseek,
|
|
2031
|
+
models.reasoner
|
|
2032
|
+
);
|
|
1994
2033
|
const id = await identifySpeakers(
|
|
1995
2034
|
dsClient,
|
|
1996
2035
|
models.reasoner,
|
|
@@ -1999,7 +2038,9 @@ async function transcribe(opts2) {
|
|
|
1999
2038
|
description.roster,
|
|
2000
2039
|
options.knownSpeakers
|
|
2001
2040
|
);
|
|
2002
|
-
logger.info(
|
|
2041
|
+
logger.info(
|
|
2042
|
+
`identified ${Object.keys(id.nameMap).length} speakers: ${JSON.stringify(id.nameMap)}`
|
|
2043
|
+
);
|
|
2003
2044
|
writeJson(`${options.intermediatesDir}/identified.json`, id);
|
|
2004
2045
|
segments = segments.map(
|
|
2005
2046
|
(s) => id.nameMap[s.speaker] ? { ...s, speakerName: id.nameMap[s.speaker] } : s
|
|
@@ -2030,9 +2071,18 @@ async function transcribe(opts2) {
|
|
|
2030
2071
|
const result = { segments: finalSegments, speakers, metadata };
|
|
2031
2072
|
for (const fmt of options.formats) {
|
|
2032
2073
|
const base = (0, import_node_path5.basename)(options.input, ext(options.input));
|
|
2033
|
-
if (fmt === "srt")
|
|
2034
|
-
|
|
2035
|
-
|
|
2074
|
+
if (fmt === "srt")
|
|
2075
|
+
(0, import_node_fs4.writeFileSync)(
|
|
2076
|
+
`${options.outputDir}/${base}.srt`,
|
|
2077
|
+
formatSrt(result, { title: base })
|
|
2078
|
+
);
|
|
2079
|
+
if (fmt === "md")
|
|
2080
|
+
(0, import_node_fs4.writeFileSync)(
|
|
2081
|
+
`${options.outputDir}/${base}.md`,
|
|
2082
|
+
formatMarkdown(result, { title: base })
|
|
2083
|
+
);
|
|
2084
|
+
if (fmt === "json")
|
|
2085
|
+
(0, import_node_fs4.writeFileSync)(`${options.outputDir}/${base}.json`, formatJson(result));
|
|
2036
2086
|
}
|
|
2037
2087
|
logger.info(`outputs written to ${options.outputDir}`);
|
|
2038
2088
|
return result;
|
|
@@ -2051,10 +2101,10 @@ try {
|
|
|
2051
2101
|
} catch {
|
|
2052
2102
|
}
|
|
2053
2103
|
var program = new import_commander.Command();
|
|
2054
|
-
program.name("offmute-v2").description("Diarized meeting transcription with multimodal LLMs + timestamped alignment.").version(packageVersion).argument("<input>", "input video/audio file").option("-o, --output <dir>", "output directory
|
|
2104
|
+
program.name("offmute-v2").description("Diarized meeting transcription with multimodal LLMs + timestamped alignment.").version(packageVersion).argument("<input>", "input video/audio file").option("-o, --output <dir>", "output directory (default: next to the input file)").option(
|
|
2055
2105
|
"-i, --intermediates <dir>",
|
|
2056
2106
|
"intermediates directory (default: auto-derived per input file so caches never collide)"
|
|
2057
|
-
).option("--instructions <text>", "custom instructions for the LLM").option("--passes <list>", "comma-separated passes to run").option("--chunk-seconds <n>", "chunk duration in seconds", "600").option("--overlap-seconds <n>", "chunk overlap in seconds", "60").option("--concurrency <n>", "max concurrent chunk requests", "4").option("--screenshots <n>", "number of keyframes to extract (video)", "6").option("--formats <list>", "output formats: srt,md,json
|
|
2107
|
+
).option("--instructions <text>", "custom instructions for the LLM").option("--passes <list>", "comma-separated passes to run").option("--chunk-seconds <n>", "chunk duration in seconds", "600").option("--overlap-seconds <n>", "chunk overlap in seconds", "60").option("--concurrency <n>", "max concurrent chunk requests", "4").option("--screenshots <n>", "number of keyframes to extract (video)", "6").option("--formats <list>", "output formats: srt,md,json (default: md)").option("--level <1|2|3>", "diarization level (1=separation, 2=consistent, 3=identify)", "2").option("--model <name>", "override transcription model").option("--reasoner <name>", "override text-reasoner model (default deepseek-chat)").option("--timestamped <provider>", "timestamped provider (assemblyai|whisper-groq|none)").option("--force", "force reprocess cached chunk outputs", false).option("--only-chunk <n>", "process only a specific chunk index (debug)").option("--save-intermediates", "save intermediates (default true)", true).option("--no-progress", "hide progress output").option("--no-llm-log", "disable per-call LLM logging to <intermediates>/llm-calls.jsonl").option("--log-level <level>", "debug | info | warn | error", "info");
|
|
2058
2108
|
program.parse();
|
|
2059
2109
|
var opts = program.opts();
|
|
2060
2110
|
var input = program.args[0];
|
|
@@ -2067,6 +2117,7 @@ var level = parseInt(opts.level, 10);
|
|
|
2067
2117
|
transcribe({
|
|
2068
2118
|
input,
|
|
2069
2119
|
outputDir: opts.output,
|
|
2120
|
+
// undefined → defaults to the input file's directory
|
|
2070
2121
|
intermediatesDir: opts.intermediates,
|
|
2071
2122
|
instructions: opts.instructions,
|
|
2072
2123
|
passes,
|
|
@@ -2074,7 +2125,8 @@ transcribe({
|
|
|
2074
2125
|
chunkOverlapSec: parseInt(opts.overlapSeconds, 10),
|
|
2075
2126
|
concurrency: parseInt(opts.concurrency, 10),
|
|
2076
2127
|
screenshotCount: parseInt(opts.screenshots, 10),
|
|
2077
|
-
formats: opts.formats.split(","),
|
|
2128
|
+
formats: opts.formats ? opts.formats.split(",") : void 0,
|
|
2129
|
+
// undefined → defaults to ["md"]
|
|
2078
2130
|
diarizationLevel: level,
|
|
2079
2131
|
model: opts.model,
|
|
2080
2132
|
reasoner: opts.reasoner,
|