Skip to content

HomeKit Camera 2 Way Audio #579

Open

Description

@seydx

Hey, my HomeKit camera "Eve Outdoor Cam" runs great with go2RTC! Thanks for the great software.

What I'm wondering now is, is it somehow possible to get "Two Way Audio" working? Since it's a pure HomeKit camera and works without a third party app, I can't say how the Two Way Audio comes about.

Do you know of any way to figure it out?

Info

{
  "producers": [
    {
      "type": "HomeKit active producer",
      "url": "homekit://192.168.178.72:62856?device_id=XXX\u0026device_public=XXX\u0026client_id=XXX\u0026client_private=XXX",
      "medias": [
        "video, recvonly, H264",
        "audio, recvonly, ELD/16000/1"
      ],
      "receivers": [
        "0 H264, bytes=2823676766, senders=3",
        "0 ELD/16000/1, bytes=30779465, senders=3"
      ],
      "recv": 2910946951
    },
    {
      "type": "RTSP passive producer",
      "url": "rtsp://127.0.0.1:8554/00fe64e283c8e733f5016ae5a80f5f3a",
      "remote_addr": "127.0.0.1:41504",
      "user_agent": "ffmpeg/go2rtc",
      "medias": [
        "audio, recvonly, OPUS/48000/2"
      ],
      "receivers": [
        "96 OPUS/48000/2, bytes=105212597, senders=1"
      ],
      "recv": 111628953
    }
  ],
  "consumers": [
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://192.168.178.133:8554/eingang_kamera?video=h264\u0026audio=opus",
      "remote_addr": "192.168.178.133:41090",
      "user_agent": "Lavf58.76.100",
      "medias": [
        "video, sendonly, H264",
        "audio, sendonly, OPUS"
      ],
      "senders": [
        "96 H264, bytes=6610917308, receivers=1",
        "97 OPUS/48000/2, bytes=246052797, receivers=1"
      ],
      "send": 6959575497
    },
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://127.0.0.1:8554/eingang_kamera?audio",
      "remote_addr": "127.0.0.1:39658",
      "user_agent": "go2rtc/ffmpeg",
      "medias": [
        "audio, sendonly, ANY"
      ],
      "senders": [
        "96 ELD/16000/1, bytes=30779465, receivers=1"
      ],
      "send": 36429929
    },
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://192.168.178.133:8554/eingang_kamera",
      "remote_addr": "192.168.178.133:39700",
      "user_agent": "Lavf60.3.100",
      "medias": [
        "audio, sendonly, ANY",
        "video, sendonly, ANY"
      ],
      "senders": [
        "96 ELD/16000/1, bytes=30773028, receivers=1",
        "97 H264, bytes=2822940869, receivers=1"
      ],
      "send": 2894787721
    },
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://192.168.178.133:8554/eingang_kamera",
      "remote_addr": "192.168.178.133:39702",
      "user_agent": "Lavf60.3.100",
      "medias": [
        "audio, sendonly, ANY",
        "video, sendonly, ANY"
      ],
      "senders": [
        "96 ELD/16000/1, bytes=30772579, receivers=1",
        "97 H264, bytes=2822922961, receivers=1"
      ],
      "send": 2894769028
    }
  ]
}

Config

streams:
  eingang_kamera:
    - homekit://192.168.178.72:51959?client_id=XXX&client_private=XXX_id=XXX&device_public=XXX
    - ffmpeg:eingang_kamera#audio=opus
  eingang_kamera2:
    - ffmpeg:rtsp://192.168.178.133:8554/eingang_kamera#audio=opus#input=vaapi_input#video=vaapi_h264_scale1280x720
  eingang_kamera3:
    - ffmpeg:rtsp://192.168.178.133:8554/eingang_kamera#audio=opus#input=vaapi_input#video=vaapi_h264_scale480x360
  
ffmpeg:
  vaapi_input: >-
    -hwaccel vaapi -hwaccel_output_format vaapi -fflags nobuffer -flags low_delay -i {input}
  vaapi_h264_scale480x360: >-
    -c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0
    -vf "format=vaapi|nv12,hwupload,scale_vaapi=w=480:h=360"
  vaapi_h264_scale1280x720: >-
    -c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0
    -vf "format=vaapi|nv12,hwupload,scale_vaapi=w=1280:h=720"

HomeKit

Management Interface #1:
	Streaming Status:
		STATUS: IN_USE
	Supported Video Stream Configuration:
		VIDEO_CODEC_CONFIGURATION:
			VIDEO_CODEC_TYPE: H264
			VIDEO_CODEC_PARAMETERS:
				PROFILE_ID: MAIN_PROFILE
				LEVEL: L_3_1
				LEVEL: L_4
				PACKETIZATION_MODE: NON_INTERLEAVED
				CVO_ENABLED: NON_INTERLEAVED
			VIDEO_ATTRIBUTES:
				IMAGE_WIDTH: 1920
				IMAGE_HEIGHT: 1080
				FRAME_RATE: 24
			VIDEO_ATTRIBUTES:
				IMAGE_WIDTH: 1280
				IMAGE_HEIGHT: 720
				FRAME_RATE: 24
			VIDEO_ATTRIBUTES:
				IMAGE_WIDTH: 320
				IMAGE_HEIGHT: 240
				FRAME_RATE: 24
	Supported Audio Stream Configuration:
		AUDIO_CODEC_CONFIGURATION:
			CODEC_TYPE: AAC_ELD
			AUDIO_CODEC_PARAMETERS:
				AUDIO_CHANNELS: 1
				BIT_RATE: VARIABLE
				SAMPLE_RATE: KHZ_16
		COMFORT_NOISE_SUPPORT: 0
	Supported RTP configuration:
		SRTP_CRYPTO_SUITE: AES_CM_128_HMAC_SHA1_80
		SRTP_CRYPTO_SUITE: AES_256_CM_HMAC_SHA1_80
		SRTP_CRYPTO_SUITE: DISABLED

Activity

  1. added
    kind/feature
    on Aug 22, 2023
  2. AlexxIT commented on Aug 22, 2023

    @AlexxIT
    Owner

    Two way for HomeKit source haven't supported yet.

  3. seydx commented on Aug 22, 2023

    @seydx
    ContributorAuthor

    Are there any plans to support HomeKit 2 Way Audio in the future?

    I think it would complete the HomeKit integration in go2RTC

  4. AlexxIT commented on Aug 22, 2023

    @AlexxIT
    Owner

    Maybe someday

  5. privatesam commented on Oct 25, 2023

    @privatesam

    This is the dream.

  6. topshelf510 commented on Feb 17, 2025

    @topshelf510

    Is there updates on this 😃?

  7. goetzc commented on Oct 27, 2026

    @goetzc

    Related to this, the upcoming Home Assistant Core version, 2026.11, will introduce native two-way camera audio as a Labs feature.

    https://contributors.home-assistant.io/blog/2026/10/24/camera-two-way-audio/

  8. topshelf510 commented on Nov 17, 2026

    @topshelf510

    Some findings in case they help: I got two-way talk working to HomeKit cameras (homekit:// source) on three Aqara camera hubs (2× G2H, 1× G2H Pro), from WebRTC clients (Home Assistant camera cards, Frigate's live view). Base was go2rtc 1.9.15 plus the producer backchannel from #2332 (written for the Aqara G4; it works the same on the G2H / G2H Pro).

    What the Aqara hubs accept

    Their SupportedAudioStreamConfiguration lists only AAC-ELD, 16 kHz, mono: no Opus, so #2551 doesn't cover them. Stock FFmpeg can't encode AAC-ELD; it needs a build with --enable-libfdk-aac --enable-nonfree. A static FFmpeg 8.0 with fdk-aac 2.0.3 on Alpine worked fine, used only for the talk audio:

    -c:a libfdk_aac -profile:a aac_eld -ar:a 16000 -ac:a 1 -frame_size 480 -b:a 24k
    

    Gotchas I hit

    1. can't find consumer on POST /api/streams?dst=<homekit stream> with wip: homekit backchannel working for aqara g4 #2332 as-is. Its extra backchannel codec is AAC/16000 with Channels: 1, but FFmpeg's RTSP SDP for mono AAC (MPEG4-GENERIC/16000/1) parses as Channels: 0, and Codec.Match needs equal counts or 0 on the consumer side. Leaving Channels unset on that codec fixed it. The test beeps then played on the hub speaker.
    2. AAC-ELD can't be written as ADTS (Transport library initialization error). Writing it straight to RTP (-f rtp) also needs -flags:a +global_header. Publishing to go2rtc with -f rtsp -rtsp_transport tcp works without it.
    3. The 30 ms RTP time for AAC-ELD from wip: homekit backchannel working for aqara g4 #2332 (instead of 20 ms) didn't affect receiving: recordings from the hubs still had normal audio.

    Live talk from WebRTC (Opus → AAC-ELD)

    go2rtc has no automatic transcoding on the backchannel, so I added a small source that offers an Opus speaker, talkback:<stream>. It's listed in the stream the clients play:

    • It pipes the browser's Opus (as Ogg) into the fdk FFmpeg.
    • That FFmpeg sends RTP (RFC 3640) to a local UDP socket.
    • The packets go into the already running HomeKit session of <stream> (AddTrack on the producer's sendonly media). So talk needs no extra hub connection, which matters since these hubs only have 2 stream slots.
    streams:
      aqara_cam: homekit://...
      aqara_cam_main:
        - ffmpeg:aqara_cam#video=copy#audio=aac
        - ffmpeg:aqara_cam#audio=opus
        - talkback:aqara_cam        # mic from WebRTC clients -> AAC-ELD -> hub speaker

    Home Assistant's advanced-camera-card and Frigate's live view both picked up the speaker on their own and talk was clear.

    I also left out #2332's switch to separate ephemeral SRTP ports per session. The G2H hubs worked fine on the shared :8443 server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions