-
Notifications
You must be signed in to change notification settings - Fork 18
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
Two way audio ? #25
Comments
I have my video doorbell currently working. |
@llemtt can you describe your hardware and software config? |
Production environment is: Raspberry PI2 B Linux TeoRasp 4.14.70-v7+ #1144 SMP Tue Sep 18 17:34:46 BST 2018 armv7l node v8.11.1 npm -g -depth=0 list libasound2-dev ffmpeg version N-91008-ge6114d21ac Copyright (c) 2000-2018 the FFmpeg developers
Clients (iPhones, iPad) all run iOS 12.0.1. |
@llemtt what is usbtv? |
Fushicai USBTV007 Video Grabber [EasyCAP] my doorbell hw is plain old analog video doorbell... so video input is grabbed from /dev/video0, audio input is grabbed form (alsa) hw:CARD=usbtv, and audio ouput is (alsa) hw:CARD=ALSA,0 to the PI phone jack then connected to doorbell audio input |
@llemtt |
In order to use alsa, ffmpeg must be compiled with libasound2-dev installed, so first install the lib then compile ffmpeg. Next I suggest to try first that ffmpeg works by sending some audio file to the pi audio jack like this: ffmpeg -i AUDIOFILE -f alsa hw:CARD=ALSA,0 If everything is ok then with my POC ffmpeg.js and this configuration: "audio": "2way -f alsa hw:CARD=ALSA,0" the intercom from the iPhone/iPad will be sent to the pi audio jack. |
thanks. So, there needs to be a hardwired connection between the audio jack from the pi to the cam, regardless? |
I don't know, it depends on your cam! My doorbell is an old "analog" type so I connected the audio jack to his "analog" audio input. For instance I have an old version D-Link DCS-942L, but it supports 2way audio only through a proprietary audio format (ACAS) so it actually works only with their app... If your cam accept an http or rtp or any "standard" input stream, you can put the necessary ffmpeg "output" configuration into "audio" property in place of "-f alsa hw:CARD=ALSA,0". |
@llemtt I am trying to setup a video doorbell. Video works well, audio input works but it sounds a little fast than normal, and audio output (from iPhone/iPad to RPi) is not good, it sounds slow and very distorted. I have not idea where is the problem. I am using a Raspberry Pi 3 Model B+, with its camera under /dev/video0, audio input with an USB device and audio output to RPi audio jack. I installed [email protected] and replaced ffmpeg.js with your PoC file from here homebridge-plugins/homebridge-camera-ffmpeg#174. My config.json is:
Many thanks for your help. |
@llemtt Im trying to get Audio Output working.
Is there a Problem with : proxy listening 0.0.0.0:59118 ? Greeds |
I found my problem with distorted audio. RPi audio jack and camera don't work well when using kernel module to get /dev/video0. I disconnected camera, unloaded kernel module and deactivated in rasp-config; then I created a dummy video input, and now 2-way audio works. Actually, I am waiting for a new USB camera from Amazon. I hope with the new cam, all works fine. |
@dosordie I suggest to change in config.json "Tür-Cam" name for other without any special character, like "mycam". Then, you can rename it into Home App. |
@RavenSystem Changed the Name in Config.json. Same Problem srtp://192.168.10.140:57575?rtcpport=57575&localrtcpport=57575&pkt_size=1316 In my network there is no device with the address 192.168.10.140 - Could this be a Problem? |
It's very strange because in my code the proxy is hard wired to listen on port 9999. Anyway I never tried it on debian (pc?) so nodejs udp sockets can behave a little different there. 192.168.10.140 must be your iPhone/iPad/AppleTV address! |
@llemtt Your PoC is amazing! Have you an improved version or are you working on it? |
@llemtt Another question: is there any way to increase 10 seconds speaker timeout? Thanks! |
Many thanks. Sorry but nowadays I don't have time to work on it, I have my videodoorbell working so I will get back to it only if I would need to change/fix something. Consider also that code is no longer up to date to latest version of ffmpeg-camera and requires some rework to eventually merge.
Not an easy way, that timeout (rtp/udp timeout) is hardcoded into ffmpeg and cannot be passed as a parameter so one can:
|
Do you know where is hardcoded into ffmpeg? |
Is there a way to change the port (by variable or in the script File?) |
#define READ_PACKET_TIMEOUT_S 10 in file rtsp.c exactly! voted (+1) on that ticket port used are 9998 and 9999, search ffmpeg.js for "999" you'll find all occurrences port 9999 is used inside the .sdp speaker file that ffmpeg uses as the speaker input description |
@llemtt |
@dosordie I can think two things
|
@llemtt Now it works good. |
How could this work with a camera like the Axis 3343 which supports 2-way audio. From the documentation, it shows:
|
@llemtt Please, I hope you can help me. I have an USB camera that works under /dev/video0, an USB mic that works with ALSA, and the RPi audio jack to use the speaker. I am using second version of your working PoC, that I think is the last. But I have 2 problems with audio: I don't know if it's necessary to customize ALSA setup in any way, or do other things. And another question: I only use Many thanks for your help! |
@RavenSystem I went directly to the hw card also because using default + alsa configuration wasn't completely ok. What happens if you record the speaker audio on a file with "2way speaker.mp4" and play back to phone jack with ffmpeg? Is the pitch correct? For my doorbell I use [email protected] but I was testing another two-way cam with [email protected], it's not necessary. |
@llemtt I am going to do some records but, can you tell me how to manipulate hardware audio card directly, please? |
@llemtt I don't see the 2way code getting activated with video-doorbell from ffmpeg.config. I also don't see anything to make outbound communication from the phone. Am I missing something? |
I have this error please help. [NULL @ 0x2c88330] Requested output format 'alsa' is not a suitable output format pi@iDomoPi3Plus:~$ ffmpeg -i dingdong.mp3 -f alsa hw:CARD=ALSA,0 ffmpeg version N-93878-g81acc9adbf Copyright (c) 2000-2019 the FFmpeg developers |
@toshibochan check first that libasound2-dev is installed, if not install sudo apt-get install libasound2-dev and recompile ffmpeg |
i am also interested - i have an AXIS A8207-VE and i wand to speak with people in front of the door |
nobody? |
@superbraz the feature is still experimental and has not been merged yet I successfully run it and I have recently fixed some codec details and maybe one day I'll try a merge, in the meantime one has to substitute the ffmpeg.js file with my version. Anyway first preliminary step to configure for two way is to reproduce whatever audio file on your camera using ffmpeg, can you do that? |
how can i do that? |
@superbraz can you post a link to your camera documentation? |
sorry no, you need VAPIX documentation, as a registered user you should obtain that anyway your ffmpeg command should be like this ffmpeg -i {an audio file to play} -f mulaw http://{servername}/axis-cgi/audio/transmit.cgi |
Log in to your MyAxis account, enable developer access, then look here: |
@superbraz It has been some time since I was playing around with audio with my 3343. I have since moved to a Pi 4b with my P3375-VE and use h264_omx for video. I've learned a couple of things along the way - you will have better results if your request sends sizing.
This is what I last used for audio and could only hear what was being said, I couldn't get the mic icon and talking to other side to fully work. This was with a previous version of @llemtt ffmpeg.js:
I still have not yet figured out how to get bi-directional working. Maybe @llemtt 's new code fixes things? Maybe it is my POE-analog speaker/mic set up which gets the audio from the camera itself. Let me know how you get on. I will be experimenting more with this. The goal is to be able to have two-way conversation on my ipad or iphone with someone at the door through my analog set up. In theory, this set up shouldn't be much different than running this through the Pi. Just in case I decide to experiment with that route, I did pick up a USB input for the Pi with audio in and out. |
@llemtt @burnbrigther
|
There should be a document called "vapix audio" (I have a very old outdated version), the relevant part (in my version) is only chapter "4.4 Transmit audio data". Have you tried the ffmpeg command? |
i dont know how... Transmit audio data Transmit a singlepart audio data stream: http:///axis-cgi/param.cgi?action=list&group=Properties.Audio.Decoder Access control: Method: Syntax: Content-Type: Content-Length: Syntax: There are no arguments and values to transmit.cgi. The content length must be set to a valid size and will generate a server response for every successful playback. If the playback fails, the connection will be closed without any response. Transmit singlepart audio using G.711 µ-law (authorization omitted): Content-Type: audio/basic\r\n Error responses |
@superbraz sorry but I have no direct experience with dockers and NAS, but for testing purposes you can use ffmpeg from any unix command line (even win but not recommended...) |
@llemtt Thank you for your latest code. I am using the latest version of homebridge-ffmpeg which has changed significantly with lots more code. I just did a comparison of the newest ffmpeg.js and yours and there are lots of differences. Would it be possible to merge your code with latest ffmpeg.js? I could maybe try to do this myself, if I know exactly what is different with your code only. Are your changes only everything marked "2way"? |
@burnbrigther I'm sorry but I don't think my code is completely compatible with the newest homebridge-ffmpeg-camera, 2 way audio requires following Apple guidelines better than they do anyway major changes are lines 317-339, 377-469 and 492-494 |
@llemtt Thanks - is your ffmpeg.js merged with latest homebridge-videodoorbell? |
I currently use my ffmpeg.js with latest version of homebridge-videodoorbell but it isn't merged |
@llemtt I now have ffmpeg tested audio working via audio out jack on my camera with this configuration: The sound is a bit muddy, but it's as best as I could do with the audio frequency input - I messed about with it quite a bit. It's at least audibly understandable to the listener. The audio filters I don't care too much about. I played a pre-recorded mp4 audio file through ffmpeg. I'm wondering something now, because I translated the above ffmpeg configuration to the audio section, prefaced with "2way" like this:
My source line, is this: All I am hearing is the audio IN from camera (has external microphone attached). I feel like I have everything now set up correctly, it's just a matter of getting the configuration plugged in to the right place. I think there must be a mistake in how I have the audio in and out arranged? I do not appear to be sending any audio from the ipad to the camera's audio out/speaker. All I can hear on the ipad is audio back from the camera's audio in (microphone). I tested by enabling both icons. Here is the logging output I am so close now I think! |
@llemtt |
Is it possible? No one camera makers even "Works with homekit" logo dont have two way audio feature. Somfy is announce, but sales is not starting yet. Is it homekit problem or not? Seems that happened when apple removes doorbell category from list...
The text was updated successfully, but these errors were encountered: