Enterprise-grade, real-time English-to-Multi-Language translation subtitles powered entirely by local AI.
PrivaSub is a high-performance, privacy-first Live Subtitle application. It captures system audio or microphone input, transcribes English in real-time, and translates it to your target language seamlessly (currently defaulting to Vietnamese, with planned UI support for selecting among 200+ languages). Designed for zero-latency rendering and zero-disk I/O, PrivaSub is optimized to run smoothly on consumer hardware (e.g., RTX 2060, Apple Silicon) without ever sending your data to the cloud.
No APIs, no cloud tracking, no subscriptions. Everything runs directly on your machine. Your audio and conversations never leave your device.
- In-Memory Pipeline: Audio streams are buffered directly into RAM (
io.BytesIO), bypassing disk I/O bottlenecks entirely. - Asynchronous Execution: GPU-intensive inference is handled on dedicated threads (
asyncio.to_thread), guaranteeing that the WebSocket server remains non-blocking and ultra-responsive. - Translation Caching: Integrates an LRU cache at the translation layer, serving repeated short phrases instantly (0ms) without hitting the GPU.
We've engineered the UI to match the smoothness of industry-leading captioning tools (like Apple Dictation or Google Meet):
- Live Box (Strict Append): The active typing area uses a strict Append-Only algorithm. This guarantees 0% layout jitter (no horizontal wiggling or slot-machine effects) by never manipulating previously rendered DOM nodes. Words flow in smoothly with a satisfying typing effect.
- History Box (100% Accuracy): Once a sentence is finalized via VAD, the perfectly corrected English and its translated counterpart glide gracefully into the History Box.
- DOM Virtualization: The frontend aggressively prunes old DOM nodes, ensuring the browser uses minimal memory even during multi-hour subtitle sessions.
Intelligently chunks audio streams locally in the browser when speech pauses (customizable silence thresholds), ensuring the AI models receive full sentence context for accurate translations.
- Backend: Python, FastAPI, Uvicorn, WebSockets.
- AI Models:
- STT:
faster-whisper(CTranslate2) - Translation:
facebook/nllb-200-distilled-600M(CTranslate2) - Capable of translating into 200+ languages.
- STT:
- Frontend: HTML5, Vanilla JS, Web Audio API, WebSockets.
- E2E Testing: Playwright (Python).
PrivaSub is designed for cross-platform local deployment (Windows CUDA & macOS CPU/MPS).
Clone the repository and install the required Python packages:
pip install -r requirements.txtDownload and convert the NLLB model into the highly optimized CTranslate2 format:
ct2-transformers-converter --model facebook/nllb-200-distilled-1.3B --output_dir nllb-200-distilled-1.3B-ct2 --quantization int8_float16(Note: You can swap 1.3B for 600M depending on your VRAM).
Launch the FastAPI backend:
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000- Open
http://localhost:8000in Google Chrome or Microsoft Edge. - Grant microphone permissions when prompted.
- Select your Audio Source (Microphone or Stereo Mix for system audio).
- Click Start Listening and begin speaking!
We provide a fully automated End-to-End (E2E) testing suite using Playwright. The suite simulates a real user by injecting audio directly into a virtual microphone and records the entire UI interaction.
Setup Playwright:
pip install playwright
playwright install chromiumRun the Test Suite: Ensure the FastAPI server is running, then execute:
python tests/test_ui.pyTest results, including UI screen recordings (.webm) and extracted transcriptions (transcription.txt), are automatically saved in the tests/results/ directory.
Built for performance. Built for privacy. Built for you.