dvrip source - two way audio doesn't work on some firmwares
Hello, read all issues for dvrip and only after that order xmeye cam and try to use dvrip cam with 2way audio, but no success. Anyone can help me?
First of all I check 2way audio with xmeye app in my phone, all works as it shoud.
My config:
- Disable smart codec and enble x265 codec in cam settings
- Edit go2rtc.yaml
streams:
xm_two_way_audio:
- dvrip://admin:[email protected]:34567?channel=0&subtype=0
- dvrip://admin:[email protected]:34567?backchannel=1
- Go to chrome://flags and enable "Insecure origins treated as secure" with http://go2rtc_ip_adress:1984
- Then try to send audio file to my cam, I hear quiet click in cam speaker and after that no soun.
- Go to stream "links" page and choose "video+audio+microphone = two way audio from camera", then click on [webrtc.html] local WebRTC viewer. After 2-3 sec I see video stream and hear sounds from camera, try to speak to pc mic but I can't hear my voice in cam speeker. Check microphone in chrome and see that mic is in use.
- OK, go to info page and see that receivers and senders seems ok, and there are no errors in log
{
"producers": [
{
"type": "DVRIP active producer",
"medias": [
"video, recvonly, H.264 Main 3.0",
"audio, recvonly, PCMA/8000"
],
"receivers": [
"255 H264, bytes=106578, senders=1",
"0 PCMA/8000, bytes=34560, senders=1"
]
},
{
"type": "DVRIP active consumer",
"medias": [
"audio, sendonly, PCMA/8000, PCMU/8000"
],
"senders": [
"8 PCMA/8000, bytes=22240, receivers=1"
]
}
],
"consumers": [
{
"type": "WebRTC/WebSocket async passive consumer",
"remote_addr": "udp4 host 192.168.24.20:54115",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; Chromium GOST) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
"medias": [
"video, sendonly, VP8, RTX, VP9, H264, AV1, RED, ULPFEC, FLEXFEC-03",
"audio, recvonly, OPUS/48000/2, RED/48000/2, G722/8000, PCMU/8000, PCMA/8000, CN/8000, TELEPHONE-EVENT/48000, TELEPHONE-EVENT/8000",
"audio, sendonly, OPUS/48000/2, RED/48000/2, G722/8000, PCMU/8000, PCMA/8000, CN/8000, TELEPHONE-EVENT/48000, TELEPHONE-EVENT/8000, L16, PCML"
],
"receivers": [
"8 PCMA/8000, bytes=22240, senders=1"
],
"senders": [
"102 H264, bytes=106578, receivers=1",
"8 PCMA/8000, bytes=34560, receivers=1"
],
"recv": 25020,
"send": 142270
}
]
}
- After that close go2rtc server and try to use native xmeye app to check 2way audio, but ther is no any sound from cam speaker
- Reboot cam and check once more, after that 2way audio with xmeye work
It's hard to say. Looks like your config and info are OK. Maybe the camera firmware have some other implementation two ways. If you know how to take a tcpdump from mobile app, I could analyse it.
Thanks for your reply, I havnt android devices with root to make dump from Xmeye app, but I can install android in proxmox as virtual pc and make dump from it. I made dump from camera web intraface in chrome (there is button to talk in live view), but as I see it use some web components to work (VideoPlayTool). chrome_cam_webint_activate_talk.zip
Wireshark filter: tcp.stream eq 7.
> { "Name" : "OPTalk", "OPTalk" : { "Action" : "Claim", "AudioFormat" : { "BitRate" : 128, "EncodeType" : "G711_ALAW", "SampleBit" : 8, "SampleRate" : 8000 }, "Channel" : 0 }, "SessionID" : "0x8" }
< { "Name" : "OPTalk", "Ret" : 100, "SessionID" : "0x00000008" }
I don't know. Maybe whole JSON important. Can you make your own changes to the go program?
https://github.com/AlexxIT/go2rtc/blob/75020d4df7bc8293ef6c9633a76cbc3171530f38/pkg/dvrip/client.go#L116-L130
Also I can't see Start command in your dump, but go app has it.
I don't have any DVRIP cameras. So can't check by myself.
Sorry, but I don't have programming skills to make changes, I can make port forwarding to mycam (white IP port 34567), maybe this can help. I can try installing older firmware to check if there is any differences I made dump from Xmeye android app, and cant see Start command in it. emule_xmeye_talk.zip
I did some research with tcpdumps and my dvrip cams and recorders, as I understand there are 2 talk format in dvrip devices:
- Old format.
OpTalk Claim - ret, Optalk Start - ret, Optalk Stop - ret.
Used in all my old dvrip cameras and video recorders (with a firmware date older than 2021). This format is implemented in go2rtc and sofiactl (in Perl), but they do not dispatch a Stop action. - New Format OpTalk Claim - ret. This format is used in all my latest cameras and recorders (firmware date 2021-2023). These cameras have a new web interface and use a web component to work with browsers, as opposed to the old ActiveX and Internet Explorer 8
I dont know if OpTalk Start command important for 2way talk in new cams, maybe its not
Make some additinoal tests: tcpdumps from go2rtc, sofiactl, and native xmeye
go2rtc
{"Name":"OPTalk","SessionID":"0x0000000D","OPTalk":{"Action":"Claim"}}
{"Name":"OPTalk","SessionID":"0x0000000D","OPTalk":{"Action":"Start"}}
sofiactl
{"Name":"OPTalk","OPTalk":{"Action":"Claim","AudioFormat":{"SampleBit":8,"BitRate":519788,"EncodeType":"G711_ALAW","SampleRate":8}}
{"SessionID":"0x0000000f","OPTalk":{"Action":"Start","AudioFormat":{"SampleRate":8000,"BitRate":128,"EncodeType":"G711_ALAW","SampleBit":8}}
Native app Xmeye 2w talk to cam with old firmware
{"Name":"OPTalk","OPTalk":{"Action":"Claim","AudioFormat":{"BitRate":0,"EncodeType":"G711_ALAW","SampleBit":8,"SampleRate":8}},"SessionID":"0x0000000008"}
{"Name":"OPTalk","OPTalk":{"Action":"Start","AudioFormat":{"BitRate":0,"EncodeType":"G711_ALAW","SampleBit":8,"SampleRate":8}},"SessionID":"0x0000000008"}
Native app Xmeye 2w talk to cam with new firmware
{"Name":"OPTalk","OPTalk":{"Action":"Claim","AudioFormat":{"BitRate":0,"EncodeType":"G711_ALAW","SampleBit":8,"SampleRate":8}},"SessionID":"0x000000002c"}
Try to send pcma/8000 audiofile with sofiactl perl script to new and old cams, and I hear music, seems all fine. When I try to send this file with go2rtc to new cam I hear only cracking sounds, Audio format seems incorrect, because go2rtc dont set it. You were right, seems new cameras need a more complete json format. I need almost 2 days to understand it :-)
I don't know. Maybe whole JSON important. Can you make your own changes to the go program?
I make some experiments with sofiactl utility, audiofile dont play if audio codec not set in json
"AudioFormat":{"EncodeType":"G711_ALAW"}
others AudioFormat parameters not important
I think that the Start section is not important for new cameras, and we need to check if it can be left for compatibility with older cameras
https://github.com/AlexxIT/go2rtc/releases/tag/v1.9.3