The Issue
I am trying to achieve two-way audio (talkback) with my Dahua camera using go2rtc and WebRTC. The video and audio from the camera stream to the browser just fine. However, when I try to send audio from the browser/client back to the camera, there is no sound output from the camera speaker. The stream appears to be received, but nothing is played.
Questions
Thanks in advance for any help or advice!

Safety Setting:

Go2rtc setting:
streams:
dahua: - rtsp:/username:password@192.168.31.100:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif

{
"producers": [
{
"id": 2,
"format_name": "rtsp",
"protocol": "rtsp+tcp",
"remote_addr": "192.168.31.100:554",
"url": "rtsp:/username:password@192.168.31.100:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif",
"sdp": "v=0\r\no=- 2229913047 2229913047 IN IP4 0.0.0.0\r\ns=Media Server\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\na=control:*\r\na=range:npt=now-\r\na=x-summary:Oversea\r\nm=video 0 RTP/AVP 96\r\na=control:trackID=0\r\na=framerate:25.000000\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1;profile-level-id=4D0028;sprop-parameter-sets=Z00AKOkA8ARPywgAAB9IAAYcECAA,aOqMbIAA\r\na=recvonly\r\nm=audio 0 RTP/AVP 8\r\na=control:trackID=1\r\na=rtpmap:8 PCMA/8000\r\na=recvonly\r\nm=application 0 RTP/AVP 107\r\na=control:trackID=4\r\na=rtpmap:107 vnd.onvif.metadata/90000\r\na=recvonly\r\n",
"user_agent": "go2rtc/1.9.6",
"medias": [
"video, recvonly, H264",
"audio, recvonly, PCMA/8000",
"application, recvonly, VND.ONVIF.METADATA"
],
"receivers": [
{
"id": 3,
"codec": {
"codec_name": "h264",
"codec_type": "video",
"level": 40,
"profile": "Main"
},
"childs": [
4
],
"bytes": 622495,
"packets": 1177
},
{
"id": 5,
"codec": {
"codec_name": "pcm_alaw",
"codec_type": "audio",
"sample_rate": 8000
},
"childs": [
6
],
"bytes": 264320,
"packets": 826
}
],
"bytes_recv": 910939
}
],
"consumers": [
{
"id": 1,
"format_name": "webrtc",
"protocol": "ws+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp",
"remote_addr": "[fd7a:115c:a1e0::f01:c77b]:39838 host",
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
"medias": [
"video, sendonly, VP8, VP9, H264, AV1",
"audio, recvonly, OPUS/48000/2, G722/8000, PCMU/8000, PCMA/8000",
"audio, sendonly, OPUS/48000/2, G722/8000, PCMU/8000, PCMA/8000, L16, PCML"
],
"receivers": [
{
"id": 7,
"codec": {
"channels": 2,
"codec_name": "opus",
"codec_type": "audio",
"sample_rate": 48000
},
"bytes": 128032,
"packets": 1651
}
],
"senders": [
{
"id": 4,
"codec": {
"codec_name": "h264",
"codec_type": "video"
},
"parent": 3,
"bytes": 622495,
"packets": 1177
},
{
"id": 6,
"codec": {
"codec_name": "pcm_alaw",
"codec_type": "audio",
"sample_rate": 8000
},
"parent": 5,
"bytes": 264320,
"packets": 826
}
],
"bytes_recv": 162312,
"bytes_send": 904922
}
]
}
I am trying to achieve two-way audio (talkback) with my Dahua camera using go2rtc and WebRTC. The video and audio from the camera stream to the browser just fine. However, when I try to send audio from the browser/client back to the camera, there is no sound output from the camera speaker. The stream appears to be received, but nothing is played.
Questions
- Has anyone managed to get two-way audio working with Dahua cameras using go2rtc and WebRTC?
- Are there any special settings, protocols, or stream configurations required for the camera to play back audio sent from the client?
- Is there a specific audio codec or SDP tweak needed for talkback to work?
- Any troubleshooting tips or working examples would be greatly appreciated!
Thanks in advance for any help or advice!
Device Information
- Device Type: DH-P5AE-PV
- System Version: V2.820.100Z000.0.R (Build Date: 2024-04-22)
- WEB Version: V3.2.1.1786524
- ONVIF Version: 22.12 (V2.0.1.0)
- Security Baseline Version: V2.4

Safety Setting:

Go2rtc setting:
streams:
dahua: - rtsp:/username:password@192.168.31.100:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif

- go2rtc is used to bridge the RTSP stream to WebRTC.
- WebRTC client connects and receives both video and audio tracks.
Stream
Here is the JSON output from my /api/streams?src=dahua endpoint:{
"producers": [
{
"id": 2,
"format_name": "rtsp",
"protocol": "rtsp+tcp",
"remote_addr": "192.168.31.100:554",
"url": "rtsp:/username:password@192.168.31.100:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif",
"sdp": "v=0\r\no=- 2229913047 2229913047 IN IP4 0.0.0.0\r\ns=Media Server\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\na=control:*\r\na=range:npt=now-\r\na=x-summary:Oversea\r\nm=video 0 RTP/AVP 96\r\na=control:trackID=0\r\na=framerate:25.000000\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1;profile-level-id=4D0028;sprop-parameter-sets=Z00AKOkA8ARPywgAAB9IAAYcECAA,aOqMbIAA\r\na=recvonly\r\nm=audio 0 RTP/AVP 8\r\na=control:trackID=1\r\na=rtpmap:8 PCMA/8000\r\na=recvonly\r\nm=application 0 RTP/AVP 107\r\na=control:trackID=4\r\na=rtpmap:107 vnd.onvif.metadata/90000\r\na=recvonly\r\n",
"user_agent": "go2rtc/1.9.6",
"medias": [
"video, recvonly, H264",
"audio, recvonly, PCMA/8000",
"application, recvonly, VND.ONVIF.METADATA"
],
"receivers": [
{
"id": 3,
"codec": {
"codec_name": "h264",
"codec_type": "video",
"level": 40,
"profile": "Main"
},
"childs": [
4
],
"bytes": 622495,
"packets": 1177
},
{
"id": 5,
"codec": {
"codec_name": "pcm_alaw",
"codec_type": "audio",
"sample_rate": 8000
},
"childs": [
6
],
"bytes": 264320,
"packets": 826
}
],
"bytes_recv": 910939
}
],
"consumers": [
{
"id": 1,
"format_name": "webrtc",
"protocol": "ws+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp+udp",
"remote_addr": "[fd7a:115c:a1e0::f01:c77b]:39838 host",
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
"medias": [
"video, sendonly, VP8, VP9, H264, AV1",
"audio, recvonly, OPUS/48000/2, G722/8000, PCMU/8000, PCMA/8000",
"audio, sendonly, OPUS/48000/2, G722/8000, PCMU/8000, PCMA/8000, L16, PCML"
],
"receivers": [
{
"id": 7,
"codec": {
"channels": 2,
"codec_name": "opus",
"codec_type": "audio",
"sample_rate": 48000
},
"bytes": 128032,
"packets": 1651
}
],
"senders": [
{
"id": 4,
"codec": {
"codec_name": "h264",
"codec_type": "video"
},
"parent": 3,
"bytes": 622495,
"packets": 1177
},
{
"id": 6,
"codec": {
"codec_name": "pcm_alaw",
"codec_type": "audio",
"sample_rate": 8000
},
"parent": 5,
"bytes": 264320,
"packets": 826
}
],
"bytes_recv": 162312,
"bytes_send": 904922
}
]
}