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
3.81k stars 309 forks source link

Unifi 2-way audio #279

Open victor-perez opened 1 year ago

victor-perez commented 1 year ago

I'm trying to get the 2-way audio working on my Unifi doorbell while I can hear my voice on the streem it never comes out of the speaker of the doorbell. Did anybody manage to get 2-way audio working for Unifi?

AlexxIT commented 1 year ago

I have never heard that Unify uses open standards for two way audio.

nanosonde commented 1 year ago

Have a look here: https://github.com/hjdhjd/homebridge-unifi-protect/blob/c20ec04dd995dd989c5754955624c2979497555a/src/protect-stream.ts#L724

Basically it seems that they send AAC codec data in ADTS format via a websocket connection to play audio on the camera speaker.

https://wiki.multimedia.cx/index.php/ADTS

AlexxIT commented 1 year ago

AAC/ASTS is a problem. Browsers don't support receiving this codec from microphone. Maybe codec can be changed?

ab-tools commented 1 year ago

@victor-perez, did you, by chance, find a way to make this work?

As go2rtc does support FFmpeg as source I would expect that it is possible to make that work when the expected codec is known (which it is based on your link) and then transcode as needed.

But I'm afraid my experience with FFmpeg is to little to implement this myself.

scottt732 commented 9 months ago

AAC/ASTS is a problem. Browsers don't support receiving this codec from microphone. Maybe codec can be changed?

Just throwing this out there, but maybe wasm (ffmpeg) and/or WebCodecs API could be viable options? It looks like WebCodecs API is available in recent Chrome/Edge builds.

kksligh commented 7 months ago

interested in this as well - any config examples that work for anyone would be appreciated. I can't get anything to work.

scelfo commented 5 months ago

Could I help with this feature request somehow? I tried installing Scrypted and it is able to send two way audio from Chrome to a Unifi camera. I don't know whether it's doing server side transcoding or not.

I've been building out some nice HA dashboards with go2rtc and it would be awesome to have two way audio to my Unifi cameras via go2rtc.