mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-30 07:39:01 +03:00
Audio transcription support (#18398)
* install new packages for transcription support * add config options * audio maintainer modifications to support transcription * pass main config to audio process * embeddings support * api and transcription post processor * embeddings maintainer support for post processor * live audio transcription with sherpa and faster-whisper * update dispatcher with live transcription topic * frontend websocket * frontend live transcription * frontend changes for speech events * i18n changes * docs * mqtt docs * fix linter * use float16 and small model on gpu for real-time * fix return value and use requestor to embed description instead of passing embeddings * run real-time transcription in its own thread * tweaks * publish live transcriptions on their own topic instead of tracked_object_update * config validator and docs * clarify docs
This commit is contained in:
committed by
Blake Blackshear
parent
2385c403ee
commit
6dc36fcbb4
@@ -58,6 +58,7 @@ class Dispatcher:
|
||||
|
||||
self._camera_settings_handlers: dict[str, Callable] = {
|
||||
"audio": self._on_audio_command,
|
||||
"audio_transcription": self._on_audio_transcription_command,
|
||||
"detect": self._on_detect_command,
|
||||
"enabled": self._on_enabled_command,
|
||||
"improve_contrast": self._on_motion_improve_contrast_command,
|
||||
@@ -181,6 +182,9 @@ class Dispatcher:
|
||||
"snapshots": self.config.cameras[camera].snapshots.enabled,
|
||||
"record": self.config.cameras[camera].record.enabled,
|
||||
"audio": self.config.cameras[camera].audio.enabled,
|
||||
"audio_transcription": self.config.cameras[
|
||||
camera
|
||||
].audio_transcription.live_enabled,
|
||||
"notifications": self.config.cameras[camera].notifications.enabled,
|
||||
"notifications_suspended": int(
|
||||
self.web_push_client.suspended_cameras.get(camera, 0)
|
||||
@@ -465,6 +469,37 @@ class Dispatcher:
|
||||
)
|
||||
self.publish(f"{camera_name}/audio/state", payload, retain=True)
|
||||
|
||||
def _on_audio_transcription_command(self, camera_name: str, payload: str) -> None:
|
||||
"""Callback for live audio transcription topic."""
|
||||
audio_transcription_settings = self.config.cameras[
|
||||
camera_name
|
||||
].audio_transcription
|
||||
|
||||
if payload == "ON":
|
||||
if not self.config.cameras[
|
||||
camera_name
|
||||
].audio_transcription.enabled_in_config:
|
||||
logger.error(
|
||||
"Audio transcription must be enabled in the config to be turned on via MQTT."
|
||||
)
|
||||
return
|
||||
|
||||
if not audio_transcription_settings.live_enabled:
|
||||
logger.info(f"Turning on live audio transcription for {camera_name}")
|
||||
audio_transcription_settings.live_enabled = True
|
||||
elif payload == "OFF":
|
||||
if audio_transcription_settings.live_enabled:
|
||||
logger.info(f"Turning off live audio transcription for {camera_name}")
|
||||
audio_transcription_settings.live_enabled = False
|
||||
|
||||
self.config_updater.publish_update(
|
||||
CameraConfigUpdateTopic(
|
||||
CameraConfigUpdateEnum.audio_transcription, camera_name
|
||||
),
|
||||
audio_transcription_settings,
|
||||
)
|
||||
self.publish(f"{camera_name}/audio_transcription/state", payload, retain=True)
|
||||
|
||||
def _on_recordings_command(self, camera_name: str, payload: str) -> None:
|
||||
"""Callback for recordings topic."""
|
||||
record_settings = self.config.cameras[camera_name].record
|
||||
|
||||
@@ -18,6 +18,7 @@ class EmbeddingsRequestEnum(Enum):
|
||||
reprocess_face = "reprocess_face"
|
||||
reprocess_plate = "reprocess_plate"
|
||||
reindex = "reindex"
|
||||
transcribe_audio = "transcribe_audio"
|
||||
|
||||
|
||||
class EmbeddingsResponder:
|
||||
|
||||
Reference in New Issue
Block a user