hjdhjd / homebridge-doorbird

Homebridge plugin for Doorbird
Apache License 2.0
54 stars 14 forks source link

Audio ideas? #26

Closed brownad closed 5 years ago

brownad commented 6 years ago

Anyone know ffmpeg we’ll enough to bring audio to life on the plugin?

brownad commented 6 years ago

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

llemtt commented 6 years ago

try this:

add the audio source to videoConfig[source] after the video source

change the audio mapping

ffmpegCommand+= ' -map 0:1'

to

ffmpegCommand+= ' -map 1:1'

brownad commented 6 years ago

Tried it just a second ago, I assume the Audio url can be passed in as a second arg with option -i after the video Url?

Failed to stream video and audio when I did

Sent from my iPhone

On 20 Aug 2018, at 18:26, llemtt notifications@github.com wrote:

try this:

add the audio source to videoConfig[source] after the video source

change the audio mapping

ffmpegCommand+= ' -map 0:1'

to

ffmpegCommand+= ' -map 1:1'

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

@brownad

yes exactly, add the audio url after the video url with -i ... (always beware of not putting double spaces into the string)

can you attach ffmpeg debug output?

brownad commented 6 years ago

Here you go

[DoorBird] Start streaming video from DoorBird with 1280x720@299kBit ffmpeg -re -f mjpeg -i http://xxx:xxx@192.168.0.69/bha-api/video.cgi -i http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 11350555 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params qexPkRxiXNToPza8coT0BAkuRcuon/zUnOdHA0C/ srtp://192.168.0.24:59491?rtcpport=59491&localrtcpport=59491&pkt_size=1316 -map 1: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 14516766 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params MhMNOD6pbzJTM0IxHGUhlYjEVntayjJeJJoJrHXW srtp://192.168.0.24:53287?rtcpport=53287&localrtcpport=53287&pkt_size=1316 [2018-8-21 09:20:04] [DoorBird] Stopped streaming [2018-8-21 09:20:19] Got SIGINT, shutting down Homebridge...

Sent from my iPhone

On 21 Aug 2018, at 10:52, llemtt notifications@github.com wrote:

@brownad

yes exactly, add the audio url after the video url with -i ... (always beware of not putting double spaces into the string)

can you attach ffmpeg debug output?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

mmm... the debug output from ffmpeg is not there, only the launch command...

I think you have to first fix this bug

change

    ffmpeg.stderr.on('data', function(data) {

into

    ffmpeg.stderr.on('data', (data) => {

because "this" inside "function" is not bound correctly and this.debug is undefined

brownad commented 6 years ago

Darn, thanks

ffmpeg -re -f mjpeg -i http://xxx:xxx@192.168.0.69/bha-api/video.cgi -i http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 3891626 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params nhWDALcsAaS0xrN1jpUxXy3hy+TRCrayyISMVeTI srtp://192.168.0.24:49915?rtcpport=49915&localrtcpport=49915&pkt_size=1316 -map 1: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 1520195 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params BNVdyxvsMcurbFq+L26kF1xE0km51+/SUMothVpR srtp://192.168.0.24:59894?rtcpport=59894&localrtcpport=59894&pkt_size=1316 ffmpeg version N-91330-ga990184007 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth

libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.103 / 58. 20.103 libavformat 58. 17.100 / 58. 17.100 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100

Input #0, mjpeg, from 'http://xxx:xxx@192.168.0.69/bha-api/video.cgi': Duration: N/A, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x480 [SAR 96:96 DAR 4:3], 25 tbr, 1200k tbn, 25 tbc

Sent from my iPhone

On 21 Aug 2018, at 11:47, llemtt notifications@github.com wrote:

ffmpeg.stderr.on('data', (data) =>

llemtt commented 6 years ago

Good, now ffmpeg should be your friend!

Has something been cut in your output or simply ffmpeg hangs?

I see the first input listed but not the second...

I suggest you to fine tune the ffmpeg command-line separately, you just need to get the two inputs correctly recognized so you have to test and adjust only the first part of the command

ffmpeg -re -f mjpeg -i http://xxx:xxx@192.168.0.69/bha-api/video.cgi -i http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi

First thing that comes to mind is to add format specification to the audio url, i.e. use -f option before -i

Sorry but I currently don't have a doorbird at hand to try myself.

brownad commented 6 years ago

I had stopped it as it was hanging, just added -f and let it hang until it stops responding I have more information now, tweaking the ffmpeg opts is needed?

[2018-8-21 11:41:59] [DoorBird] Start streaming video from DoorBird with 1280x720@299kBit ffmpeg -re -f mjpeg -i http://xxx:xxx@192.168.0.69/bha-api/video.cgi -f -i http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 2057101 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params hSTYLijDf+EncV61L0yKGZKzGjbWT2u34szf3k2k srtp://192.168.0.24:64638?rtcpport=64638&localrtcpport=64638&pkt_size=1316 -map 1: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 9545784 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params Qi2vP5AK09wL/BpEUOgFvYlSVGZ79F8ce53r8OOr srtp://192.168.0.24:64631?rtcpport=64631&localrtcpport=64631&pkt_size=1316 ffmpeg version N-91330-ga990184007 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth

libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.103 / 58. 20.103 libavformat 58. 17.100 / 58. 17.100 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100

Input #0, mjpeg, from 'http://xxx:xxx@192.168.0.69/bha-api/video.cgi': Duration: N/A, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x480 [SAR 96:96 DAR 4:3], 25 tbr, 1200k tbn, 25 tbc

[NULL @ 0000026b07621780] Requested output format '-i' is not a suitable output format http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi: Invalid argument

Sent from my iPhone

On 21 Aug 2018, at 13:26, llemtt notifications@github.com wrote:

Good, now ffmpeg should be your friend!

Has something been cut in your output or simply ffmpeg hangs?

I see the first input listed but not the second...

I suggest you to fine tune the ffmpeg command-line separately, you just need to get the two inputs correctly recognized so you have to test and adjust only the first part of the command

ffmpeg -re -f mjpeg -i http://xxx:xxx@192.168.0.69/bha-api/video.cgi -i http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi

First thing that comes to mind is to add format specification to the audio url, i.e. use -f option before -i

Sorry but I currently don't have a doorbird at hand to try myself.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

ok now you have to tweak ffmpeg options...

after -f you have to specify the audio input format (like -f mjpeg for video) do you know which format doorbird uses?

brownad commented 6 years ago

That I don’t know. Not on their api but I’ve seen it somewhere once. Maybe someone else here knows?

Sent from my iPhone

On 21 Aug 2018, at 15:28, llemtt notifications@github.com wrote:

ok now you have to tweak ffmpeg options...

after -f you have to specify the audio input format (like -f mjpeg for video) do you know which format doorbird uses?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

bombadiltom commented 6 years ago

According to https://www.doorbird.com/downloads/api_lan.pdf it is G.711 μ-law.

brownad commented 6 years ago

Thanks Tom 😎

Sent from my iPhone

On 21 Aug 2018, at 15:42, Tom Lorenz notifications@github.com wrote:

According to https://www.doorbird.com/downloads/api_lan.pdf it is G.711 μ-law.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

it could be G.711, their http api is similar to my DLINK webcam

try "-f mulaw"

llemtt commented 6 years ago

btw it seems that doorbird support also the usual "rtsp" video/audio interface, why don't you use that?

rtsp://\<device-ip>:\<device-rtsp-port>/mpeg/media.amp

brownad commented 6 years ago

Do you mean as a single stream with just “tcp -re -i”? With all the changes made.

Have used that in the past but no audio surfaces. I might have read the docs wrong but thought audio was always a separate stream

Sent from my iPhone

On 21 Aug 2018, at 16:22, llemtt notifications@github.com wrote:

btw it seems that doorbird support also the usual "rtsp" video/audio interface, why don't you use that?

rtsp://:/mpeg/media.amp

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

yes! just

ffmpeg -re -i rtsp://xxx:xxx@192.168.0.69/mpeg/media.amp

take a look at ffmpeg output, you should see the two streams 0:0 video and 0:1 audio

tommyd75 commented 6 years ago

Does the method above work now? I’m not able to try myself at the moment but I have a DoorBird also.

brownad commented 6 years ago

Cool

I can see the audio stream but something looks wrong with stream (one of the reasons I stopped using rtsp)

2018-8-21 16:53:10] [DoorBird] Start streaming video from DoorBird with 1280x720@299kBit ffmpeg -rtsp_transport tcp -re -i rtsp://xxx:xxx@192.168.0.69:8557/mpeg/media.amp -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 7009368 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params EQ8oP3ioLA7z5J9o6dQ63NO2g3oTf0sl5nELaY4/ srtp://192.168.0.24:54370?rtcpport=54370&localrtcpport=54370&pkt_size=1316 -map 1: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 9908076 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params z5lhWjB9wM0QAmR9tSai4yRc7nam2ai3S0aW4yH6 srtp://192.168.0.24:56640?rtcpport=56640&localrtcpport=56640&pkt_size=1316 ffmpeg version N-91330-ga990184007 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth

libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.103 / 58. 20.103 libavformat 58. 17.100 / 58. 17.100 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100

Input #0, rtsp, from 'rtsp://xxx:xxx@192.168.0.69:8557/mpeg/media.amp': Metadata: title : RTSP/RTP stream from DoorBird comment : mpeg/media.amp Duration: N/A, start: 0.601000, bitrate: N/A Stream #0:0: Video: h264 (Main), yuvj420p(pc, progressive), 1280x720, 10 fps, 10 tbr, 90k tbn, 20 tbc [udp @ 00000183b11a0a40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) [udp @ 00000183b11a0b40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) Invalid input file index: 1.

Sent from my iPhone

On 21 Aug 2018, at 18:52, tommyd75 notifications@github.com wrote:

Does the method above work now? I’m not able to try myself at the moment but I have a DoorBird also.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

you have to revert this mod also

ffmpegCommand+= ' -map 1:1'

back to

ffmpegCommand+= ' -map 0:1'

but I still can't see input stream 0:1 in your log

brownad commented 6 years ago

In that case when I had tried rtsp before def no audio. That would have been before all of these changes. Going to attempt mjpeg with the right opts, pain doing this over RdP on iPhone.

Sent from my iPhone

On 21 Aug 2018, at 19:09, llemtt notifications@github.com wrote:

you have to revert this mod also

ffmpegCommand+= ' -map 1:1'

back to

ffmpegCommand+= ' -map 0:1'

but I still can't see input stream 0:1 in your log

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

brownad commented 6 years ago

Attempted with mulaw but no luck, any ideas? Output format was complained about

2018-8-21 18:34:51] [Camera-ffmpeg] Start streaming video from Front Driveway with 640x360@132kBit [2018-8-21 18:35:01] [Camera-ffmpeg] Stopped streaming [2018-8-21 18:35:09] [DoorBird] Start streaming video from DoorBird with 640x360@132kBit ffmpeg -re -f mjpeg -i http://xxx:xxx@192.168.0.69/bha-api/video.cgi -f -mulaw http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -maxrate 132k -payload_type 99 -ssrc 1184040 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params lAQJ0q/65jtuuXn5d9/gJwX1QWa4fGsZloUVQhOC srtp://192.168.0.24:59521?rtcpport=59521&localrtcpport=59521&pkt_size=1316 -map 1: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 10488161 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params OciYoT3vNXIQITFQ1o/0qgDgRdEXbrzDceyhZmvr srtp://192.168.0.24:56162?rtcpport=56162&localrtcpport=56162&pkt_size=1316 ffmpeg version N-91330-ga990184007 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth

libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.103 / 58. 20.103 libavformat 58. 17.100 / 58. 17.100 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100

Input #0, mjpeg, from 'http://xxx:xxx@192.168.0.69/bha-api/video.cgi': Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x480 [SAR 96:96 DAR 4:3], 25 tbr, 1200k tbn, 25 tbc [NULL @ 000002304d341380] Requested output format '-mulaw' is not a suitable output format http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi: Invalid argument

[2018-8-21 18:35:09] [DoorBird] ERROR: FFmpeg exited with code 1

Sent from my iPhone

On 21 Aug 2018, at 19:09, llemtt notifications@github.com wrote:

you have to revert this mod also

ffmpegCommand+= ' -map 1:1'

back to

ffmpegCommand+= ' -map 0:1'

but I still can't see input stream 0:1 in your log

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

missing -i after "-f mulaw"

I suggest to study ffmpeg a little... otherwise it wil be very difficult to tune the command, not every camera works out of the box!

have you tried rtsp again with "map" mod revert?

brownad commented 6 years ago

Some light reading for me..

I managed to get back to a state with rtsp video only again but what seems to be happening - turning on audio to be true in config (has reverted map back) causes no streaming (mjpeg and rtsp) completely, I’m guessing it fails to pass in the audio IN stream

2018-8-22 09:00:14] [DoorBird] Start streaming video from DoorBird with 1280x720@299kBit ffmpeg -rtsp_transport tcp -re -i rtsp://xxx:xxx@192.168.0.69:8557/mpeg/media.amp -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 5490493 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 2f3CRlVLP8TAqxpHNZ3rU+/xiU2SLEL5QybZBycP srtp://192.168.0.24:60107?rtcpport=60107&localrtcpport=60107&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 9914371 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params CNvcn9FoUDn7LGcM8pqqd5BOzrJlws6nJ2PcG2PW srtp://192.168.0.24:54036?rtcpport=54036&localrtcpport=54036&pkt_size=1316 ffmpeg version N-91330-ga990184007 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth

libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.103 / 58. 20.103 libavformat 58. 17.100 / 58. 17.100 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100

Input #0, rtsp, from 'rtsp://xxx:xxx@192.168.0.69:8557/mpeg/media.amp': Metadata: title : RTSP/RTP stream from DoorBird comment : mpeg/media.amp Duration: N/A, start: 0.601000, bitrate: N/A Stream #0:0: Video: h264 (Main), yuvj420p(pc, progressive), 1280x720, 10 fps, 10 tbr, 90k tbn, 20 tbc [udp @ 000001743df5a980] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) [udp @ 000001743df5aa80] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) Stream map '0:1' matches no streams. To ignore this, add a trailing '?' to the map.

[2018-8-22 09:00:15] [DoorBird] ERROR: FFmpeg exited with code 1 [

Sent from my iPhone

On 22 Aug 2018, at 10:42, llemtt notifications@github.com wrote:

missing -i after "-f mulaw"

I suggest to study ffmpeg a little... otherwise it wil be very difficult to tune the command, not every camera works out of the box!

have you tried rtsp again with "map" mod revert?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

brownad commented 6 years ago

Reconfigured mulaw correctly, drops the error now but still not map correctly

2018-8-22 09:17:43] [DoorBird] Start streaming video from DoorBird with 1280x720@299kBit ffmpeg -re -f mjpeg -i http://xxx:xxx@192.168.0.69/bha-api/video.cgi -f mulaw -i http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 1736058 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 3v/jIHg0uByyAEWFbhrZXnpF0lBvROW6X7DDTiDb srtp://192.168.0.24:51900?rtcpport=51900&localrtcpport=51900&pkt_size=1316 -map 1: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 5206714 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params q2c+dJCBJJrtYbHyl798WuUHNDeMu8PixmvIXkQY srtp://192.168.0.24:58081?rtcpport=58081&localrtcpport=58081&pkt_size=1316 ffmpeg version N-91330-ga990184007 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth

libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.103 / 58. 20.103 libavformat 58. 17.100 / 58. 17.100 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100

Input #0, mjpeg, from 'http://xxx:xxx@192.168.0.69/bha-api/video.cgi': Duration: N/A, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x480 [SAR 96:96 DAR 4:3], 25 tbr, 1200k tbn, 25 tbc

[mulaw @ 0000017fc9e21840] Estimating duration from bitrate, this may be inaccurate

Guessed Channel Layout for Input Stream #1.0 : mono Input #1, mulaw, from 'http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi': Duration: 00:03:46.76, bitrate: 352 kb/s Stream #1:0: Audio: pcm_mulaw, 44100 Hz, mono, s16, 352 kb/s [udp @ 0000017fc9e5c600] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) [udp @ 0000017fc9e6c8c0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) Stream map '1:1' matches no streams. To ignore this, add a trailing '?' to the map.

[2018-8-22 09:17:50] [DoorBird] ERROR: FFmpeg exited with code 1

Sent from my iPhone

On 22 Aug 2018, at 10:42, llemtt notifications@github.com wrote:

missing -i after "-f mulaw"

I suggest to study ffmpeg a little... otherwise it wil be very difficult to tune the command, not every camera works out of the box!

have you tried rtsp again with "map" mod revert?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

as you can see from the log there's an error receiving the video stream so ffmpeg exits without further processing

[udp @ 0000017fc9e5c600] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)

it seems that your ffmpeg is not correctly built or otherwise there's a bug into ffmpeg itself (not so uncommon)

your version looks very strange to me

ffmpeg version N-91330-ga990184007

mine says

ffmpeg version 4.0.2

Good news is now I can see your separate audio stream, I'm sorry but you have to change the audio mapping

ffmpegCommand+= ' -map 1:1'

to

ffmpegCommand+= ' -map 1:0'

because it has to match exactly the stream number you see in the log

Stream #1:0: Audio: pcm_mulaw, 44100 Hz, mono, s16, 352 kb/s

brownad commented 6 years ago

I’ll look into the version (installed on windows 10) a while ago. I’ll look for 4.0.2 now

Swapped out map:

2018-8-22 09:56:31] [DoorBird] Start streaming video from DoorBird with 1280x720@299kBit ffmpeg -re -f mjpeg -i http://xxx: xxx@192.168.0.69/bha-api/video.cgi -f mulaw -i http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 3223126 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params KdL26FNEnugAH+wf0z58UXfCFwxwiTk+Q2AVBZ+a srtp://192.168.0.24:53229?rtcpport=53229&localrtcpport=53229&pkt_size=1316 -map 1: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 6740258 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params h9gVNpvsmK0Bnqg03TrDdj8FygPZ9zc63w91rj0A srtp://192.168.0.24:56781?rtcpport=56781&localrtcpport=56781&pkt_size=1316 ffmpeg version N-91330-ga990184007 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth

libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.103 / 58. 20.103 libavformat 58. 17.100 / 58. 17.100 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100

Input #0, mjpeg, from 'http://xxx:xxx@192.168.0.69/bha-api/video.cgi': Duration: N/A, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x480 [SAR 96:96 DAR 4:3], 25 tbr, 1200k tbn, 25 tbc

[mulaw @ 0000020654da1cc0] Estimating duration from bitrate, this may be inaccurate

Guessed Channel Layout for Input Stream #1.0 : mono Input #1, mulaw, from 'http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi': Duration: 00:03:46.76, bitrate: 352 kb/s Stream #1:0: Audio: pcm_mulaw, 44100 Hz, mono, s16, 352 kb/s [udp @ 0000020654ddd100] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) [udp @ 0000020654ded3c0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) Unknown encoder 'libfdk_aac'

[2018-8-22 09:56:38] [DoorBird] ERROR: FFmpeg exited with code 1

Sent from my iPhone

On 22 Aug 2018, at 11:47, llemtt notifications@github.com wrote:

as you can see from the log there's an error receiving the video stream so ffmpeg exits without further processing

[udp @ 0000017fc9e5c600] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)

it seems that your ffmpeg is not correctly built or otherwise there's a bug into ffmpeg itself (not so uncommon)

your version looks very strange to me

ffmpeg version N-91330-ga990184007

mine says

ffmpeg version 4.0.2

Good news is now I can see your separate audio stream, I'm sorry but you have to change the audio mapping

ffmpegCommand+= ' -map 1:1'

to

ffmpegCommand+= ' -map 1:0'

because it has to match exactly the stream number you see in the log

Stream #1:0: Audio: pcm_mulaw, 44100 Hz, mono, s16, 352 kb/s

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

llemtt commented 6 years ago

libfdk_aac is missing too!

without libfdk_aac audio doesn't work at all..

brownad commented 6 years ago

Yeah the original build had it (used a package from GH to generate it) latest I dipped isn’t compiled with it, yet to build one on windows 10 - any sensible guide to follow?

Sent from my iPhone

On 24 Aug 2018, at 13:23, llemtt notifications@github.com wrote:

libfdk_aac is missing too!

without libfdk_aac audio doesn't work at all..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

brownad commented 6 years ago

Finally, recompiled ffmpeg with the https://github.com/jb-alvarado/media-autobuild_suite project. Did a full compile with everything (just because..)

Audio is now streaming in with the video, no more errors in ffmpeg (very cool, although seems to be white noise rather than the actual audio), but it makes a nice burst of audio then goes very quiet, not sure is something is cancelling audio or not. Stream kills itself after at 40 seconds (seen that before?). I've noticed ffmpeg continues to take a stream of audio even when the video stream has been stopped.

brownad commented 6 years ago

@llemtt I need to set audio to 8000hz, tried a few overrides but its stuck on 16Khz, were should this be changed?

brownad commented 6 years ago

Sample output:

[2018-8-27 15:53:34] [DoorBird] Start streaming video from DoorBird with 1280x720@299kBit ffmpeg -re -f mjpeg -i http://xx:xxx@192.168.0.69/bha-api/video.cgi -f mulaw -i http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 12243459 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params FUQTH2FdRBSzTNx5cZLCx2DuavqG1ewkfJ2gO46S srtp://192.168.0.34:53572?rtcpport=53572&localrtcpport=53572&pkt_size=1316 -map 1: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 14894808 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params cJQ02RHWdwbS6AgUaFnfGuUxSMFUCQlq3SSJibk9 srtp://192.168.0.34:60178?rtcpport=60178&localrtcpport=60178&pkt_size=1316 ffmpeg version N-91679-g4d87cd2882 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 8.2.0 (Rev1, Built by MSYS2 project) configuration: --disable-autodetect --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --disable-debug --enable-ffnvcodec --enable-nvdec --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libxvid --enable-libaom --enable-version3 --enable-chromaprint --enable-decklink --enable-frei0r --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libfdk-aac --enable-libflite --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmodplug --enable-libopenh264 --enable-libopenmpt --enable-librtmp --enable-librubberband --enable-libssh --enable-libtesseract --enable-libxavs --enable-libzmq --enable-libzvbi --enable-opengl --enable-libvmaf --enable-libcodec2 --enable-libsrt --enable-ladspa --enable-openssl --extra-cflags=-fopenmp --extra-libs=-lgomp --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DLIBSSH_STATIC --extra-ldflags='-Wl,--allow-multiple-definition' --extra-cflags=-DCACA_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCHROMAPRINT_NODLL --extra-libs=-lstdc++ --extra-cflags=-DZMQ_STATIC --extra-libs=-lpsapi --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --disable-w32threads --extra-cflags=-DKVZ_STATIC_LIB --enable-nonfree libavutil 56. 19.100 / 56. 19.100 libavcodec 58. 25.100 / 58. 25.100 libavformat 58. 17.103 / 58. 17.103 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 26.100 / 7. 26.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100

libpostproc 55. 2.100 / 55. 2.100

Input #0, mjpeg, from 'http://xxx:xxx@192.168.0.69/bha-api/video.cgi': Duration: N/A, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x480 [SAR 96:96 DAR 4:3], 25 tbr, 1200k tbn, 25 tbc

[mulaw @ 0000028e16012d40] Estimating duration from bitrate, this may be inaccurate

Guessed Channel Layout for Input Stream #1.0 : mono Input #1, mulaw, from 'http://xxx:xxx@192.168.0.69/bha-api/audio-receive.cgi': Duration: 00:03:46.76, bitrate: 352 kb/s Stream #1:0: Audio: pcm_mulaw, 44100 Hz, mono, s16, 352 kb/s

Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264)) Stream #1:0 -> #1:0 (pcm_mulaw (native) -> aac (libfdk_aac)) Press [q] to stop, [?] for help

[swscaler @ 0000028e163ab000] deprecated pixel format used, make sure you did set range correctly

[libx264 @ 0000028e162b0d00] using SAR=3/4

[libx264 @ 0000028e162b0d00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX

[libx264 @ 0000028e162b0d00] profile High, level 3.1, 4:2:0, 8-bit

Output #0, rtp, to 'srtp://192.168.0.34:53572?rtcpport=53572&localrtcpport=53572&pkt_size=1316': Metadata: encoder : Lavf58.17.103 Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 3:4 DAR 4:3], q=-1--1, 299 kb/s, 10 fps, 90k tbn, 10 tbc

Metadata:
  encoder         : Lavc58.25.100 libx264
Side data:
  cpb: bitrate max/min/avg: 299000/0/299000 buffer size: 299000 vbv_delay: -1

[mulaw @ 0000028e16012d40] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)

Output #1, rtp, to 'srtp://192.168.0.34:60178?rtcpport=60178&localrtcpport=60178&pkt_size=1316': Metadata: encoder : Lavf58.17.103

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

frame= 4 fps=0.0 q=39.0 size= 16kB time=00:00:01.19 bitrate= 109.7kbits/s dup=0 drop=1 speed=2.33x frame= 4 fps=3.9 q=39.0 size= 16kB time=00:00:01.29 bitrate= 101.6kbits/s dup=0 drop=1 speed=1.28x frame= 4 fps=2.6 q=39.0 size= 16kB time=00:00:01.35 bitrate= 96.8kbits/s dup=0 drop=1 speed=0.888x frame= 4 fps=2.0 q=39.0 size= 16kB time=00:00:01.45 bitrate= 90.4kbits/s dup=0 drop=1 speed=0.711x frame= 4 fps=1.6 q=39.0 size= 16kB time=00:00:01.55 bitrate= 84.8kbits/s dup=0 drop=1 speed=0.609x frame= 4 fps=1.3 q=39.0 size= 16kB time=00:00:01.61 bitrate= 81.4kbits/s dup=0 drop=1 speed=0.528x frame= 4 fps=1.1 q=39.0 size= 16kB time=00:00:01.71 bitrate= 76.9kbits/s dup=0 drop=1 speed=0.48x frame= 4 fps=1.0 q=39.0 size= 16kB time=00:00:01.80 bitrate= 72.8kbits/s dup=0 drop=1 speed=0.443x

brownad commented 6 years ago

Sorted the -ar option but this will cause the stream to crash, assume bitrate has to change down?

llemtt commented 6 years ago

@llemtt I need to set audio to 8000hz, tried a few overrides but its stuck on 16Khz, were should this be changed?

Homekit supported audio sample rates are 16kHz and 24kHz only, why do you want to change to 8000Hz?

brownad commented 6 years ago

Recommended on the doorbird api doc.

Saying that even though the stream ‘starts’ lasts up to 40 secs, the home app appears to be live but the video stream has stalled itself. The Audio from the device isn’t the audio recorded. Think the setup isn’t quite ready 😞

Sent from my iPhone

On 27 Aug 2018, at 16:18, llemtt notifications@github.com wrote:

@llemtt I need to set audio to 8000hz, tried a few overrides but its stuck on 16Khz, were should this be changed?

Homekit supported audio sample rates are 16kHz and 24kHz only, why do you want to change to 8000Hz?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

yungeconomist commented 5 years ago

Did anyone ever get this working?

brownad commented 5 years ago

After speaking to Doorbird about Audio, the current API is not for general use, seems more targeted to other systems e.g. Loxone. Unless someone can see differently

brownad commented 4 years ago

@llemtt we have audio receive working now on the plugin https://github.com/brownad/homebridge-doorbird what is the simplest way to support 2way with the microphone? The API docs are revealing more nowadays https://www.doorbird.com/downloads/api_lan.pdf?rev=0.27

llemtt commented 4 years ago

@brownad sorry but I don't own and use doorbird

anyway it seems that the api call should be the following

http:///bha-api/audio-transmit.cgi

and it should work fine with ffmpeg, but if I'm correct this plugin doesn't support two way audio..