AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
6.95k stars 497 forks source link

RTSP/ Home Assistant Homekit - no audio #1401

Open haitham506 opened 1 month ago

haitham506 commented 1 month ago

Hello,

go2rtc config:

streams:
  Entrancego2rtc: ffmpeg:rtsp://user:psss@192.168.3.3/Preview_04_sub#video=copy#audio=opus

Home Assistant Homekit config:

homekit:
- name: Entrance Cam
  port: 21088
  mode: accessory
  filter:
    include_entities:
      - camera.entrance_sub
  entity_config:
    camera.entrance_sub:
      stream_source: rtsp://192.168.3.3:8554/Entrancego2rtc
      support_audio: True
      video_codec: copy
      audio_codec: copy
      linked_motion_sensor: binary_sensor.binary_sensor_entrance_person

Playing the camera on the browser or VLC works fine with audio. When playing the camera in Home app (AppleTV/iPad) there is no sound even though it is OPUS

But if I add the camera to Homekit through go2rtc directly the audio works fine

I want it this way to link the motion sensor to the camera for push notifications with thumbnail + if I add it to homekit through HA without go2rtc the audio will be Choppy because of the transcoding aac to opus

What is the issue here?

Thank you :)

AlexxIT commented 1 month ago

Probably Hass doesn't support OPUS audio for HomeKit

haitham506 commented 1 month ago

But it says here that it does

audio_codec string (Optional, default: libopus)

Only for camera entities. FFmpeg audio codec for transcoding. copy option reduces CPU load when audio source is already encoded with libopus.

https://www.home-assistant.io/integrations/homekit/#audio_codec

Doesn't that mean that it does support it?

Thank you for replying

AlexxIT commented 1 month ago

You can check Hass project issues. It has problems with OPUS codec. Because HomeKit uses non standard OPUS implementation. You can't copy it. You can't use FFmpeg for it.