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

how to enable two way audio? #174

Closed
Maxmudjon opened this issue Apr 2, 2018 · 57 comments
Closed

how to enable two way audio? #174

Maxmudjon opened this issue Apr 2, 2018 · 57 comments
Labels

Comments

@Maxmudjon
Copy link

No description provided.

@DanielWeeber
Copy link

DanielWeeber commented Jul 17, 2018

+1
//another edit: seems like I cannot test it with my camera. please test is with yours, see my fork https://github.com/DanielWeeber/homebridge-camera-ffmpeg

@DanielWeeber
Copy link

Unfortunately this does not seem to work. I bought a new camera to test this. Via the app of the manufacturer its working, not via homebridge.

I found something interesting here:

https://github.com/thoukydides/homebridge-skybell/issues/9

@llemtt
Copy link

llemtt commented Jul 23, 2018

How do you managed to instruct the homebridge client that camera has a speaker and then start stream to the camera?

@DanielWeeber
Copy link

DanielWeeber commented Jul 23, 2018

If you mean try it yourself and use it for your camera:
Just set "audio" to "true" in your config.
Check README for that.

https://github.com/KhaosT/homebridge-camera-ffmpeg/blob/master/README.md
{
"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "Camera Name",
"videoConfig": {
"source": "-re -i rtsp://myfancy_rtsp_stream",
"stillImageSource": "-i http://faster_still_image_grab_url/this_is_optional.jpg",
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 720,
"maxFPS": 30,
"maxBitrate": 200,
"vcodec": "h264_omx",
"audio": true,
"packetSize": 188,
"debug": true
}
}
]
}

If you mean from a programming perspective:
For "Camera has a microphone":
https://github.com/KhaosT/homebridge-camera-ffmpeg/blob/master/ffmpeg.js#L382

For "Camera has a microphone and speaker":
https://github.com/DanielWeeber/homebridge-camera-ffmpeg/blob/master/ffmpeg.js#L382

@llemtt
Copy link

llemtt commented Jul 24, 2018

Thanks Daniel

now I have audio input active, do you mean that I have to use your version to try to send audio to webcam also?

I see that the speaker service is created only in your version.

@DanielWeeber
Copy link

That is correct. If you use my version the icon will show up, but it will not work. That is exactly what we are discussing here.. ;)
We need to utilize a third ffmpeg stream or a RTSP backchannel. I'm not sure.

@llemtt
Copy link

llemtt commented Jul 30, 2018

Current version of ffmpeg won't let you bind to the same udp port, so first of all we have to put in place an udp proxy to act as a gateway between the port used to talk with the homekit client and two local ports to be used with ffmpeg.

Maybe I'm going to try that next days.

@DanielWeeber
Copy link

Would be nice. I'm not an expert with ffmpeg at all.

@llemtt
Copy link

llemtt commented Aug 1, 2018

Ok now I have a "proof of concept" working!

I implemented the udp proxy part and managed to receive the "speaker" stream with a separate ffmpeg instance and save to a file...

Tomorrow I'll try to find time to little polish the code and attach here.

@llemtt
Copy link

llemtt commented Aug 6, 2018

Here is my working POC

ffmpeg.js.txt

Set config["audio"] = "2way", it create the proxy and a "speaker.sdp" file in working directory that let's you play the audio sent from iOS.

I saved mine to a file like this:

ffmpeg -v trace -protocol_whitelist "file,udp,rtp" -i speaker.sdp speaker.mp4

@DanielWeeber
Copy link

Nice work. As soon as this is finished I am happy to test it!

@brownad
Copy link

brownad commented Aug 8, 2018

Is the idea to handle separate input and output audio streams from the video? That’s exactly what I’d like to achieve - then you’d have 2way audio working @llmett

@brownad
Copy link

brownad commented Aug 8, 2018

If so I’d like to bring the ideas across to get the intercom working fully. That would be a win 🏖

@Maxmudjon
Copy link
Author

@llemtt give me your image of raspberry

@llemtt
Copy link

llemtt commented Aug 28, 2018

Attached second version of my working POC!

ffmpeg.js.txt

It uses an additional ffmpeg instance to manage the speaker, set config["audio"] = "2way "+{your speaker ffmpeg output} (I've tested mine writing to a file with "2way -y speaker.mp4").

Requires audio streaming to ios device to start in less than 10 seconds otherwise the "speaker" ffmpeg instance will timeout.

On raspberry tested working also with "2way -f alsa default".

@brownad
Copy link

brownad commented Aug 28, 2018

Is the expected end state to pass it a stream to write it to rather than a file?

@llemtt
Copy link

llemtt commented Aug 29, 2018

Yes, at the moment I don't have a way to try it out other than sending to a file, alsa, or a DLINK camera having a complicated proprietary format to solve first 😒 (btw I'm looking for a "cheaper than doorbird" doorbell with a decently working streaming api...)

It would have been better to use a single ffmpeg instance but it's a nightmare because without a steady streaming to speaker (which is not because it's on only when the microphone button is active) it blocks every other input waiting. This could be a nice improvement in the "not so near" future.

@Maxmudjon
Copy link
Author

ERROR: Speaker FFmpeg exited with code 1

{
"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "Home 2way",
"videoConfig": {
"source": "-rtsp_transport tcp -y -i rtsp://192.168.1.17/unicast",
"maxBitrate": 1600,
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 720,
"vcodec": "h264_omx",
"audio": "2way -f alsa default"
}
}
]
}

@llemtt
Copy link

llemtt commented Nov 12, 2018

Can you add "debug": true to your config and get the ffmpeg output into the log?

BTW you have to configure alsa to work under the user running homebridge.

@Maxmudjon
Copy link
Author

[11/12/2018, 12:48:00 PM] [Camera-ffmpeg-2way] { sessionID: <Buffer 3b a9 fc 5c 74 36 43 c4 b9 f8 8f f0 89 24 f9 44>,
type: 'start',
video:
{ profile: 2,
level: 2,
width: 1280,
height: 720,
fps: 10,
ssrc: 434345868,
pt: 99,
max_bit_rate: 299,
rtcp_interval: 1056964608,
mtu: 1378 },
audio:
{ codec: 'AAC-eld',
channel: 1,
bit_rate: 0,
sample_rate: 16,
packet_time: 30,
pt: 110,
ssrc: 4201289906,
max_bit_rate: 24,
rtcp_interval: 1084227584,
comfort_pt: 13 } }
[11/12/2018, 12:48:00 PM] [Camera-ffmpeg-2way] Start streaming video from Home 2way with 1280x720@299kBit
ffmpeg -nostats -nostdin -rtsp_transport tcp -y -i rtsp://192.168.1.17/unicast -map 0:0 -vcodec h264_omx -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 5825497 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params ZIZnVdVJjKkFLBDvrf8VGtD85/p2MhV2tgNH/ydF srtp://192.168.1.10:60331?rtcpport=60331&localrtcpport=60331&pkt_size=1316 -map 0:1 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 14017304 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params pifjylvtto/qoTs5uefgoxKtpzk88Zd2t1De1gNz srtp://127.0.0.1:61436?rtcpport=61436&localrtcpport=9998&pkt_size=188
CONFIGDAN: 2way -y alsa default ***** -y alsa default
[Speaker] ffmpeg -v error -nostats -nostdin -max_ts_probe 0 -protocol_whitelist file,udp,rtp -i Home_2way_speaker.sdp -y alsa default
proxy listening 0.0.0.0:61436
ffmpeg version N-92398-g10bc4c3a7d Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
configuration: --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
libavutil 56. 23.101 / 56. 23.101
libavcodec 58. 39.100 / 58. 39.100
libavformat 58. 22.100 / 58. 22.100
libavdevice 58. 6.100 / 58. 6.100
libavfilter 7. 43.100 / 7. 43.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100

[Speaker] [NULL @ 0x25a9df0] Unable to find a suitable output format for 'alsa'
alsa: Invalid argument

[11/12/2018, 12:48:00 PM] [Camera-ffmpeg-2way] ERROR: Speaker FFmpeg exited with code 1
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://192.168.1.17/unicast':

Metadata:
title : LIVE555 Streaming Media v2014.07.04
comment : LIVE555 Streaming Media v2014.07.04
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 40 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s

Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp)) specified for output file #0 (srtp://192.168.1.10:60331?rtcpport=60331&localrtcpport=60331&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_omx))
Stream #0:1 -> #1:0 (pcm_alaw (native) -> aac (libfdk_aac))

Output #1, rtp, to 'srtp://127.0.0.1:61436?rtcpport=61436&localrtcpport=9998&pkt_size=188':
Metadata:
title : LIVE555 Streaming Media v2014.07.04
comment : LIVE555 Streaming Media v2014.07.04
encoder :
Lavf58.22.100
Stream #1:0: Audio: aac (libfdk_aac) (ELD), 16000 Hz, mono, s16, 24 kb/s
Metadata:
encoder : Lavc58.39.100 libfdk_aac

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 688; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1200; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1712; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 628; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1140; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1652; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 570; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1082; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1594; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 512; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1024; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1536; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 454; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 966; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1478; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 394; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 906; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1418; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 336; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 848; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1360; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 306; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 818; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1330; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x3611660] Queue input is backward in time

[rtp @ 0x3518220] Non-monotonous DTS in output stream 1:0; previous: 1842, current: 1432; changing to 1842. This may result in incorrect timestamps in the output file.

[h264_omx @ 0x3517940] Using OMX.broadcom.video_encode

Output #0, rtp, to 'srtp://192.168.1.10:60331?rtcpport=60331&localrtcpport=60331&pkt_size=1316':
Metadata:
title : LIVE555 Streaming Media v2014.07.04
comment : LIVE555 Streaming Media v2014.07.04

encoder         : Lavf58.22.100
Stream #0:0: Video: h264 (h264_omx), yuv420p, 1280x720, q=2-31, 299 kb/s, 10 fps, 90k tbn, 10 tbc
Metadata:
  encoder         : Lavc58.39.100 h264_omx

[libfdk_aac @ 0x3611660] Queue input is backward in time

[11/12/2018, 12:48:06 PM] [Camera-ffmpeg-2way] { sessionID: <Buffer 3b a9 fc 5c 74 36 43 c4 b9 f8 8f f0 89 24 f9 44>,
type: 'reconfigure',
video:
{ width: 640,
height: 360,
fps: 10,
max_bit_rate: 132,
rtcp_interval: 0 } }

@Maxmudjon
Copy link
Author

BTW you have to configure alsa to work under the user running homebridge.

how to do it?

@llemtt
Copy link

llemtt commented Nov 12, 2018

Good log thanks!

This is the ffmpeg speaker command:

[Speaker] ffmpeg -v error -nostats -nostdin -max_ts_probe 0 -protocol_whitelist file,udp,rtp -i Home_2way_speaker.sdp -y alsa default

and this is the error:

[Speaker] [NULL @ 0x25a9df0] Unable to find a suitable output format for 'alsa'
alsa: Invalid argument

"-y alsa default" is wrong, it must be "-f alsa default", don't know how but your -f became -y !!

Check your config.

You can also test that everything is ok with alsa/ffmpeg with the following:

sudo -u YOURHOMEBRIDGEUSERNAME ffmpeg -i SOMEAUDIOFILE -f alsa default

@Maxmudjon
Copy link
Author

[11/12/2018, 10:30:44 PM] [Camera-ffmpeg-2way] { sessionID: <Buffer 70 18 a8 81 2c a3 48 06 aa 09 1b 28 6b f9 3f 02>,
type: 'start',
video:
{ profile: 2,
level: 2,
width: 1280,
height: 720,
fps: 10,
ssrc: 439112788,
pt: 99,
max_bit_rate: 299,
rtcp_interval: 1056964608,
mtu: 1378 },
audio:
{ codec: 'AAC-eld',
channel: 1,
bit_rate: 0,
sample_rate: 16,
packet_time: 30,
pt: 110,
ssrc: 3367473162,
max_bit_rate: 24,
rtcp_interval: 1084227584,
comfort_pt: 13 } }
[11/12/2018, 10:30:44 PM] [Camera-ffmpeg-2way] Start streaming video from Home 2way with 1280x720@299kBit
ffmpeg -nostats -nostdin -rtsp_transport tcp -y -i rtsp://192.168.1.17/unicast -map 0:0 -vcodec h264_omx -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 3315625 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params qtufDoaRbQCE3aXyPUUR8LrDuAOTeBZV7PKr4MZN srtp://192.168.1.10:49588?rtcpport=49588&localrtcpport=49588&pkt_size=1316 -map 0:1 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 16087195 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 43v2WVgrnFdx6cpBMkVQ3p2Rt3ADhcp0Iunjy2si srtp://127.0.0.1:57010?rtcpport=57010&localrtcpport=9998&pkt_size=188
CONFIGDAN: 2way -f alsa default ***** -f alsa default
[Speaker] ffmpeg -v error -nostats -nostdin -max_ts_probe 0 -protocol_whitelist file,udp,rtp -i Home_2way_speaker.sdp -f alsa default
proxy listening 0.0.0.0:57010
ffmpeg version N-92398-g10bc4c3a7d Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
configuration: --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
libavutil 56. 23.101 / 56. 23.101
libavcodec 58. 39.100 / 58. 39.100
libavformat 58. 22.100 / 58. 22.100
libavdevice 58. 6.100 / 58. 6.100
libavfilter 7. 43.100 / 7. 43.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100

[Speaker] [NULL @ 0x187fd80] Requested output format 'alsa' is not a suitable output format
default: Invalid argument

[11/12/2018, 10:30:45 PM] [Camera-ffmpeg-2way] ERROR: Speaker FFmpeg exited with code 1
Guessed Channel Layout for Input Stream #0.1 : mono

Input #0, rtsp, from 'rtsp://192.168.1.17/unicast':

Metadata:
title : LIVE555 Streaming Media v2014.07.04
comment : LIVE555 Streaming Media v2014.07.04
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 14.33 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s

Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp)) specified for output file #0 (srtp://192.168.1.10:49588?rtcpport=49588&localrtcpport=49588&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_omx))
Stream #0:1 -> #1:0
(pcm_alaw (native) -> aac (libfdk_aac))

Output #1, rtp, to 'srtp://127.0.0.1:57010?rtcpport=57010&localrtcpport=9998&pkt_size=188':
Metadata:
title : LIVE555 Streaming Media v2014.07.04
comment : LIVE555 Streaming Media v2014.07.04
encoder : Lavf58.22.100

Stream #1:0: Audio: aac (libfdk_aac) (ELD), 16000 Hz, mono, s16, 24 kb/s
Metadata:
  encoder         : Lavc58.39.100 libfdk_aac

[libfdk_aac @ 0x2c346a0] Queue input is backward in time

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 684; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1196; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x2c346a0] Queue input is backward in time

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1708; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 634; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1146; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x2c346a0] Queue input is backward in time

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1658; changing to 1760. This may result in incorrect timestamps in the output file.
[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 676; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1188; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x2c346a0] Queue input is backward in time

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1700; changing to 1760. This may result in incorrect timestamps in the output file.
[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 622; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1134; changing to 1760. This may result in incorrect timestamps in the output file.

[libfdk_aac @ 0x2c346a0] Queue input is backward in time

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1646; changing to 1760. This may result in incorrect timestamps in the output file.
[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 576; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1088; changing to 1760. This may result in incorrect timestamps in the output file.

[rtp @ 0x2b85070] Non-monotonous DTS in output stream 1:0; previous: 1760, current: 1600; changing to 1760. This may result in incorrect timestamps in the output file.

[h264_omx @ 0x2bc3710] Using OMX.broadcom.video_encode

Output #0, rtp, to 'srtp://192.168.1.10:49588?rtcpport=49588&localrtcpport=49588&pkt_size=1316':
Metadata:
title : LIVE555 Streaming Media v2014.07.04
comment :
LIVE555 Streaming Media v2014.07.04
encoder : Lavf58.22.100
Stream #0:0: Video: h264 (h264_omx), yuv420p, 1280x720, q=2-31, 299 kb/s, 10 fps, 90k tbn, 10 tbc
Metadata:
encoder : Lavc58.39.100 h264_omx

[libfdk_aac @ 0x2c346a0] Queue input is backward in time

[11/12/2018, 10:30:50 PM] [Camera-ffmpeg] Snapshot from Питер at 480x270
[11/12/2018, 10:30:50 PM] [Camera-ffmpeg-2way] { sessionID: <Buffer 70 18 a8 81 2c a3 48 06 aa 09 1b 28 6b f9 3f 02>,
type: 'stop' }
frame= 57 fps= 17 q=-0.0 Lsize= 206kB time=00:00:06.02 bitrate= 280.1kbits/s dup=6 drop=19 speed=1.81x
video:204kB audio:19kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Exiting normally, received signal 15.

[11/12/2018, 10:30:51 PM] [Camera-ffmpeg-2way] Stopped streaming

@llemtt
Copy link

llemtt commented Nov 13, 2018

Ok, now error is:

[Speaker] [NULL @ 0x187fd80] Requested output format 'alsa' is not a suitable output format
default: Invalid argument

your ffmpeg is not compiled with alsa support!

You have to make this work first of all:

sudo -u YOURHOMEBRIDGEUSERNAME ffmpeg -i SOMEAUDIOFILE -f alsa default

Check that you have libasound2-dev installed before building ffmpeg, if not you have to install it:

sudo apt-get install libasound2-dev

@burnbrigther
Copy link

I've been reading through these two-way audio cases with interest. I have alza support compiled and

                  "name": "FRONT DOOR",
                  "videoConfig": {
                    "source": "-rtsp_transport tcp -i rtsp://XXXX:[email protected]:554/axis-media/media.amp?streamprofile=Media?tcp",
                    "stillImageSource": "-i http://XXXX:[email protected]/axis-cgi/jpg/image.cgi",
                    "maxStreams": 3,
                    "maxWidth": 800,
                    "maxHeight": 600,
                    "maxFPS": 30,
		    "vcodec": "h264_omx",
		    "audio": "2way -f alsa default",
		    "videoFilter": "scale=800:600:in_range=mpeg",
                    "additionalCommandline": "-loglevel verbose",
		    "debug": true

Shouldn't there be a small microphone or something to speak ?

@llemtt
Copy link

llemtt commented Feb 13, 2019

Shouldn't there be a small microphone or something to speak ?

yes

but be aware that nothing has already been merged into this repository...

@burnbrigther
Copy link

@llemtt - I think I saw you were successful doing this, correct? Would be very interested in figuring this out with your method. I think I read there needs to be three streams? Does h264 include both audio and video in one (2 streams), which show on 0:0 and then the third stream is on 0:1. I can hear input from my camera, but I have no way to speak to the other end.

pi@raspberrypi:~ $ ffmpeg -re -i rtsp://rXXXX:[email protected]/axis-media/media.amp
ffmpeg version N-93115-g84e7aff608 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
  configuration: --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree --enable-mmal --enable-libfdk-aac
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.100 / 58. 47.100
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, rtsp, from 'rtsp://XXXX:[email protected]/axis-media/media.amp':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.049250, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuvj420p(pc, bt709, progressive), 800x600 [SAR 1:1 DAR 4:3], 15.25 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: adpcm_g726le, 8000 Hz, mono, s16, 24 kb/s

@burnbrigther
Copy link

burnbrigther commented Feb 27, 2019

@llemtt - I am continuing to try to troubleshoot this and beating my head against the wall. I see problems with the URL as shown above, but changing the options as you suggest do not produce any meaningful output specifically around that error (-541478725). Do you think there were some changes/deltas added to the base homebridge-camera-ffmpeg which now may be causing some problems with your modified ffmpeg.config? Maybe you could review the deltas? I am always running in to problems presenting the sdp to the http url - something always seems to break. However, when I take input from a file instead, as we tested earlier, it works. There is some problem in reading from sdp as input and converting and presenting to the http output. Any further suggestions would be appreciated. I can include another debug if it is helpful, but I have tested so many options now, I am all over the place.

@llemtt
Copy link

llemtt commented Feb 27, 2019

@burnbrigther I don't use homebridge-camera-ffmpeg but Samfox2/homebridge-videodoorbell as a base so I suggest to start from there (homebridge-camera-ffmpeg has changed a lot in the meantime).

changing the log level as above must produce the detailed log for the speaker part, without that log to me is almost impossible to understand what's happening

I "think" your problem is not related to the sdp file, that is working when you save to a file... the error seems to be related to the http communication with your cam, maybe it doesn't support both rtsp and http running at the same time?

@Supereg
Copy link
Member

Supereg commented May 2, 2019

Are there any more informations about 2way audio?
@llemtt I replicated your mentioned ffmpeg.js into my own video doorbell project. Microphone input from the camera to the iDevice worked fine although I cannot really get the microphone input from the phone to the camera to work. Log output of the ffmpeg process for the incoming audio seems to receive something, however the resulting .mp4 file has always a size of 44 bytes and is not playable by any media software.

@llemtt
Copy link

llemtt commented May 2, 2019

@Supereg look also at Samfox2/homebridge-videodoorbell#25

maybe you forgot to attach your log file...

@brian-f
Copy link

brian-f commented Aug 21, 2019

@burnbrigther any step forward with the Axis cam? I think we are SO close. I've been dumping http traffic from an iOS app which supports 2ways audio called uViewerAxis and when mic (PTT) is pressed headers are like

POST /axis-cgi/audio/transmit.cgi HTTP/1.0.
Host: 192.168.10.211.
User-Agent: Audio client.
Accept: ..
Content-Length: 9995999.
Content-Type: audio/basic.
Authorization: Basic cm9vdDpsZXR0b24xNA==.
Connection: keep-alive.
.

@burnbrigther
Copy link

Sorry, I was never able to get this to fully work. I moved on. I can try to test some things if you figure something out.

@brian-f
Copy link

brian-f commented Aug 23, 2019

well I got it to work.. sort of! if you want to test, this is my audio line in config.json:

"audio": "2way -probesize 32 -analyzeduration 32 -c:a pcm_mulaw -ab 128k -ac 1 -ar 16000 -f wav -chunked_post 0 -content_type audio/axis-mulaw-128 http://192.168.10.211/axis-cgi/audio/transmit.cgi",

then as soon as you hit the mic icon of the camera in homekit it will exit with

Error writing trailer of http://192.168.10.211/axis-cgi/audio/transmit.cgi: Broken pipe

BUT!
you copy the very same ffmpeg speaker instance you can find in homebridge trace/debug log in a shell and voilà, 2way audio fully working

ffmpeg -v trace -nostats -nostdin -max_ts_probe 0 -protocol_whitelist file,udp,rtp -i doorbell_speaker.sdp -probesize 32 -analyzeduration 32 -c:a pcm_mulaw -ab 128k -ac 1 -ar 16000 -f wav -chunked_post 0 -content_type audio/axis-mulaw-128 http://192.168.10.211/axis-cgi/audio/transmit.cgi

@llemtt
Copy link

llemtt commented Aug 30, 2019

@brian-f Glad to hear that it almost works with your camera, IIRC I already encountered the "Broken pipe" error but can't remember how it went away.

I know there's a timeout problem, i.e. if your camera (+ homebridge) don't start streaming within 30s a timeout expires in the speaker part and then strange errors appear, altough I don't think it's your case.

With a "debug level" log it should be clearer what's happening.

Anyway "-probesize 32 -analyzeduration 32" are ffmpeg input side parameters, you better omit them from your configuration.

@DedMsk
Copy link

DedMsk commented Sep 28, 2019

WOW! It's cool!

I have a Xiaofang 1S and install Dafang Hacks
Maybe can play audio on this camera?
On Dafang Hacks found some code in cgi-bin folder

audio_test)
  F_audioSource=$(printf '%b' "${F_audioSource//%/\\x}")
  if [ "$F_audioSource" == "" ]; then
    F_audioSource="/usr/share/notify/CN/init_ok.wav"
  fi
  /system/sdcard/bin/busybox nohup /system/sdcard/bin/audioplay $F_audioSource $F_audiotestVol >> "/var/log/update.log" &
  echo  "Play $F_audioSource at volume $F_audiotestVol"
  return
;;

Its play file for audio test and I hear audio on camera

@llemtt
Copy link

llemtt commented Sep 30, 2019

@DedMsk first of all you have to find a way to send an audio file to your cam using ffmpeg!

audioplay seems a tool that runs locally on the cam...

and I can't find the source code

@odx
Copy link

odx commented Oct 11, 2019

I am trying to use the raspberry pi camera and an attached audio hat with this approach. I have the one-way audio and video successfully running.

I have merged the patches from @llemtt 's POC with the current release of the file in the homebridge-ffmpeg-camera: ffmpeg.js.txt. I just added a tiny modification so the proxy sdp file is stored in /var/homebridge to avoid file system permission problems.

Here is my config:

{
        "platform": "Camera-ffmpeg",
        "cameras": [
          {
            "name": "Door Cam",
            "uploader": false,
            "videoConfig": {
                "source": "-f alsa -ar 44100 -thread_queue_size 2048 -i default -re -f video4linux2 -i /dev/video0",
                "stillImageSource": "-re -f video4linux2 -ss 0.9 -i /dev/video0 -vframes 1",
                "maxStreams": 2,
                "maxWidth": 1280,
                "maxHeight": 720,
                "maxFPS": 5,
                "vcodec": "h264_omx",
                "audio": "2way -f alsa default",
                "debug": true,
                "mapvideo": "1,0",
                "mapaudio": "0,0",
                "packetSize": 564
            }
          }
        ]
      }

Starting the stream results in a port conflict. for some reason the udp port is used by another process. Is there something I am getting wrong? Here is the log:

Oct 11 21:17:37 raspberrypi homebridge[1084]: [10/11/2019, 9:17:37 PM] [Camera-ffmpeg] Start streaming video from Door Cam with 1280x720@299kBit
Oct 11 21:17:37 raspberrypi homebridge[1084]: ffmpeg -f alsa -ar 44100 -thread_queue_size 2048 -i default -re -f video4linux2 -i /dev/video0 -map 1,0 -vcodec h264_omx -pix_fmt yuv420p -r 5 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 5850572 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params GgMrwDMLtG06Lr+rcD6K6ZPFj+nWAQcBQZcTfC/L srtp://192.168.188.93:54794?rtcpport=54794&localrtcpport=54794&pkt_size=564 -map 0,0 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 15513124 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 40zYqaWs2EbY8c4oSfbXlAaTrDOsAxAVq2QxLZZD srtp://192.168.188.93:61388?rtcpport=61388&localrtcpport=61388&pkt_size=564 -loglevel debug
Oct 11 21:17:37 raspberrypi homebridge[1084]: [Speaker] ffmpeg -v error -nostats -nostdin  -max_ts_probe 0 -protocol_whitelist file,udp,rtp -i /var/homebridge/Door_Cam_speaker.sdp -f alsa default
Oct 11 21:17:37 raspberrypi homebridge[1084]: proxy listening 0.0.0.0:61388
Oct 11 21:17:37 raspberrypi homebridge[1084]: ffmpeg version N-95194-g1b2ed0c392 Copyright (c) 2000-2019 the FFmpeg developers
Oct 11 21:17:37 raspberrypi homebridge[1084]:   built with gcc 8 (Raspbian 8.3.0-6+rpi1)
Oct 11 21:17:37 raspberrypi homebridge[1084]:   configuration: --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
Oct 11 21:17:37 raspberrypi homebridge[1084]:   libavutil      56. 35.100 / 56. 35.100
Oct 11 21:17:37 raspberrypi homebridge[1084]:   libavcodec     58. 59.101 / 58. 59.101
Oct 11 21:17:37 raspberrypi homebridge[1084]:   libavformat    58. 33.100 / 58. 33.100
Oct 11 21:17:37 raspberrypi homebridge[1084]:   libavdevice    58.  9.100 / 58.  9.100
Oct 11 21:17:37 raspberrypi homebridge[1084]:   libavfilter     7. 61.100 /  7. 61.100
Oct 11 21:17:37 raspberrypi homebridge[1084]:   libswscale      5.  6.100 /  5.  6.100
Oct 11 21:17:37 raspberrypi homebridge[1084]:   libswresample   3.  6.100 /  3.  6.100
Oct 11 21:17:37 raspberrypi homebridge[1084]:   libpostproc    55.  6.100 / 55.  6.100
Oct 11 21:17:37 raspberrypi homebridge[1084]: Splitting the commandline.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '44100'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-thread_queue_size' ... matched as option 'thread_queue_size' (set the maximum number of queued packets from the demuxer) with argument '2048'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-i' ... matched as input url with argument 'default'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-f' ... matched as option 'f' (force format) with argument 'video4linux2'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-i' ... matched as input url with argument '/dev/video0'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1,0'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264_omx'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '5'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-tune' ... matched as AVOption 'tune' with argument 'zerolatency'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=1280:720'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '299k'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-bufsize' ... matched as AVOption 'bufsize' with argument '299k'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-maxrate' ... matched as AVOption 'maxrate' with argument '299k'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-payload_type' ... matched as AVOption 'payload_type' with argument '99'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-ssrc' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as AVOption 'ssrc' with argument '5850572'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-f' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as option 'f' (force format) with argument 'rtp'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-srtp_out_suite' ... matched as AVOption 'srtp_out_suite' with argument 'AES_CM_128_HMAC_SHA1_80'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-srtp_out_params' ... matched as AVOption 'srtp_out_params' with argument 'GgMrwDMLtG06Lr+rcD6K6ZPFj+nWAQcBQZcTfC/L'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option 'srtp://192.168.188.93:54794?rtcpport=54794&localrtcpport=54794&pkt_size=564' ... matched as output url.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0,0'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libfdk_aac'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-profile:a' ... matched as option 'profile' (set profile) with argument 'aac_eld'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-flags' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as AVOption 'flags' with argument '+global_header'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-f' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as option 'f' (force format) with argument 'null'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '16k'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '24k'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-bufsize' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as AVOption 'bufsize' with argument '24k'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-ac' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as option 'ac' (set number of audio channels) with argument '1'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-payload_type' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as AVOption 'payload_type' with argument '110'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-ssrc' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as AVOption 'ssrc' with argument '15513124'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-f' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as option 'f' (force format) with argument 'rtp'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-srtp_out_suite' ... matched as AVOption 'srtp_out_suite' with argument 'AES_CM_128_HMAC_SHA1_80'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-srtp_out_params' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as AVOption 'srtp_out_params' with argument '40zYqaWs2EbY8c4oSfbXlAaTrDOsAxAVq2QxLZZD'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option 'srtp://192.168.188.93:61388?rtcpport=61388&localrtcpport=61388&pkt_size=564' ...
Oct 11 21:17:37 raspberrypi homebridge[1084]:  matched as output url.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Finished splitting the commandline.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Parsing a group of options: global .
Oct 11 21:17:37 raspberrypi homebridge[1084]: Applying option loglevel (set logging level) with argument debug.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Successfully parsed a group of options.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Parsing a group of options: input url default.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Applying option f (force format) with argument alsa.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Applying option ar (set audio sampling rate (in Hz)) with argument 44100.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Applying option thread_queue_size (set the maximum number of queued packets from the demuxer) with argument 2048.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Successfully parsed a group of options.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Opening an input file: default.
Oct 11 21:17:37 raspberrypi homebridge[1084]: [alsa @ 0x1c6eaa0]
Oct 11 21:17:37 raspberrypi homebridge[1084]: All info found
Oct 11 21:17:37 raspberrypi homebridge[1084]: Guessed Channel Layout for Input Stream #0.0 : stereo
Oct 11 21:17:37 raspberrypi homebridge[1084]: Input #0, alsa, from 'default':
Oct 11 21:17:37 raspberrypi homebridge[1084]:   Duration: N/A, start: 1570825056.954199, bitrate: 1411 kb/s
Oct 11 21:17:37 raspberrypi homebridge[1084]:     Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Oct 11 21:17:37 raspberrypi homebridge[1084]: Successfully opened the file.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Parsing a group of options: input url /dev/video0.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Applying option re (read input at native frame rate) with argument 1.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Applying option f (force format) with argument video4linux2.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Successfully parsed a group of options.
Oct 11 21:17:37 raspberrypi homebridge[1084]: Opening an input file: /dev/video0.
Oct 11 21:17:37 raspberrypi homebridge[1084]: [video4linux2,v4l2 @ 0x1c96bc0]
Oct 11 21:17:37 raspberrypi homebridge[1084]: fd:6 capabilities:85200005
Oct 11 21:17:37 raspberrypi homebridge[1084]: [video4linux2,v4l2 @ 0x1c96bc0] Current input_channel: 0, input_name: Camera 0, input_std: 0
Oct 11 21:17:37 raspberrypi homebridge[1084]: [video4linux2,v4l2 @ 0x1c96bc0] Querying the device for the current frame size
Oct 11 21:17:37 raspberrypi homebridge[1084]: [video4linux2,v4l2 @ 0x1c96bc0] Setting frame size to 1024x768
Oct 11 21:17:38 raspberrypi homebridge[1084]: [video4linux2,v4l2 @ 0x1c96bc0] All info found
Oct 11 21:17:38 raspberrypi homebridge[1084]: Input #1, video4linux2,v4l2, from '/dev/video0':
Oct 11 21:17:38 raspberrypi homebridge[1084]:   Duration: N/A, start: 4837.437761, bitrate: 283115 kb/s
Oct 11 21:17:38 raspberrypi homebridge[1084]:     Stream #1:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1024x768, 0/1, 283115 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Oct 11 21:17:38 raspberrypi homebridge[1084]: Successfully opened the file.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Parsing a group of options: output url srtp://192.168.188.93:54794?rtcpport=54794&localrtcpport=54794&pkt_size=564.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option map (set input stream mapping) with argument 1,0.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264_omx.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option pix_fmt (set pixel format) with argument yuv420p.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 5.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option f (force format) with argument rawvideo.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option vf (set video filters) with argument scale=1280:720.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option b:v (video bitrate (please use -b:v)) with argument 299k.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option f (force format) with argument rtp.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Successfully parsed a group of options.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Opening an output file: srtp://192.168.188.93:54794?rtcpport=54794&localrtcpport=54794&pkt_size=564.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp)) specified for output file #0 (srtp://192.168.188.93:54794?rtcpport=54794&localrtcpport=54794&pkt_size=564) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Oct 11 21:17:38 raspberrypi homebridge[1084]: [srtp @ 0x1c9b410] No default whitelist set
Oct 11 21:17:38 raspberrypi homebridge[1084]: [rtp @ 0x1c9d990] No default whitelist set
Oct 11 21:17:38 raspberrypi homebridge[1084]: [udp @ 0x1c9dc90] No default whitelist set
Oct 11 21:17:38 raspberrypi homebridge[1084]: [udp @ 0x1cae040] No default whitelist set
Oct 11 21:17:38 raspberrypi homebridge[1084]: Successfully opened the file.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Parsing a group of options: output url srtp://192.168.188.93:61388?rtcpport=61388&localrtcpport=61388&pkt_size=564.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option map (set input stream mapping) with argument 0,0.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option acodec (force audio codec ('copy' to copy stream)) with argument libfdk_aac.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option profile:a (set profile) with argument aac_eld.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option f (force format) with argument null.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option ar (set audio sampling rate (in Hz)) with argument 16k.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option b:a (video bitrate (please use -b:v)) with argument 24k.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option ac (set number of audio channels) with argument 1.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Applying option f (force format) with argument rtp.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Successfully parsed a group of options.
Oct 11 21:17:38 raspberrypi homebridge[1084]: Opening an output file: srtp://192.168.188.93:61388?rtcpport=61388&localrtcpport=61388&pkt_size=564.
Oct 11 21:17:38 raspberrypi homebridge[1084]: [srtp @ 0x1cc0650] No default whitelist set
Oct 11 21:17:38 raspberrypi homebridge[1084]: [rtp @ 0x1cc2be0] No default whitelist set
Oct 11 21:17:38 raspberrypi homebridge[1084]: [udp @ 0x1cc2fc0] No default whitelist set
Oct 11 21:17:38 raspberrypi homebridge[1084]: [udp @ 0x1cd3320] No default whitelist set
Oct 11 21:17:38 raspberrypi homebridge[1084]: [udp @ 0x1cd3320] bind failed: Address already in use
Oct 11 21:17:38 raspberrypi homebridge[1084]: srtp://192.168.188.93:61388?rtcpport=61388&localrtcpport=61388&pkt_size=564: Input/output error
Oct 11 21:17:38 raspberrypi homebridge[1084]: [AVIOContext @ 0x1cbe560] Statistics: 0 seeks, 0 writeouts
Oct 11 21:17:38 raspberrypi homebridge[1084]: [10/11/2019, 9:17:38 PM] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1

@llemtt
Copy link

llemtt commented Oct 14, 2019

@odx

Glad to hear you have attempted to merge into current version, but first of all does it work for you without merging?

I see your merge has some problem because audio output url is still like the original one:

srtp://192.168.188.93:61388?rtcpport=61388&localrtcpport=61388&pkt_size=564: Input/output error

host has to be 127.0.0.1 and localrtcpport 9998

(I also suggest to not change audio packet size which is established by the homekit client request to have a 30ms packet timing and cannot be negotiated... video and audio sizes are different!!)

@odx
Copy link

odx commented Oct 14, 2019

The "old" version does not support mapping. So I had to edit this in the code directly... This is the result:

Oct 14 19:26:07 raspberrypi homebridge[508]: [10/14/2019, 7:26:07 PM] [Camera-ffmpeg] { sessionID: <Buffer 2e 2e 02 f0 02 72 4a a6 87 f5 60 fb 25 9c 72 9f>,
Oct 14 19:26:07 raspberrypi homebridge[508]:   type: 'start',
Oct 14 19:26:07 raspberrypi homebridge[508]:   video:
Oct 14 19:26:07 raspberrypi homebridge[508]:    { profile: 2,
Oct 14 19:26:07 raspberrypi homebridge[508]:      level: 2,
Oct 14 19:26:07 raspberrypi homebridge[508]:      width: 1280,
Oct 14 19:26:07 raspberrypi homebridge[508]:      height: 720,
Oct 14 19:26:07 raspberrypi homebridge[508]:      fps: 30,
Oct 14 19:26:07 raspberrypi homebridge[508]:      ssrc: 2719205484,
Oct 14 19:26:07 raspberrypi homebridge[508]:      pt: 99,
Oct 14 19:26:07 raspberrypi homebridge[508]:      max_bit_rate: 299,
Oct 14 19:26:07 raspberrypi homebridge[508]:      rtcp_interval: 1056964608,
Oct 14 19:26:07 raspberrypi homebridge[508]:      mtu: 1378 },
Oct 14 19:26:07 raspberrypi homebridge[508]:   audio:
Oct 14 19:26:07 raspberrypi homebridge[508]:    { codec: 'AAC-eld',
Oct 14 19:26:07 raspberrypi homebridge[508]:      channel: 1,
Oct 14 19:26:07 raspberrypi homebridge[508]:      bit_rate: 0,
Oct 14 19:26:07 raspberrypi homebridge[508]:      sample_rate: 16,
Oct 14 19:26:07 raspberrypi homebridge[508]:      packet_time: 30,
Oct 14 19:26:07 raspberrypi homebridge[508]:      pt: 110,
Oct 14 19:26:07 raspberrypi homebridge[508]:      ssrc: 1945867544,
Oct 14 19:26:07 raspberrypi homebridge[508]:      max_bit_rate: 24,
Oct 14 19:26:07 raspberrypi homebridge[508]:      rtcp_interval: 1084227584,
Oct 14 19:26:07 raspberrypi homebridge[508]:      comfort_pt: 13 } }
Oct 14 19:26:07 raspberrypi homebridge[508]: [10/14/2019, 7:26:07 PM] [Camera-ffmpeg] Start streaming video from Door Cam with 1280x720@299kBit
Oct 14 19:26:07 raspberrypi homebridge[508]: ffmpeg -nostats -nostdin -f alsa -ar 44100 -thread_queue_size 2048 -i default -re -f video4linux2 -i /dev/video0 -map 1:0 -vcodec h264_omx -pix_fmt yuv420p -r 5 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 4016465 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params yiAEo+ROOsVftb5zir3ekwgZSspflPI8XsKmN4OR srtp://192.168.188.66:49341?rtcpport=49341\&localrtcpport=49341\&pkt_size=564 -map 0:0 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 2370028 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params Tp8AmbC7BqyQXirtfeLa7l3qxjn2VyqdA6sOhiL2 srtp://127.0.0.1:52379?rtcpport=52379\&localrtcpport=9998\&pkt_size=188
Oct 14 19:26:07 raspberrypi homebridge[508]: [Speaker] ffmpeg -v error -nostats -nostdin  -max_ts_probe 0 -protocol_whitelist file,udp,rtp -i /var/homebridge/Door_Cam_speaker.sdp -f alsa -i default -thread_queue_size 2048
Oct 14 19:26:07 raspberrypi homebridge[508]: proxy listening 0.0.0.0:52379
Oct 14 19:26:07 raspberrypi homebridge[508]: ffmpeg version N-95194-g1b2ed0c392 Copyright (c) 2000-2019 the FFmpeg developers
Oct 14 19:26:07 raspberrypi homebridge[508]:   built with gcc 8 (Raspbian 8.3.0-6+rpi1)
Oct 14 19:26:07 raspberrypi homebridge[508]:   configuration: --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
Oct 14 19:26:07 raspberrypi homebridge[508]:   libavutil      56. 35.100 / 56. 35.100
Oct 14 19:26:07 raspberrypi homebridge[508]:   libavcodec     58. 59.101 / 58. 59.101
Oct 14 19:26:07 raspberrypi homebridge[508]:   libavformat    58. 33.100 / 58. 33.100
Oct 14 19:26:07 raspberrypi homebridge[508]:   libavdevice    58.  9.100 / 58.  9.100
Oct 14 19:26:07 raspberrypi homebridge[508]:   libavfilter     7. 61.100 /  7. 61.100
Oct 14 19:26:07 raspberrypi homebridge[508]:   libswscale      5.  6.100 /  5.  6.100
Oct 14 19:26:07 raspberrypi homebridge[508]:   libswresample   3.  6.100 /  3.  6.100
Oct 14 19:26:07 raspberrypi homebridge[508]:   libpostproc    55.  6.100 / 55.  6.100
Oct 14 19:26:08 raspberrypi homebridge[508]: Guessed Channel Layout for Input Stream #0.0 : stereo
Oct 14 19:26:08 raspberrypi homebridge[508]: Input #0, alsa, from 'default':
Oct 14 19:26:08 raspberrypi homebridge[508]:   Duration: N/A, start: 1571077567.421581, bitrate: 1411 kb/s
Oct 14 19:26:08 raspberrypi homebridge[508]:     Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Oct 14 19:26:08 raspberrypi homebridge[508]: [Speaker] At least one output file must be specified
Oct 14 19:26:08 raspberrypi homebridge[508]: [10/14/2019, 7:26:08 PM] [Camera-ffmpeg] ERROR: Speaker FFmpeg exited with code 1
Oct 14 19:26:08 raspberrypi homebridge[508]: Input #1, video4linux2,v4l2, from '/dev/video0':
Oct 14 19:26:08 raspberrypi homebridge[508]:   Duration:
Oct 14 19:26:08 raspberrypi homebridge[508]: N/A, start: 444.575537, bitrate: 283115 kb/s
Oct 14 19:26:08 raspberrypi homebridge[508]:     Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1024x768, 283115 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Oct 14 19:26:08 raspberrypi homebridge[508]: Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp)) specified for output file #0 (srtp://192.168.188.66:49341?rtcpport=49341\&localrtcpport=49341\&pkt_size=564) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Oct 14 19:26:08 raspberrypi homebridge[508]: Stream mapping:
Oct 14 19:26:08 raspberrypi homebridge[508]:   Stream #1:0 -> #0:0 (rawvideo (native) -> h264 (h264_omx))
Oct 14 19:26:08 raspberrypi homebridge[508]:   Stream #0:0 -> #1:0 (pcm_s16le (native) -> aac (libfdk_aac))
Oct 14 19:26:08 raspberrypi homebridge[508]: [alsa @ 0x24dbab0] ALSA buffer xrun.
Oct 14 19:26:09 raspberrypi homebridge[508]: [h264_omx @ 0x25077e0]
Oct 14 19:26:09 raspberrypi homebridge[508]: Using OMX.broadcom.video_encode
Oct 14 19:26:09 raspberrypi homebridge[508]: Output #0, rtp, to 'srtp://192.168.188.66:49341?rtcpport=49341\&localrtcpport=49341\&pkt_size=564':
Oct 14 19:26:09 raspberrypi homebridge[508]:   Metadata:
Oct 14 19:26:09 raspberrypi homebridge[508]:     encoder         : Lavf58.33.100
Oct 14 19:26:09 raspberrypi homebridge[508]:     Stream #0:0: Video: h264 (h264_omx), yuv420p, 1280x720, q=2-31, 299 kb/s, 5 fps, 90k tbn, 5 tbc
Oct 14 19:26:09 raspberrypi homebridge[508]:     Metadata:
Oct 14 19:26:09 raspberrypi homebridge[508]:       encoder         : Lavc58.59.101 h264_omx
Oct 14 19:26:09 raspberrypi homebridge[508]: Output #1, rtp, to 'srtp://127.0.0.1:52379?rtcpport=52379\&localrtcpport=9998\&pkt_size=188':
Oct 14 19:26:09 raspberrypi homebridge[508]:   Metadata:
Oct 14 19:26:09 raspberrypi homebridge[508]:     encoder         : Lavf58.33.100
Oct 14 19:26:09 raspberrypi homebridge[508]:     Stream #1:0: Audio: aac (libfdk_aac) (ELD), 16000 Hz, mono, s16, 24 kb/s
Oct 14 19:26:09 raspberrypi homebridge[508]:     Metadata:
Oct 14 19:26:09 raspberrypi homebridge[508]:       encoder         : Lavc58.59.101 libfdk_aac
Oct 14 19:26:11 raspberrypi homebridge[508]: [video4linux2,v4l2 @ 0x2503bd0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Oct 14 19:26:15 raspberrypi homebridge[508]: [10/14/2019, 7:26:15 PM] [Camera-ffmpeg] { sessionID: <Buffer 2e 2e 02 f0 02 72 4a a6 87 f5 60 fb 25 9c 72 9f>,
Oct 14 19:26:15 raspberrypi homebridge[508]:   type: 'reconfigure',
Oct 14 19:26:15 raspberrypi homebridge[508]:   video:
Oct 14 19:26:15 raspberrypi homebridge[508]:    { width: 640,
Oct 14 19:26:15 raspberrypi homebridge[508]:      height: 360,
Oct 14 19:26:15 raspberrypi homebridge[508]:      fps: 30,
Oct 14 19:26:15 raspberrypi homebridge[508]:      max_bit_rate: 132,
Oct 14 19:26:15 raspberrypi homebridge[508]:      rtcp_interval: 0 } }
Oct 14 19:26:16 raspberrypi homebridge[508]: [10/14/2019, 7:26:16 PM] [Camera-ffmpeg] { sessionID: <Buffer 2e 2e 02 f0 02 72 4a a6 87 f5 60 fb 25 9c 72 9f>,
Oct 14 19:26:16 raspberrypi homebridge[508]:   type: 'stop' }
Oct 14 19:26:17 raspberrypi homebridge[508]: frame=   15 fps=1.8 q=-0.0 Lsize=       4kB time=00:00:02.80 bitrate=  10.6kbits/s dup=0 drop=2 speed=0.344x
Oct 14 19:26:17 raspberrypi homebridge[508]: video:3kB audio:6kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
Oct 14 19:26:17 raspberrypi homebridge[508]: unknown
Oct 14 19:26:17 raspberrypi homebridge[508]: Exiting normally, received signal 15.
Oct 14 19:26:17 raspberrypi homebridge[508]: [10/14/2019, 7:26:17 PM] [Camera-ffmpeg] Stopped streaming

@odx
Copy link

odx commented Oct 14, 2019

So actually this looks good. I had a wrong flag in my config but this log shows that the stream is set up correctly. I hope to improve the audio stream latency and stability from the pi to the iPhone and also the audio from the iPhone to the pi seems to be sort of distorted...
But in general this seems to be ok.

I will have a look again at merging the current FFmpeg.js file later on... (with more care)

@llemtt
Copy link

llemtt commented Oct 15, 2019

@odx good to hear that it works!

my version should do automatic mapping but maybe there's something to fix, anyway with my configuration it works.

To improve audio you must match the audio packet size to the "packet_time: 30," of the request so 188 is a good value, while the video packet size must be "mtu: 1378" for best performance.

@odx
Copy link

odx commented Oct 17, 2019

@llemtt thanks for the hint with the packet_time. The original source from this project does not allow to specify different packet sizes for audio and video. I noticed that your code always applies 188 for the audio packet size and only maps the configured packet size to the video stream.

What I noticed is that the audio that is sent from my iPhone to the pi is pitched slightly lower than what the input was. The funny thing is that in the other direction (from Pi / ALSA to the iPhone) it is vice versa. As I posted here.

@safrapetr
Copy link

Hi here is merged working ffmpeg.js from latest version of camera-ffmpeg with 2way audio support. My working setup

"source": "-f alsa -ac 1 -ar 44100 -thread_queue_size 2048 -i default -re -f video4linux2 -i /dev/video0 -vsync 0 -af aresample=async=1 -vf hflip,vflip"
"stillImageSource": "-f video4linux2 -i /dev/video0 -vf hflip,vflip",
"maxStreams":5,
"maxWidth": 1270,
"maxHeight": 720,
"maxFPS": 15,
"mapvideo": "1,0",
"mapaudio": "0,0",
"audio": "2way -f alsa default",
"packetSize": 188,
"debug": true

I discovered that for working audio is crucial video4linux2 and -vsync 0 -af aresample=async=1 Audio is not working with mjpeg for me.

Because easier permission access is Speaker.sdp file moved to /var/lib/homebridge (my working folder of homebridge) change it in ffmpeg.js to your actual homebridge folder.

ffmpeg.js.txt

@burnbrigther
Copy link

well I got it to work.. sort of! if you want to test, this is my audio line in config.json:

"audio": "2way -probesize 32 -analyzeduration 32 -c:a pcm_mulaw -ab 128k -ac 1 -ar 16000 -f wav -chunked_post 0 -content_type audio/axis-mulaw-128 http://192.168.10.211/axis-cgi/audio/transmit.cgi",

then as soon as you hit the mic icon of the camera in homekit it will exit with

Error writing trailer of http://192.168.10.211/axis-cgi/audio/transmit.cgi: Broken pipe

BUT!
you copy the very same ffmpeg speaker instance you can find in homebridge trace/debug log in a shell and voilà, 2way audio fully working

ffmpeg -v trace -nostats -nostdin -max_ts_probe 0 -protocol_whitelist file,udp,rtp -i doorbell_speaker.sdp -probesize 32 -analyzeduration 32 -c:a pcm_mulaw -ab 128k -ac 1 -ar 16000 -f wav -chunked_post 0 -content_type audio/axis-mulaw-128 http://192.168.10.211/axis-cgi/audio/transmit.cgi

@brian-f Did you finally get this working with full 2way audio? I am trying to get this to work now with my newer P3375-VE. Could you share your config and which ffmpeg.js worked for you? Thanks

@github-actions
Copy link

github-actions bot commented May 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 3, 2020
@github-actions github-actions bot closed this as completed May 8, 2020
This was referenced May 12, 2020
@netRunner0
Copy link

@superbraz
Copy link

well I got it to work.. sort of! if you want to test, this is my audio line in config.json:

"audio": "2way -probesize 32 -analyzeduration 32 -c:a pcm_mulaw -ab 128k -ac 1 -ar 16000 -f wav -chunked_post 0 -content_type audio/axis-mulaw-128 http://192.168.10.211/axis-cgi/audio/transmit.cgi",

then as soon as you hit the mic icon of the camera in homekit it will exit with

Error writing trailer of http://192.168.10.211/axis-cgi/audio/transmit.cgi: Broken pipe

BUT!
you copy the very same ffmpeg speaker instance you can find in homebridge trace/debug log in a shell and voilà, 2way audio fully working

ffmpeg -v trace -nostats -nostdin -max_ts_probe 0 -protocol_whitelist file,udp,rtp -i doorbell_speaker.sdp -probesize 32 -analyzeduration 32 -c:a pcm_mulaw -ab 128k -ac 1 -ar 16000 -f wav -chunked_post 0 -content_type audio/axis-mulaw-128 http://192.168.10.211/axis-cgi/audio/transmit.cgi

@brian-f Did you finally get this working with full 2way audio? I am trying to get this to work now with my newer P3375-VE. Could you share your config and which ffmpeg.js worked for you? Thanks

i want it for my axis doorstation, it would be nice!
did you get it work?

i do not get the mic button in the home app!?

thank you!

@burnbrigther
Copy link

burnbrigther commented Jun 12, 2020

2-way audio does actually work for a the first maybe 2-3 seconds, but then crashes out with the error you say above. It's not clear what is causing this, but I suspect it's something with the proxy and not handling the connections properly. Too bad I don't know enough about how the code is handling multiple streams. Maybe someone would be willing to investigate with us some day. I should say this discussion applies only to the video doorbell with @llmetts enhancement for 2-way audio.

@phoenixlin2007
Copy link

So actually this looks good. I had a wrong flag in my config but this log shows that the stream is set up correctly. I hope to improve the audio stream latency and stability from the pi to the iPhone and also the audio from the iPhone to the pi seems to be sort of distorted... But in general this seems to be ok.

I will have a look again at merging the current FFmpeg.js file later on... (with more care)

Excuse me, I use PI4 (camera module+wm8960 audio hat) and want to try 2 way audio.Could you please share the setting method of the PI side?

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

No branches or pull requests