AlexxIT / StreamAssist

Home Assistant custom component that allows you to turn almost any camera and almost any speaker into a local voice assistant
MIT License
208 stars 19 forks source link

Wyoming-whisper errors and no timeout on STT error #4

Closed luzik closed 7 months ago

luzik commented 1 year ago

When using Wyoming-whisper docker image I've got this in logs, and STT sensor is 'processing' quite long (I believe it never ends)

wyoming-whisper           | ERROR:asyncio:Task exception was never retrieved
wyoming-whisper           | future: <Task finished name='Task-11' coro=<AsyncEventHandler.run() done, defined at /usr/local/lib/python3.9/dist-packages/wyoming/server.py:26> exception=ValueError("can't extend empty axis 0 using modes other than 'constant' or 'empty'")>
wyoming-whisper           | Traceback (most recent call last):
wyoming-whisper           |   File "/usr/local/lib/python3.9/dist-packages/wyoming/server.py", line 32, in run
wyoming-whisper           |     if not (await self.handle_event(event)):
wyoming-whisper           |   File "/usr/local/lib/python3.9/dist-packages/wyoming_faster_whisper/handler.py", line 61, in handle_event
wyoming-whisper           |     segments, _info = self.model.transcribe(
wyoming-whisper           |   File "/usr/local/lib/python3.9/dist-packages/wyoming_faster_whisper/faster_whisper/transcribe.py", line 124, in transcribe
wyoming-whisper           |     features = self.feature_extractor(audio)
wyoming-whisper           |   File "/usr/local/lib/python3.9/dist-packages/wyoming_faster_whisper/faster_whisper/feature_extractor.py", line 152, in __call__
wyoming-whisper           |     frames = self.fram_wave(waveform)
wyoming-whisper           |   File "/usr/local/lib/python3.9/dist-packages/wyoming_faster_whisper/faster_whisper/feature_extractor.py", line 98, in fram_wave
wyoming-whisper           |     frame = np.pad(frame, pad_width=padd_width, mode="reflect")
wyoming-whisper           |   File "<__array_function__ internals>", line 200, in pad
wyoming-whisper           |   File "/usr/local/lib/python3.9/dist-packages/numpy/lib/arraypad.py", line 815, in pad
wyoming-whisper           |     raise ValueError(
wyoming-whisper           | ValueError: can't extend empty axis 0 using modes other than 'constant' or 'empty'
AlexxIT commented 1 year ago

You can increase log level and check if I can catch any related message for this situation.

logger:
  default: warning
  logs:
    custom_components.stream_assist: debug
    homeassistant.components.assist_pipeline: debug
    homeassistant.components.wyoming: debug
luzik commented 1 year ago
homeassistant             | 2023-05-16 15:37:22.887 DEBUG (SyncWorker_10) [custom_components.stream_assist.core.stream] open: rtsp://admin:pass@ip:8554/tablet
homeassistant             | 2023-05-16 15:37:28.113 DEBUG (SyncWorker_14) [custom_components.stream_assist.core.stream] run
homeassistant             | 2023-05-16 15:37:28.115 DEBUG (MainThread) [custom_components.stream_assist.switch] pipeline event: PipelineEvent(type=<PipelineEventType.RUN_START: 'run-start'>, data={'pipeline': '01gzjkzknnz7r31x90cmkmyevw', 'language': 'pl'}, timestamp='2023-05-16T13:37:28.115196+00:00')
homeassistant             | 2023-05-16 15:37:28.115 DEBUG (MainThread) [custom_components.stream_assist.switch] pipeline event: PipelineEvent(type=<PipelineEventType.STT_START: 'stt-start'>, data={'engine': 'stt.faster_whisper', 'metadata': {'language': 'pl', 'format': <AudioFormats.WAV: 'wav'>, 'codec': <AudioCodecs.PCM: 'pcm'>, 'bit_rate': <AudioBitRates.BITRATE_16: 16>, 'sample_rate': <AudioSampleRates.SAMPLERATE_16000: 16000>, 'channel': <AudioChannels.CHANNEL_MONO: 1>}}, timestamp='2023-05-16T13:37:28.115433+00:00')
homeassistant             | 2023-05-16 15:37:33.143 ERROR (SyncWorker_14) [custom_components.stream_assist.core.stream] run
homeassistant             | Traceback (most recent call last):
homeassistant             |   File "/config/custom_components/stream_assist/core/stream.py", line 47, in run
homeassistant             |     frame = next(self.container.decode(audio=0))
homeassistant             |   File "av/container/input.pyx", line 202, in decode
homeassistant             |   File "av/container/input.pyx", line 162, in demux
homeassistant             |   File "av/container/core.pyx", line 292, in av.container.core.Container.err_check
homeassistant             |   File "av/error.pyx", line 336, in av.error.err_check
homeassistant             | av.error.OSError: [Errno 5] I/O error: 'rtsp://admin:pass@ip:8554/tablet'

And the source is frigate with:

  go2rtc:
    streams:
      tablet:
        - rtsp://admin:pass@IP:8080/h264_ulaw.sdp
        - "ffmpeg:tablet#audio=aac"
    rtsp:
      username: admin
      password: pass

Playing stream rtsp://admin:pass@ip:8554/tablet under vlc is ok

AlexxIT commented 1 year ago

There's a pretty clear error here. I/O error - ffmpeg (av) can't read data from camera. It can be network problem or camera rtsp problem.

AlexxIT commented 7 months ago

I don't think this can be fixed from integration. Just stream problem.