WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

Two way audio

Open pergolafabio opened this issue 2 years ago • 61 comments

Hi @AlexxIT

Just a question, but is there a possibility to have two way audio enabled?

Thnx in advance

pergolafabio avatar Jan 21 '22 08:01 pergolafabio

I would definitely pay for that :)

danielducu avatar Jan 21 '22 13:01 danielducu

Yes, latest android app (beta) supports now microphone and speaker

pergolafabio avatar Jan 21 '22 13:01 pergolafabio

Technically this *may" be feasible, but it would likely depend on the method of backend audio. Either ONVIF 2-way would be assumed, or something like SIP would have to be used. Currently Home assistant is not aware of the audio sink, so it would have to be configured entirely in the component.

rbray89 avatar Jan 26 '22 14:01 rbray89

Mine cameras are based on ISAPI, to start twoway audio, i need to send 2 commands (no onvif) Synology is also using the same method for my hikvision door camera

would be a great feature, so we can chat with the HA app :-)

pergolafabio avatar Jan 26 '22 14:01 pergolafabio

WebRTC is also limited in supported codecs, which is why audio on some cameras doesn't work. This won't be an easy change to get it to work on devices that support 2way audio.

rbray89 avatar Jan 26 '22 17:01 rbray89

Is it worth a try? Would be great!! Mine audio codec is ulaw, it's the default audio protocol, most common used... One way audio already works now with current card... But I have no idea how to enable the mic :-) and to send the ISAPi command from the card to active it on the stream...

pergolafabio avatar Jan 26 '22 17:01 pergolafabio

I have a trace how Synology is doing it, they just send 2 command to active the two-way audio

pergolafabio avatar Jan 26 '22 17:01 pergolafabio

RTSP is spec for camera stream translation. There is no spec for two way audio. Each company use their own tech. Usual it's some kind of P2P.

AlexxIT avatar Feb 06 '22 16:02 AlexxIT

yeah, mine does work with sending 2 commands, do you think its easy to integrate?

pergolafabio avatar Feb 06 '22 16:02 pergolafabio

@danielducu I don't think you understand the difficulty here.

  1. vendors all do this differently, and it's not documented, so everything has to be reverse engineered.

  2. webRTC only uses a few different audio codecs, so they'd almost certainly have to transcode things on the server.

rbray89 avatar Feb 06 '22 21:02 rbray89

If we rely on standards-based cameras, it could work though.

ONVIF Profile T: Chapter 8.12 Audio Output streaming: https://www.onvif.org/wp-content/uploads/2018/09/ONVIF_Profile_T_Specification_v1-0.pdf More practical details: https://www.happytimesoft.com/knowledge/audio-back-channel.html So basically a third stream towards the camera (besides video and audio from camera) is negotiated in the SDP of the server. The audio out stream then just flows in the opposite direction of the other two RTP streams (sendonly vs. recvonly).

Video doorbell cameras mostly rely on two-way audio negotiated via SIP. It did a PoC implemenation for Homebridge here: https://github.com/Sunoo/homebridge-camera-ffmpeg/pull/1253 Ok, this is not related to WebRTC directly.

Solutions for propriertary vendor solutions could be doable. Example neolink for Reolink cameras: https://github.com/thirtythreeforty/neolink/issues/268

Concerning ISAPI I only found this: https://www.hikvision.com/content/dam/hikvision/vn/webinar/Thang3_Hikvision_Tich_Hop_He_Thong_Overview-of-3rd-Party-Integration.pdf

nanosonde avatar May 09 '22 09:05 nanosonde

I have the Hikvision, and also all ISAPI documentations, so if i can help i also know the ISAPI urls that should be used to activcate twoway audio

pergolafabio avatar May 09 '22 12:05 pergolafabio

The Amcrest AD410 Doorbell supports ONVIF Profile T for 2-way audio.

The Dahua integration for Home Assistant hasn't been able to get it working yet but the dream would be WebRTC with 2 way audio, could finally get rid of the garbage Amcrest app

mattkerrison avatar Jul 19 '22 05:07 mattkerrison

Do you know software for any OS, that can use ONVIF Profile T for 2 way audio connection?

AlexxIT avatar Jul 22 '22 16:07 AlexxIT

@AlexxIT tinyCam on Android can do 2 way audio with these settings:

WhatsApp Image 2022-07-22 at 5 14 37 PM

I found this out via Reddit: https://www.reddit.com/r/BlueIris/comments/lpkt8z/achieved_local_doorbell_with_2_way_audio/

conorlap avatar Jul 22 '22 16:07 conorlap

Seems like support backchannel in RTSP is not a big problem. Now I need to find some chip camera with this function in a local store.

AlexxIT avatar Jul 22 '22 17:07 AlexxIT

I'm wrote little app for test camera answer about backchannel. Can you test it? https://github.com/AlexxIT/rtsplog

AlexxIT avatar Jul 22 '22 19:07 AlexxIT

That's a test for onvif? I have some foscam C1 cameras that have two way audio, maybe I can test too

pergolafabio avatar Jul 22 '22 19:07 pergolafabio

That test for any RTSP camera with 2 way audio. I'm already tested Sonoff camera and one Hikvision doorbell without success about backchannel in answer.

AlexxIT avatar Jul 22 '22 20:07 AlexxIT

Indeed ,I have hikvision too, for hikvision you need to send an ISAPI command to activate two way audio, I have the commands , also a wireshark trace from my Synology surveillance centre, where two-way audio is supported

pergolafabio avatar Jul 22 '22 20:07 pergolafabio

As I can see in this document - application just need to send right header with RTSP request. Can you see it in trace?

AlexxIT avatar Jul 22 '22 20:07 AlexxIT

No , Synology uses ISAPI on hikvision doorbell cameras , not rtsp , also onvif not supported, it's not the correct profile... I also have foscam cameras, I can test later your tool

pergolafabio avatar Jul 22 '22 20:07 pergolafabio

I'm wrote little app for test camera answer about backchannel. Can you test it?

https://github.com/AlexxIT/rtsplog

Will try tomorrow when I have access to the AD410 camera

mattkerrison avatar Jul 23 '22 02:07 mattkerrison

Hey @AlexxIT , these 2 commands are fired with digest auth, thats what happens when i press the MIC button on the synology software....

image

pergolafabio avatar Jul 23 '22 11:07 pergolafabio

I'm wrote little app for test camera answer about backchannel. Can you test it? https://github.com/AlexxIT/rtsplog

I can test in the next day or two, how do I execute the rtsplog_amd64 file on Debian?

conorlap avatar Jul 23 '22 12:07 conorlap

@pergolafabio For now I don't have time for support some proprietary technology.

RTSP backchannel looks like nice standard. Which are not hard to support. But I can't find any cameras that support it yet.

AlexxIT avatar Jul 24 '22 04:07 AlexxIT

@pergolafabio For now I don't have time for support some proprietary technology.

RTSP backchannel looks like nice standard. Which are not hard to support. But I can't find any cameras that support it yet.

Ok, np...

And what about onvif?

pergolafabio avatar Jul 24 '22 06:07 pergolafabio

As I can understand, ONVIF just helps application to get right RTSP link. Plus some PTZ commands. I could be wrong.

AlexxIT avatar Jul 24 '22 07:07 AlexxIT

ah, i dont know, thats the first time i hear about it i always tought onvif T was needed => https://www.onvif.org/profiles/profile-t/

my hikvision supports twoway audio (isapi); but the profile is a S variant => no audio

my foscam do support T profile, also works in the Tinycam App, i can press MIC button there

pergolafabio avatar Jul 24 '22 07:07 pergolafabio

@pergolafabio you can try wireshark TiniCam app with FosCam

AlexxIT avatar Jul 24 '22 11:07 AlexxIT