@drakulavich/parakeet-cli 0.7.2 → 0.7.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
@@ -59,6 +59,25 @@ Parakeet (CoreML): 1.9s ██
59
59
 
60
60
  Full results with transcripts: [BENCHMARK.md](BENCHMARK.md)
61
61
 
62
+ ## Supported Audio Formats
63
+
64
+ Any format that ffmpeg can decode works with parakeet:
65
+
66
+ | Format | Extension |
67
+ |---|---|
68
+ | WAV | `.wav` |
69
+ | MP3 | `.mp3` |
70
+ | OGG Vorbis | `.ogg` |
71
+ | FLAC | `.flac` |
72
+ | AAC / M4A | `.aac`, `.m4a` |
73
+ | Opus | `.opus` |
74
+ | WMA | `.wma` |
75
+ | WebM | `.webm` |
76
+ | MP4 (audio track) | `.mp4` |
77
+ | AIFF | `.aiff` |
78
+
79
+ CoreML backend tries native decoding first, falls back to ffmpeg for unsupported formats. ONNX backend always converts via ffmpeg.
80
+
62
81
  ## Supported Languages
63
82
 
64
83
  :bulgaria: Bulgarian, :croatia: Croatian, :czech_republic: Czech, :denmark: Danish, :netherlands: Dutch, :gb: English, :estonia: Estonian, :finland: Finnish, :fr: French, :de: German, :greece: Greek, :hungary: Hungarian, :it: Italian, :latvia: Latvian, :lithuania: Lithuanian, :malta: Maltese, :poland: Polish, :portugal: Portuguese, :romania: Romanian, :ru: Russian, :slovakia: Slovak, :slovenia: Slovenian, :es: Spanish, :sweden: Swedish, :ukraine: Ukrainian
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drakulavich/parakeet-cli",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Fast local speech-to-text CLI. CoreML on Apple Silicon, ONNX on CPU. 25 languages.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,36 @@
1
+ import { describe, test, expect } from "bun:test";
2
+ import { getFfmpegInstallHint, assertFfmpegExists, resetFfmpegCheck } from "../audio";
3
+
4
+ describe("getFfmpegInstallHint", () => {
5
+ test("returns a non-empty string", () => {
6
+ const hint = getFfmpegInstallHint();
7
+ expect(hint).toBeTruthy();
8
+ expect(typeof hint).toBe("string");
9
+ });
10
+
11
+ test("contains install keyword", () => {
12
+ const hint = getFfmpegInstallHint();
13
+ expect(hint).toMatch(/install|ffmpeg\.org/i);
14
+ });
15
+ });
16
+
17
+ describe("assertFfmpegExists", () => {
18
+ test("includes install hint when ffmpeg is missing", () => {
19
+ // Save and override Bun.which to simulate missing ffmpeg
20
+ const originalWhich = Bun.which;
21
+ Bun.which = ((cmd: string) => {
22
+ if (cmd === "ffmpeg") return null;
23
+ return originalWhich(cmd);
24
+ }) as typeof Bun.which;
25
+
26
+ // Reset the cached check so assertFfmpegExists re-checks
27
+ resetFfmpegCheck();
28
+
29
+ try {
30
+ expect(() => assertFfmpegExists()).toThrow(/Install it:/);
31
+ } finally {
32
+ Bun.which = originalWhich;
33
+ resetFfmpegCheck();
34
+ }
35
+ });
36
+ });
package/src/audio.ts CHANGED
@@ -61,10 +61,40 @@ async function convertAudioWithFfmpeg(
61
61
  return tmpPath;
62
62
  }
63
63
 
64
- function assertFfmpegExists(): void {
64
+ export function getFfmpegInstallHint(): string {
65
+ const platform = process.platform;
66
+
67
+ if (platform === "darwin") {
68
+ if (Bun.which("brew")) return " brew install ffmpeg";
69
+ if (Bun.which("port")) return " sudo port install ffmpeg";
70
+ }
71
+
72
+ if (platform === "linux") {
73
+ if (Bun.which("apt")) return " sudo apt install ffmpeg";
74
+ if (Bun.which("dnf")) return " sudo dnf install ffmpeg-free";
75
+ if (Bun.which("pacman")) return " sudo pacman -S ffmpeg";
76
+ }
77
+
78
+ if (platform === "win32") {
79
+ if (Bun.which("choco")) return " choco install ffmpeg";
80
+ if (Bun.which("scoop")) return " scoop install ffmpeg";
81
+ if (Bun.which("winget")) return " winget install ffmpeg";
82
+ }
83
+
84
+ return " https://ffmpeg.org/download.html";
85
+ }
86
+
87
+ export function assertFfmpegExists(): void {
65
88
  if (ffmpegChecked) return;
66
89
  if (!Bun.which("ffmpeg")) {
67
- throw new Error("ffmpeg not found in PATH");
90
+ const hint = getFfmpegInstallHint();
91
+ throw new Error(
92
+ `ffmpeg is required but not found in PATH.\n\nInstall it:\n${hint}`
93
+ );
68
94
  }
69
95
  ffmpegChecked = true;
70
96
  }
97
+
98
+ export function resetFfmpegCheck(): void {
99
+ ffmpegChecked = false;
100
+ }