Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
feat: bundled in ffmpeg
Gabriel Stein274ebca4d7e5
diff --git a/LOCAL_WHISPER_SETUP.md b/LOCAL_WHISPER_SETUP.mdindex af14b15cb..4b9334d33 100644--- a/LOCAL_WHISPER_SETUP.md+++ b/LOCAL_WHISPER_SETUP.md@@ -72,16 +72,25 @@ Your OpenWispr app has been successfully refactored to support **local Whisper m- ✅ **Fast & Efficient**: Minimal local resource usage- ✅ **Always Latest Model**: OpenAI's most advanced model-## 📦 Requirements (Already Installed)+## 📦 Requirements-The following are already installed and configured:+### ✅ Bundled Dependencies (No Installation Required)-- ✅ **Python 3**: Installed via Homebrew-- ✅ **FFmpeg**: Installed via Homebrew-- ✅ **OpenAI Whisper**: Installed via pip3-- ✅ **Bridge Script**: Created and configured+The following are now **bundled with the app** and require no user installation:++- ✅ **FFmpeg**: Bundled with the app (no system installation needed)+- ✅ **Python Bridge Script**: Included in the app bundle- ✅ **App Integration**: Fully implemented+### 🔧 Optional Dependencies (For Local Whisper)++For **local Whisper processing**, users still need:++- ✅ **Python 3**: Installed via Homebrew or system package manager+- ✅ **OpenAI Whisper**: Installed via `pip3 install openai-whisper`++**Note**: FFmpeg is now bundled, so users no longer need to install it separately!+## 🧪 Testing Your Setup### Test 1: Check Installation Statusdiff --git a/electron-builder.json b/electron-builder.jsonindex dcef0cf7b..0dce09158 100644--- a/electron-builder.json+++ b/electron-builder.json@@ -22,10 +22,12 @@],"asarUnpack": ["assets/**/*",- "whisper_bridge.py"+ "whisper_bridge.py",+ "node_modules/ffmpeg-static/**/*"],"extraResources": [- "assets/**/*"+ "assets/**/*",+ "node_modules/ffmpeg-static/**/*"],"mac": {"category": "public.app-category.productivity",diff --git a/package.json b/package.jsonindex a73de1119..9e0e9d560 100644--- a/package.json+++ b/package.json@@ -45,6 +45,7 @@"eslint": "^9.25.0","eslint-plugin-react-hooks": "^5.2.0","eslint-plugin-react-refresh": "^0.4.19",+ "ffmpeg-static": "^5.2.0","globals": "^16.0.0","postcss": "^8.5.6","tailwindcss": "^4.1.10",diff --git a/preload.js b/preload.jsindex 06f8937d3..96a631073 100644--- a/preload.js+++ b/preload.js@@ -46,6 +46,8 @@ contextBridge.exposeInMainWorld("electronAPI", {deleteWhisperModel: (modelName) =>ipcRenderer.invoke("delete-whisper-model", modelName),cancelWhisperDownload: () => ipcRenderer.invoke("cancel-whisper-download"),+ checkFFmpegAvailability: () =>+ ipcRenderer.invoke("check-ffmpeg-availability"),// Window control functionswindowMinimize: () => ipcRenderer.invoke("window-minimize"),diff --git a/setup.js b/setup.jsindex 4420fb392..54303b978 100644--- a/setup.js+++ b/setup.js@@ -1,7 +1,7 @@-const fs = require("fs")-const path = require("path")+const fs = require("fs");+const path = require("path");-console.log("Setting up OpenWispr...")+console.log("Setting up OpenWispr...");const envTemplate = `# OpenAI API Configuration# Get your API key from: https://platform.openai.com/api-keys@@ -16,13 +16,13 @@ WHISPER_MODEL=whisper-1LANGUAGE=# Optional: Debug mode (set to 'true' to enable verbose logging)-DEBUG=false`+DEBUG=false`;if (!fs.existsSync(".env")) {- fs.writeFileSync(".env", envTemplate)- console.log("✅ Created .env file template")+ fs.writeFileSync(".env", envTemplate);+ console.log("✅ Created .env file template");} else {- console.log("⚠️ .env file already exists")+ console.log("⚠️ .env file already exists");}console.log(`@@ -38,8 +38,13 @@ Features:- Space bar to start/stop recording- ESC to close the app- Automatic text pasting at cursor location+- FFmpeg bundled (no separate installation needed)Note: Make sure you have the necessary system permissions for:- Microphone access- Accessibility permissions (for text pasting)-`)++For local Whisper processing, you'll also need:+- Python 3 (install via Homebrew: brew install python3)+- OpenAI Whisper (install via: pip3 install openai-whisper)+`);diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex fb5ab12a8..e7e71cc27 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -217,6 +217,10 @@ class IPCHandlers {return this.whisperManager.cancelDownload();});+ ipcMain.handle("check-ffmpeg-availability", async (event) => {+ return this.whisperManager.checkFFmpegAvailability();+ });+// Utility handlersipcMain.handle("cleanup-app", async (event) => {try {diff --git a/src/helpers/whisper.js b/src/helpers/whisper.jsindex 4c8528bdb..4aed071e3 100644--- a/src/helpers/whisper.js+++ b/src/helpers/whisper.js@@ -272,6 +272,59 @@ class WhisperManager {}}+ async checkFFmpegAvailability() {+ try {+ const pythonCmd = await this.findPythonExecutable();+ const whisperScriptPath = this.getWhisperScriptPath();++ const result = await new Promise((resolve) => {+ const checkProcess = spawn(pythonCmd, [+ whisperScriptPath,+ "--mode",+ "check-ffmpeg",+ ]);++ let output = "";+ let stderr = "";++ checkProcess.stdout.on("data", (data) => {+ output += data.toString();+ });++ checkProcess.stderr.on("data", (data) => {+ stderr += data.toString();+ });++ checkProcess.on("close", (code) => {+ if (code === 0) {+ try {+ const result = JSON.parse(output);+ resolve(result);+ } catch (parseError) {+ resolve({+ available: false,+ error: "Failed to parse FFmpeg check result",+ });+ }+ } else {+ resolve({+ available: false,+ error: stderr || "FFmpeg check failed",+ });+ }+ });++ checkProcess.on("error", (error) => {+ resolve({ available: false, error: error.message });+ });+ });++ return result;+ } catch (error) {+ return { available: false, error: error.message };+ }+ }+async installWhisper() {try {console.log("🔧 Starting automatic Whisper installation...");diff --git a/whisper_bridge.py b/whisper_bridge.pyindex 82418c27a..2dfc1b1b2 100755--- a/whisper_bridge.py+++ b/whisper_bridge.py@@ -16,6 +16,46 @@ import timeimport requestsimport gc+def get_ffmpeg_path():+ """Get path to bundled FFmpeg executable"""+ if getattr(sys, 'frozen', False):+ # Running in Electron app (packed)+ base_path = sys._MEIPASS+ else:+ # Running in development+ base_path = os.path.dirname(os.path.abspath(__file__))++ # Platform-specific FFmpeg paths+ if sys.platform == "darwin": # macOS+ ffmpeg_path = os.path.join(base_path, "..", "node_modules", "ffmpeg-static", "ffmpeg")+ elif sys.platform == "win32": # Windows+ ffmpeg_path = os.path.join(base_path, "..", "node_modules", "ffmpeg-static", "ffmpeg.exe")+ else: # Linux+ ffmpeg_path = os.path.join(base_path, "..", "node_modules", "ffmpeg-static", "ffmpeg")++ # Make sure the path exists+ if os.path.exists(ffmpeg_path):+ return ffmpeg_path++ # Fallback: try to find system FFmpeg+ import subprocess+ try:+ result = subprocess.run(['which', 'ffmpeg'], capture_output=True, text=True)+ if result.returncode == 0:+ return result.stdout.strip()+ except:+ pass++ return None++# Set FFmpeg path for Whisper+ffmpeg_path = get_ffmpeg_path()+if ffmpeg_path:+ os.environ["FFMPEG_BINARY"] = ffmpeg_path+ print(f"Using FFmpeg at: {ffmpeg_path}", file=sys.stderr)+else:+ print("Warning: FFmpeg not found, Whisper may not work properly", file=sys.stderr)+# Global model cache to avoid reloading_model_cache = {}@@ -328,10 +368,50 @@ def transcribe_audio(audio_path, model_name="base", language=None):"success": False}+def check_ffmpeg():+ """Check if FFmpeg is available and working"""+ try:+ # Test FFmpeg by trying to get its version+ import subprocess+ result = subprocess.run([ffmpeg_path or "ffmpeg", "-version"],+ capture_output=True, text=True, timeout=10)++ if result.returncode == 0:+ return {+ "available": True,+ "path": ffmpeg_path or "ffmpeg",+ "version": result.stdout.split('\n')[0] if result.stdout else "Unknown",+ "success": True+ }+ else:+ return {+ "available": False,+ "error": f"FFmpeg returned code {result.returncode}",+ "success": False+ }+ except subprocess.TimeoutExpired:+ return {+ "available": False,+ "error": "FFmpeg check timed out",+ "success": False+ }+ except FileNotFoundError:+ return {+ "available": False,+ "error": "FFmpeg not found in PATH",+ "success": False+ }+ except Exception as e:+ return {+ "available": False,+ "error": str(e),+ "success": False+ }+def main():parser = argparse.ArgumentParser(description="Whisper Bridge for OpenWispr")parser.add_argument("--mode", default="transcribe",- choices=["transcribe", "download", "check", "list", "delete"],+ choices=["transcribe", "download", "check", "list", "delete", "check-ffmpeg"],help="Operation mode (default: transcribe)")parser.add_argument("audio_file", nargs="?", help="Path to audio file to transcribe")parser.add_argument("--model", default="base",@@ -361,6 +441,10 @@ def main():result = delete_model(args.model)print(json.dumps(result))return+ elif args.mode == "check-ffmpeg":+ result = check_ffmpeg()+ print(json.dumps(result))+ returnelif args.mode == "transcribe":# Check if audio file existsif not args.audio_file: