225 Commits

Author SHA1 Message Date
cjones 955665401a Override get_segment_end() in ServeClientOpenVINO to match OpenVINO's WhisperDecodedResultChunk class. 2026-07-24 23:16:42 -04:00
cjones 17b1639a9b Get ready to add diarization to openvino backend. 2026-07-23 00:05:02 -04:00
Vineet Suryan 06ec02445d Merge pull request #480 from Kokkini/feature/streaming-transcription-client
Add StreamingTranscriptionClient for streaming from any source
2026-07-17 12:24:02 +02:00
Quang Tran ec1dc7c6aa fix: clean shutdown for StreamingTranscriptionClient 2026-07-08 23:13:20 +07:00
Quang Tran a71c578570 fix: address PR review comments on StreamingTranscriptionClient 2026-07-08 22:49:23 +07:00
Quang Tran f4f1b1d8be feat: support manual audio streaming from any source 2026-07-08 22:46:34 +07:00
nightcityblade 8c0caf1be0 fix: improve subtitle readability 2026-07-07 23:04:01 +08:00
Vineet Suryan d9459ebf2d Merge pull request #517 from dmaier-ef/fix/idle-transcription-thread-cpu-contention
Fix idle-client busy-wait before first audio frame
2026-07-06 11:37:35 +05:30
David Maier 5b577b34e4 Add configurable timeout for first-frame wait and improve thread-safety 2026-07-03 14:45:09 +02:00
Aaron Boxer 2debc0ee80 Make initial_prompt and vad_parameters accessible from the client
Expose initial_prompt and vad_parameters as flat client parameters
(consistent with hotwords, send_last_n_segments, etc.), send them as
flat handshake keys, and read them server-side with null-safe
options.get(...). Supersedes #283; avoids the options-bag None.get crash.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 11:36:26 -04:00
David Maier 056774ea50 Fix idle-client busy-wait before first audio frame 2026-06-26 14:57:03 +02:00
makaveli10 ac7a9f849c fix(batch): add temperature fallback to prevent decoder runaway
Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2026-06-23 10:52:02 -04:00
makaveli10 ecb052c873 Enable single-model mode for stock models when batch_inference is set
Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2026-06-23 10:52:02 -04:00
Aaron Boxer 44940e2834 Support known speaker hints in REST API 2026-06-14 12:17:44 -04:00
nightcityblade 32c1b18c9f fix: support uint8 websocket audio format 2026-06-04 16:04:38 -04:00
Vineet Suryan 582d5426d6 Bump version v0.9.0 2026-06-02 11:54:07 +05:30
Aaron Boxer 5334ea0f7a Add WebSocket authentication via api_key
- When --api_key is set, WebSocket connections require auth too
- Supports Authorization: Bearer <key> header or ?token=<key> query param
- Unauthenticated connections receive HTTP 401 before upgrade
- Uses websockets process_request callback (no resource allocation before auth)
- Added 5 unit tests for WebSocket auth handler
2026-05-26 23:07:50 -04:00
Aaron Boxer b648bcb2a4 Add optional API key auth and rate limiting for REST API
- api_key param: requires 'Authorization: Bearer <key>' header
- rate_limit_rpm param: per-IP sliding-window rate limit (requests/min)
- Both are off by default (backward compatible)
- CLI flags: --api_key, --rate_limit_rpm
- Added 5 unit tests for auth and rate limiting
2026-05-26 23:02:43 -04:00
Aaron Boxer c5ec7f4a99 Add reconnect logic to WebSocket client
- New params: max_retries (default 0), retry_delay (default 5s)
- On unexpected close, retries up to max_retries times
- Does not retry on server_error (server rejected connection)
- Extracted _create_websocket() helper for reuse
- Added 4 unit tests for reconnect behavior
2026-05-26 05:45:37 -04:00
Vineet Suryan 52005b94cb Merge pull request #443 from boxerab/configurable-constants
Extract hardcoded buffer constants into class attributes
2026-05-26 13:55:13 +05:30
Aaron Boxer 8396763444 fix: set proper mock_info attributes in SSE streaming tests
MagicMock auto-attributes are not JSON serializable. Set language,
language_probability, and duration explicitly. Also exclude metadata
events from segment count assertion.
2026-05-25 09:44:21 -04:00
Aaron Boxer 8ac98dceec feat: add SSE streaming for REST transcription endpoint
- stream=true now returns text/event-stream with per-segment SSE events
- Each segment yields 'data: {json}' followed by 'data: [DONE]'
- Error events streamed as 'data: {"error": ...}'
- Temp files cleaned up in finally block
- 5 new tests in test_server_extended.py (183 total passing)
2026-05-25 09:44:21 -04:00
Aaron Boxer c028c4b584 feat: add segment_post_processor hook for external plugins
Add a minimal, non-breaking hook to WhisperLive that allows external
projects to post-process transcription segments before they are sent
to the client.

Changes:
- ServeClientBase: add segment_post_processor attribute (default None)
- ServeClientBase.send_transcription_to_client: apply post_processor
  per-segment with error handling (falls back to original segment)
- TranscriptionServer: add segment_post_processor parameter to run()
  and wire it to each client on creation

This enables downstream projects to plug in custom processing
(e.g. formatting, PII redaction, diarization tagging) without
modifying WhisperLive core code.
2026-05-15 10:45:31 -04:00
Aaron Boxer 4e31f8c61b Add word-level timestamps and confidence scores
- New word_timestamps option (default False) in client handshake
- When enabled, each segment includes 'words' array with per-word
  start/end times and probability scores
- Wired through entire pipeline: client → server → backend → transcribe()
- Words include timestamp_offset for accurate absolute times
- REST API already supported word timestamps; now WebSocket does too
- Added 9 unit tests for word timestamp extraction and formatting
2026-05-15 10:35:27 -04:00
Aaron Boxer 18b897277f Add real-time speaker diarization support
- New whisper_live/diarization.py: SpeakerDiarizer with online clustering
- Uses pyannote.audio speaker embeddings (optional dependency)
- Cosine similarity threshold for speaker matching (default 0.55)
- Running average embedding update for speaker stability
- Configurable max_speakers limit (default 10)
- Client options: enable_diarization, max_speakers
- Segments include 'speaker' field when diarization is active
- Graceful fallback: logs warning if pyannote not installed
- Added 12 unit tests (mock-based, no GPU required)
2026-05-13 10:50:59 -04:00
Aaron Boxer ced4bdb737 feat: add Prometheus metrics instrumentation
- New whisper_live/metrics.py with Counter, Gauge, Histogram metrics
- Track connections (opened/closed/rejected), transcription latency,
  audio processed, segments emitted, REST requests, and errors
- All metric helpers are no-ops when prometheus_client not installed
- --metrics_port CLI flag to expose /metrics endpoint (0 = disabled)
- Metrics integrated into server.py, base.py at key instrumentation points
- 17 new tests in tests/test_metrics.py (178 total passing)
2026-05-13 10:45:40 -04:00
Aaron Boxer 4210697ca6 Add custom vocabulary / hotwords support 2026-05-13 10:32:28 -04:00
Aaron Boxer 445bf26e85 Extract hardcoded buffer constants into class attributes
- MAX_BUFFER_DURATION_S (45): max audio buffer before trimming
- BUFFER_TRIM_DURATION_S (30): duration to discard on trim
- CLIP_THRESHOLD_DURATION_S (25): stale audio clip threshold
- CLIP_TAIL_DURATION_S (5): audio tail to keep after clipping
- All values can now be overridden by subclasses
2026-05-11 20:05:38 -04:00
Aaron Boxer a6147a6745 Replace os.system() in clear_screen() with ANSI escape codes
- Eliminates shell injection risk from os.system('clear'/'cls')
- Uses ANSI escape sequence \033[H\033[2J instead
- Removed unused os import
- Added test verifying ANSI codes are used
2026-04-17 09:31:00 -04:00
Aaron Boxer 18bce1864a Validate server parameters on startup
- max_clients must be >= 1
- max_connection_time must be > 0
- batch_max_size must be >= 1 (when batch enabled)
- batch_window_ms must be >= 0 (when batch enabled)
- Added 5 new tests for parameter validation
2026-04-17 09:30:19 -04:00
Aaron Boxer 9e5e4a9970 Bound transcript memory and translation queue size
- Add MAX_TRANSCRIPT_LENGTH (500) and MAX_TRANSLATION_QUEUE_SIZE (100)
  class constants to ServeClientBase
- Trim transcript and text lists after each update_segments() call
- Create translation queue with maxsize to prevent unbounded growth
- Added tests for _trim_transcript()
2026-04-17 09:29:38 -04:00
Aaron Boxer 81cdbbca95 Add thread safety to ClientManager with threading.Lock
- All ClientManager methods (add_client, get_client, remove_client,
  get_wait_time, is_server_full, is_client_timeout) now protected by
  a threading.Lock
- cleanup() called outside the lock to avoid holding it during I/O
- is_server_full() computes wait time inline under lock instead of
  calling get_wait_time() to avoid nested lock acquisition
- Added concurrent thread safety tests for add/remove and get operations
2026-04-17 09:27:37 -04:00
Aaron Boxer f5340ddf1e audio: add support for raw pcm input via server flag
fixes #
2026-04-17 09:21:06 -04:00
Vineet Suryan 6de5c87d2f Bump version v0.8.0 2026-03-17 14:48:07 +05:30
makaveli10 5f0010d720 Expose __version__ in package root and update dependencies in setup.py
Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2026-03-17 13:34:34 +05:30
Vineet Suryan 6fcae6a30c Merge pull request #425 from nightcityblade/fix/issue-377
feat: make display_segments configurable in Client/TranscriptionClient
2026-03-16 10:34:29 +05:30
ianwh02 89466f7b77 Fix NoneType crash in _process_single when VAD filters all audio
When VAD removes all speech from an audio chunk, transcriber.transcribe() returns (None, info). Calling list(None) raises TypeError. The _process_multi path already handles this case; this aligns _process_single to match.
2026-03-11 16:48:23 +00:00
ianwh02 3508b39584 Fix missing batch_config init causing CI test hang 2026-03-09 11:42:15 +00:00
nightcityblade 067573a510 feat: make display_segments configurable in Client/TranscriptionClient
Replace hardcoded [-4:] truncation with a configurable display_segments
parameter (default: 4) in both Client and TranscriptionClient classes.

Fixes #377
2026-03-08 12:19:54 +08:00
ianwh02 e8bd4fd532 Add cross-client GPU batch inference for faster_whisper backend 2026-02-26 00:00:51 +00:00
Vineet Suryan e48d16f923 Merge pull request #398 from AlexStansfield/feature/faster-whisper-1.2.0
feat: update to support faster whisper 1.2.0
2026-02-11 17:57:05 +05:30
Jeny Sadadia 5e33aa2a7e Enable timestamps for transcripted text
Add `--enable-timestamps` option to `run_client.py`
script to print out transcripted text with timestamps.

Sample output with translation enabled:
```
[0.000 -> 7.440]  And so, my fellow Americans, ask not what your country can do for you.
[7.440 -> 10.300]  Ask what you can do for your country.

TRANSLATION to fr:
[0.000 -> 7.440] Et donc, mes camarades américains, ne demandez pas ce que votre pays peut faire pour vous.
[7.440 -> 10.300] Demandez ce que vous pouvez faire pour votre pays.
```

Signed-off-by: Jeny Sadadia <jeny.sadadia@collabora.com>
2026-02-10 15:43:20 +05:30
Aaron Boxer 29ee640409 api: add support OpenAI REST transcription api 2026-02-05 22:31:59 -05:00
makaveli10 f5256fc62f feat: support HuggingFace model IDs for faster_whisper_custom_model_path
Previously, the server only accepted local file paths for custom Faster Whisper
models. This change allows passing HuggingFace repo IDs which are automatically
downloaded and converted to CTranslate2 format by the backend if not already in
CTranslate2 format.

Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2026-01-13 16:34:04 +05:30
Alex Stansfield c43eb1dd5a update to support faster whisper 1.2.0 2025-10-07 14:20:20 +00:00
makaveli10 04db67170b ServeClientTranslation import only when enable_tranlsation is True
Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2025-07-22 15:47:06 +00:00
makaveli10 2b8b245fa8 Add translation backend
Translate from any language to any language with alirezamsh/small100
running in a thread and reading from a queue shared with transcription thread.

Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2025-07-22 08:54:10 +00:00
makaveli10 8d6ddd4f7b Change max_clients max_connection_time from server only
Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2025-07-21 22:52:24 +05:30
Kiran Lonikar 40edd25468 remove commented code 2025-07-12 22:29:30 +05:30
Kiran Lonikar e597c876cf changes to run when audio playback is muted 2025-07-07 13:21:20 +05:30