offmute-v2 0.0.3 → 0.0.4

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 CHANGED
@@ -107,9 +107,10 @@ and an independent re-score live in [`docs/`](#receipts--how-this-repo-was-built
107
107
  - 🎬 **Video-aware** — samples keyframes for visual context (who's on screen, demos, slides).
108
108
  - ⚡ **Chunked + concurrent** — long files are split with overlap and stitched back with
109
109
  **ownership-partition** dedup (no double-printed sentences at chunk seams).
110
- - ♻️ **Resumable & stoppable** — every stage caches to disk; re-runs skip finished work, Ctrl-C
111
- leaves partials. The cache is keyed on the input **and** the config, so changing `--model` never
112
- serves you a stale transcript.
110
+ - ♻️ **Resumable & stoppable** — every stage caches to disk (in the **OS temp dir** by default;
111
+ the path is printed each run, and `-i <dir>` keeps it wherever you like). Re-runs skip finished
112
+ work, Ctrl-C leaves partials. The cache is keyed on the input **and** the config, so changing
113
+ `--model` never serves you a stale transcript.
113
114
  - 🔀 **Pluggable providers** — Gemini for the LLM; AssemblyAI *or* Groq Whisper for timing.
114
115
  - 🌐 **Runs in the browser** — a pure, node-free core + `fetch` providers + ffmpeg.wasm.
115
116
  - 🔎 **Fully inspectable** — every LLM prompt+response is logged to `llm-calls.jsonl`; all
@@ -180,8 +181,8 @@ node-only imports**, so it bundles tiny and runs in the browser via `offmute-v2/
180
181
  A multi-stage pipeline where each stage persists a JSON intermediate (so it's resumable and
181
182
  debuggable):
182
183
 
183
- 1. **preprocess** — ffmpeg → 16 kHz mono FLAC + scene-aware keyframes (a 9.6 GB `.mov` becomes a
184
- ~76 MB FLAC in seconds).
184
+ 1. **preprocess** — ffmpeg → compact mono 16 kHz **mp3** + scene-aware keyframes (a 9.6 GB `.mov`
185
+ becomes a few MB of audio in seconds — transparent for speech, but a fraction of lossless size).
185
186
  2. **describe** — a quick multimodal pass builds a meeting summary + speaker roster to prime
186
187
  transcription.
187
188
  3. **llm-transcribe** — each chunk goes to the LLM for verbatim text, diarization, and tone. Output
package/dist/cli.cjs CHANGED
@@ -40,6 +40,7 @@ var import_node_fs4 = require("fs");
40
40
  var import_node_crypto = require("crypto");
41
41
  var import_node_path = require("path");
42
42
  var import_node_fs = require("fs");
43
+ var import_node_os = require("os");
43
44
  var DEFAULT_PASSES = [
44
45
  "preprocess",
45
46
  "describe",
@@ -112,7 +113,7 @@ function deriveIntermediatesDir(input2) {
112
113
  const abs = (0, import_node_path.resolve)(input2);
113
114
  const hash = (0, import_node_crypto.createHash)("sha1").update(abs).digest("hex").slice(0, 8);
114
115
  const base = (0, import_node_path.basename)(input2, extOf(input2)) || "input";
115
- return `${(0, import_node_path.dirname)(abs)}/.offmute-v2-${base}-${hash}`;
116
+ return `${(0, import_node_os.tmpdir)()}/offmute-v2-${base}-${hash}`;
116
117
  }
117
118
  function extOf(p) {
118
119
  const i = p.lastIndexOf(".");
@@ -199,7 +200,7 @@ var import_node_child_process = require("child_process");
199
200
  var import_promises = require("fs/promises");
200
201
  var import_node_path2 = require("path");
201
202
  function run(cmd, args, _opts = {}) {
202
- return new Promise((resolve2, reject) => {
203
+ return new Promise((resolve3, reject) => {
203
204
  const child = (0, import_node_child_process.spawn)(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
204
205
  let stdout = "";
205
206
  let stderr = "";
@@ -207,7 +208,7 @@ function run(cmd, args, _opts = {}) {
207
208
  child.stderr.on("data", (d) => stderr += d.toString());
208
209
  child.on("error", reject);
209
210
  child.on("close", (code) => {
210
- if (code === 0) resolve2({ stdout, stderr });
211
+ if (code === 0) resolve3({ stdout, stderr });
211
212
  else {
212
213
  const tail = stderr.slice(-800);
213
214
  reject(new Error(`${cmd} exited ${code}: ${tail}`));
@@ -1736,6 +1737,7 @@ async function transcribe(opts2) {
1736
1737
  }
1737
1738
  (0, import_node_fs4.mkdirSync)(options.intermediatesDir, { recursive: true });
1738
1739
  (0, import_node_fs4.mkdirSync)(options.outputDir, { recursive: true });
1740
+ logger.info(`intermediates: ${(0, import_node_path5.resolve)(options.intermediatesDir)} (file://${(0, import_node_path5.resolve)(options.intermediatesDir)})`);
1739
1741
  setLlmLogPath(options.llmLog ? `${options.intermediatesDir}/llm-calls.jsonl` : null);
1740
1742
  const sourcePath = `${options.intermediatesDir}/source.json`;
1741
1743
  const sig = inputSignature(options.input);
@@ -1779,7 +1781,8 @@ async function transcribe(opts2) {
1779
1781
  }
1780
1782
  }
1781
1783
  let probeInfo = null;
1782
- const audioPath = `${options.intermediatesDir}/audio.flac`;
1784
+ const AUDIO_OPTS = { format: "mp3", bitrate: "64k" };
1785
+ const audioPath = `${options.intermediatesDir}/audio.mp3`;
1783
1786
  const probePath = `${options.intermediatesDir}/probe.json`;
1784
1787
  if (has(passes2, "preprocess")) {
1785
1788
  logger.info("=== preprocess ===");
@@ -1789,8 +1792,8 @@ async function transcribe(opts2) {
1789
1792
  writeJson(probePath, probeInfo);
1790
1793
  }
1791
1794
  if (!(0, import_node_fs4.existsSync)(audioPath) || forceAll) {
1792
- logger.info("extracting audio (mono 16kHz FLAC)...");
1793
- await extractAudio(options.input, audioPath, { format: "flac" });
1795
+ logger.info("extracting audio (mono 16kHz mp3)...");
1796
+ await extractAudio(options.input, audioPath, AUDIO_OPTS);
1794
1797
  }
1795
1798
  if (probeInfo.hasVideo) {
1796
1799
  const kfDir = `${options.intermediatesDir}/keyframes`;
@@ -1811,9 +1814,9 @@ async function transcribe(opts2) {
1811
1814
  if (!description) {
1812
1815
  logger.info("=== describe ===");
1813
1816
  const client = new GeminiClient(keys.gemini);
1814
- const samplePath = `${options.intermediatesDir}/sample.flac`;
1817
+ const samplePath = `${options.intermediatesDir}/sample.mp3`;
1815
1818
  if (!(0, import_node_fs4.existsSync)(samplePath) || forceAll) {
1816
- await extractChunk(audioPath, samplePath, 0, Math.min(300, duration), { format: "flac" });
1819
+ await extractChunk(audioPath, samplePath, 0, Math.min(300, duration), AUDIO_OPTS);
1817
1820
  }
1818
1821
  const files = [{ path: samplePath }];
1819
1822
  const kfDir = `${options.intermediatesDir}/keyframes`;
@@ -1867,9 +1870,9 @@ async function transcribe(opts2) {
1867
1870
  logger.info(`chunk ${chunk.index}: cached (${cached.segments.length} segments)`);
1868
1871
  return tagWith(cached, chunk);
1869
1872
  }
1870
- const chunkPath = `${llmDir}/chunk_${String(chunk.index).padStart(2, "0")}.flac`;
1873
+ const chunkPath = `${llmDir}/chunk_${String(chunk.index).padStart(2, "0")}.mp3`;
1871
1874
  if (!(0, import_node_fs4.existsSync)(chunkPath) || forceAll) {
1872
- await extractChunk(audioPath, chunkPath, chunk.start, chunk.end, { format: "flac" });
1875
+ await extractChunk(audioPath, chunkPath, chunk.start, chunk.end, AUDIO_OPTS);
1873
1876
  }
1874
1877
  let previousTail;
1875
1878
  if (chunk.index > 0) {
@@ -1932,12 +1935,11 @@ async function transcribe(opts2) {
1932
1935
  if (provider === "whisper-groq") {
1933
1936
  logger.info("=== timestamped (Groq Whisper \u2014 no diarization) ===");
1934
1937
  if (!keys.groq) throw new Error("GROQ_API_KEY is required for whisper-groq");
1935
- const mp3Path = `${options.intermediatesDir}/audio.mp3`;
1936
- if (!(0, import_node_fs4.existsSync)(mp3Path) || options.force) {
1937
- await extractAudio(options.input, mp3Path, { format: "mp3", bitrate: "64k" });
1938
+ if (!(0, import_node_fs4.existsSync)(audioPath) || forceAll) {
1939
+ await extractAudio(options.input, audioPath, AUDIO_OPTS);
1938
1940
  }
1939
1941
  const { readFile: readFile2 } = await import("fs/promises");
1940
- const buf = await readFile2(mp3Path);
1942
+ const buf = await readFile2(audioPath);
1941
1943
  const groq = new WhisperGroqClient(keys.groq);
1942
1944
  asrResult = await groq.transcribe(buf);
1943
1945
  writeJson(`${options.intermediatesDir}/timestamped.json`, asrResult);