Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to configure two-way audio on Dahua C4KP-P camera #1569

Open
alexanderek opened this issue Jan 25, 2025 · 3 comments
Open

Unable to configure two-way audio on Dahua C4KP-P camera #1569

alexanderek opened this issue Jan 25, 2025 · 3 comments
Labels
question Further information is requested

Comments

@alexanderek
Copy link

Hi,

I am trying to configure two-way audio on a Dahua C4KP-P camera, but it is not working as expected.

 streams:
    #(Dahua C4KP-P)
    kidsroom:
      - rtsp://[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
      - rtsp://[email protected]/cam/realmonitor?channel=1&subtype=0#backchannel=0
      - ffmpeg:kidsroom#audio=opus
    kidsroom_sub:
      - rtsp://[email protected]/cam/realmonitor?channel=1&subtype=1  

The microphone becomes available in the interface, but attempting to activate it results in errors.

2025-01-24 13:52:16.785 DBG [rtsp] new consumer stream=kidsroom
2025-01-24 13:52:29.307 DBG [rtsp] handle error=EOF
2025-01-24 13:52:32.263 INF [streams] can't add track error=EOF
2025-01-24 14:10:51.090 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="start from CONN state" url=rtsp://frigate:[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif

If the stream order is changed to the following:

kidsroom:
    - rtsp://[email protected]/cam/realmonitor?channel=1&subtype=0#backchannel=0
    - rtsp://[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
    - ffmpeg:kidsroom#audio=opus

the microphone icon disappears completely from the interface.

Could you help identify what might be wrong with this configuration?

I've also left a little more information here on this issue:

@AlexxIT AlexxIT added the question Further information is requested label Jan 26, 2025
@AlexxIT
Copy link
Owner

AlexxIT commented Jan 26, 2025

I don't see in your stream info from other issue, that your camera supports two way audio.

@alexanderek
Copy link
Author

@AlexxIT

If the configuration looks like this:

    kidsroom:
      - rtsp://frigate:[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif 
      - rtsp://frigate:[email protected]/cam/realmonitor?channel=1&subtype=0#backchannel=0  
      - ffmpeg:kidsroom#audio=opus

The microphone button appears in the interface, but when activated, nothing happens, and the following errors occur (as I mentioned earlier).

{
  "producers": [
    {
      "type": "RTSP active producer",
      "url": "rtsp://10.4.6.21/cam/realmonitor?channel=1\u0026subtype=0\u0026unicast=true\u0026proto=Onvif/",
      "remote_addr": "10.4.6.21:554",
      "user_agent": "go2rtc/1.9.2",
      "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=4D0032;sprop-parameter-sets=Z00AMukAUAFrQgAAAwACAAADAGUIAA==,aOqMbIAA\r\na=recvonly\r\nm=audio 0 RTP/AVP 97\r\na=control:trackID=1\r\na=rtpmap:97 MPEG4-GENERIC/16000\r\na=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408\r\na=recvonly\r\nm=audio 0 RTP/AVP 97 100 8 101 0 102 103 104\r\na=control:trackID=5\r\na=rtpmap:97 L16/8000\r\na=rtpmap:100 L16/16000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:101 PCMA/16000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:102 PCMU/16000\r\na=rtpmap:103 MPEG4-GENERIC/8000\r\na=rtpmap:104 MPEG4-GENERIC/16000\r\na=sendonly\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",
      "medias": [
        "video, recvonly, H.264 Main 5.0",
        "audio, recvonly, MPEG4-GENERIC/16000",
        "audio, sendonly, L16/8000, L16/16000, PCMA/8000, PCMA/16000, PCMU/8000, PCMU/16000, MPEG4-GENERIC/8000, MPEG4-GENERIC/16000",
        "application, recvonly, VND.ONVIF.METADATA"
      ],
      "receivers": [
        "96 H264, bytes=8297890, senders=3",
        "97 MPEG4-GENERIC/16000, bytes=84539, senders=3"
      ],
      "senders": [
        "97 L16/8000, bytes=0, receivers=2"
      ],
      "recv": 8459425
    },
    {
      "type": "RTSP active producer",
      "url": "rtsp://10.4.6.21/cam/realmonitor?channel=1\u0026subtype=0/",
      "remote_addr": "10.4.6.21:554",
      "user_agent": "go2rtc/1.9.2",
      "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=packetization-supported:DH\r\na=rtppayload-supported:DH\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=4D0032;sprop-parameter-sets=Z00AMukAUAFrQgAAAwACAAADAGUIAA==,aOqMbIAA\r\na=recvonly\r\nm=audio 0 RTP/AVP 97\r\na=control:trackID=1\r\na=rtpmap:97 MPEG4-GENERIC/16000\r\na=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408\r\na=recvonly\r\n",
      "medias": [
        "video, recvonly, H.264 Main 5.0",
        "audio, recvonly, MPEG4-GENERIC/16000"
      ],
      "receivers": [
        "96 H264, bytes=0, senders=1",
        "97 MPEG4-GENERIC/16000, bytes=0, senders=1"
      ]
    },
    {
      "type": "RTSP passive producer",
      "url": "rtsp://127.0.0.1:8554/84ae10ae2bc9c27d5db16d50b7eb6e83",
      "remote_addr": "127.0.0.1:43150",
      "user_agent": "ffmpeg/go2rtc",
      "sdp": "v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=go2rtc/1.9.2\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\na=tool:libavformat LIBAVFORMAT_VERSION\r\nm=audio 0 RTP/AVP 96\r\nb=AS:64\r\na=rtpmap:96 opus/48000/2\r\na=control:streamid=0\r\n",
      "medias": [
        "audio, recvonly, OPUS/48000/2"
      ],
      "receivers": [
        "96 OPUS/48000/2, bytes=123209, senders=2"
      ],
      "recv": 134137
    }
  ],
  "consumers": [
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://127.0.0.1:8554/kidsroom",
      "remote_addr": "127.0.0.1:35738",
      "user_agent": "FFmpeg Frigate/0.14.1-f4f3cfa",
      "sdp": "v=0\r\no=- 1 1 IN IP4 0.0.0.0\r\ns=go2rtc/1.9.2\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\nm=video 0 RTP/AVP 96\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1;profile-level-id=4D0032;sprop-parameter-sets=Z00AMukAUAFrQgAAAwACAAADAGUIAA==,aOqMbIAA\r\na=control:trackID=0\r\nm=audio 0 RTP/AVP 97\r\na=rtpmap:97 MPEG4-GENERIC/16000\r\na=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408\r\na=control:trackID=1\r\n",
      "medias": [
        "video, sendonly, H264, H265",
        "audio, sendonly, MPEG4-GENERIC"
      ],
      "senders": [
        "96 H264, bytes=16283374, receivers=1",
        "97 MPEG4-GENERIC/16000, bytes=161663, receivers=1"
      ],
      "send": 16645629
    },
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://127.0.0.1:8554/kidsroom?audio",
      "remote_addr": "127.0.0.1:43140",
      "user_agent": "go2rtc/ffmpeg",
      "sdp": "v=0\r\no=- 1 1 IN IP4 0.0.0.0\r\ns=go2rtc/1.9.2\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\nm=audio 0 RTP/AVP 96\r\na=rtpmap:96 MPEG4-GENERIC/16000\r\na=fmtp:96 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408\r\na=control:trackID=0\r\n",
      "medias": [
        "audio, sendonly, ANY"
      ],
      "senders": [
        "96 MPEG4-GENERIC/16000, bytes=106807, receivers=1"
      ],
      "send": 113591
    },
    {
      "type": "WebRTC/WebSocket async passive consumer",
      "remote_addr": "udp4 host 10.4.4.36:58821",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15",
      "medias": [
        "video, sendonly, H264, VP8, VP9",
        "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": [
        "8 PCMA/8000, bytes=170720, senders=0"
      ],
      "senders": [
        "96 H264, bytes=8297890, receivers=1",
        "111 OPUS/48000/2, bytes=85505, receivers=1"
      ],
      "recv": 192970,
      "send": 8480412
    },
    {
      "type": "probe",
      "remote_addr": "10.4.4.36, 172.18.0.3:51854",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15",
      "medias": [
        "video, sendonly, ALL",
        "audio, sendonly, ALL",
        "audio, recvonly, ANY"
      ],
      "receivers": [
        "0 ANY, bytes=0, senders=1"
      ],
      "senders": [
        "96 H264, bytes=0, receivers=1",
        "96 H264, bytes=0, receivers=1",
        "97 MPEG4-GENERIC/16000, bytes=0, receivers=1",
        "97 MPEG4-GENERIC/16000, bytes=0, receivers=1",
        "96 OPUS/48000/2, bytes=0, receivers=1"
      ]
    }
  ]
}

However, if the order of the configuration lines is changed like this:

    kidsroom:
      - rtsp: //frigate:[email protected]/cam/realmonitor?channel=1&subtype=0#backchannel=0  
      - rtsp: //frigate:[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif 
      - ffmpeg:kidsroom#audio=opus

The microphone button no longer appears in the interface.

{
  "producers": [
    {
      "type": "RTSP active producer",
      "url": "rtsp://10.4.6.21/cam/realmonitor?channel=1\u0026subtype=0/",
      "remote_addr": "10.4.6.21:554",
      "user_agent": "go2rtc/1.9.2",
      "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=packetization-supported:DH\r\na=rtppayload-supported:DH\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=4D0032;sprop-parameter-sets=Z00AMukAUAFrQgAAAwACAAADAGUIAA==,aOqMbIAA\r\na=recvonly\r\nm=audio 0 RTP/AVP 97\r\na=control:trackID=1\r\na=rtpmap:97 MPEG4-GENERIC/16000\r\na=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408\r\na=recvonly\r\n",
      "medias": [
        "video, recvonly, H.264 Main 5.0",
        "audio, recvonly, MPEG4-GENERIC/16000"
      ],
      "receivers": [
        "96 H264, bytes=27339654, senders=3",
        "97 MPEG4-GENERIC/16000, bytes=163354, senders=3"
      ],
      "recv": 27755960
    },
    {
      "type": "RTSP active producer",
      "url": "rtsp://10.4.6.21/cam/realmonitor?channel=1\u0026subtype=0\u0026unicast=true\u0026proto=Onvif/",
      "remote_addr": "10.4.6.21:554",
      "user_agent": "go2rtc/1.9.2",
      "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=4D0032;sprop-parameter-sets=Z00AMukAUAFrQgAAAwACAAADAGUIAA==,aOqMbIAA\r\na=recvonly\r\nm=audio 0 RTP/AVP 97\r\na=control:trackID=1\r\na=rtpmap:97 MPEG4-GENERIC/16000\r\na=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408\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",
      "medias": [
        "video, recvonly, H.264 Main 5.0",
        "audio, recvonly, MPEG4-GENERIC/16000",
        "application, recvonly, VND.ONVIF.METADATA"
      ],
      "receivers": [
        "96 H264, bytes=0, senders=1",
        "97 MPEG4-GENERIC/16000, bytes=0, senders=1"
      ]
    },
    {
      "type": "RTSP passive producer",
      "url": "rtsp://127.0.0.1:8554/84ae10ae2bc9c27d5db16d50b7eb6e83",
      "remote_addr": "127.0.0.1:38236",
      "user_agent": "ffmpeg/go2rtc",
      "sdp": "v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=go2rtc/1.9.2\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\na=tool:libavformat LIBAVFORMAT_VERSION\r\nm=audio 0 RTP/AVP 96\r\nb=AS:64\r\na=rtpmap:96 opus/48000/2\r\na=control:streamid=0\r\n",
      "medias": [
        "audio, recvonly, OPUS/48000/2"
      ],
      "receivers": [
        "96 OPUS/48000/2, bytes=185689, senders=2"
      ],
      "recv": 197549
    }
  ],
  "consumers": [
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://127.0.0.1:8554/kidsroom",
      "remote_addr": "127.0.0.1:42656",
      "user_agent": "FFmpeg Frigate/0.14.1-f4f3cfa",
      "sdp": "v=0\r\no=- 1 1 IN IP4 0.0.0.0\r\ns=go2rtc/1.9.2\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\nm=video 0 RTP/AVP 96\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1;profile-level-id=4D0032;sprop-parameter-sets=Z00AMukAUAFrQgAAAwACAAADAGUIAA==,aOqMbIAA\r\na=control:trackID=0\r\nm=audio 0 RTP/AVP 97\r\na=rtpmap:97 MPEG4-GENERIC/16000\r\na=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408\r\na=control:trackID=1\r\n",
      "medias": [
        "video, sendonly, H264, H265",
        "audio, sendonly, MPEG4-GENERIC"
      ],
      "senders": [
        "96 H264, bytes=27339654, receivers=1",
        "97 MPEG4-GENERIC/16000, bytes=163354, receivers=1"
      ],
      "send": 27840160
    },
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://127.0.0.1:8554/kidsroom?audio",
      "remote_addr": "127.0.0.1:38232",
      "user_agent": "go2rtc/ffmpeg",
      "sdp": "v=0\r\no=- 1 1 IN IP4 0.0.0.0\r\ns=go2rtc/1.9.2\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\nm=audio 0 RTP/AVP 96\r\na=rtpmap:96 MPEG4-GENERIC/16000\r\na=fmtp:96 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408\r\na=control:trackID=0\r\n",
      "medias": [
        "audio, sendonly, ANY"
      ],
      "senders": [
        "96 MPEG4-GENERIC/16000, bytes=46929, receivers=1"
      ],
      "send": 51841
    },
    {
      "type": "WebRTC/WebSocket async passive consumer",
      "remote_addr": "udp4 prflx 10.4.4.36:52218 related :0",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15",
      "medias": [
        "video, sendonly, H264, VP8, VP9",
        "audio, sendonly, OPUS/48000/2, G722/8000, PCMU/8000, PCMA/8000, L16, PCML"
      ],
      "senders": [
        "96 H264, bytes=8521267, receivers=1",
        "111 OPUS/48000/2, bytes=185689, receivers=1"
      ],
      "send": 8810356
    },
    {
      "type": "probe",
      "remote_addr": "10.4.4.36, 172.18.0.3:34122",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15",
      "medias": [
        "video, sendonly, ALL",
        "audio, sendonly, ALL",
        "audio, recvonly, ANY"
      ],
      "senders": [
        "96 H264, bytes=0, receivers=1",
        "96 H264, bytes=0, receivers=1",
        "97 MPEG4-GENERIC/16000, bytes=0, receivers=1",
        "97 MPEG4-GENERIC/16000, bytes=0, receivers=1",
        "96 OPUS/48000/2, bytes=0, receivers=1"
      ]
    }
  ]
}

Let me know if further details or clarifications are needed!

@AlexxIT
Copy link
Owner

AlexxIT commented Jan 26, 2025

You shouldn't add RTSP source two times.

Maybe it's a unique feature of your camera. Some Dahua cameras have glitchy two way support via RTSP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants