Closed boisy closed 2 years ago
Run the ffmpeg menu command - this will display ffmpeg logging info.
Have you run the quarantine command? (I would guess so) &
I would disable audio - as some camera streams are incompatible with audio in addition (as per the config dialog)
Depending on interest.. can try fine tuning cameras below.
Camera support is a real pain - and I wasted hours and hours. All depends on the ffmpeg settings above.
Can also run the plugin in debugging mode. In the approrpriate terminal window
Can Enter : paste the plugin given ffmpeg given output above Command = ['./ffmpeg/ffmpeg', '-rtsp_transport', 'tcp', '-probesize', '64', '-analyzeduration', '0', '-re', '-i', 'rtsp://boisy:password!!!@imac.local:8000/stream?cameraNum=4&width=1280', '-map', '0:0', '-c:v', 'libx264', '-bf', '0', '-pix_fmt', 'yuv420p', '-color_range', 'mpeg', '-f', 'rawvideo', '-r', '20', '-b:v', '299k', '-bufsize', '2392k', '-maxrate', '299k', '-payload_type', '99', '-ssrc', '5646290', '-f', 'rtp', '-srtp_out_suite', 'AES_CM_128_HMAC_SHA1_80', '-srtp_out_params', 'rN9Dp2awrEL95DURNTPPsAjRmVr8uxI9cvA2+HMS', 'srtp://10.0.0.11:49975?rtcpport=49975&localrtcpport=49975&pkt_size=1316'] subprocess.run(Command)
This will hopefully run ffmpeg as above with output. Enables some settings to be changed… and rechecked.. Looking at these settings - all seems correct (with exception is using imac.local as IP address… presume that should be okay)
Got it. This is very revealing:
boisy@m1 Server Plugin % ~/ptest dyld[74889]: Library not loaded: /usr/local/opt/libx11/lib/libX11.6.dylib Referenced from: /Library/Application Support/Perceptive Automation/Indigo 2022.1/Plugins/HomeKitLink-Siri.indigoPlugin/Contents/Server Plugin/ffmpeg/ffmpeg Reason: tried: '/usr/local/opt/libx11/lib/libX11.6.dylib' (no such file), '/usr/local/lib/libX11.6.dylib' (no such file), '/usr/lib/libX11.6.dylib' (no such file) write() argument must be str, not bytes
OK I have seen this - hopefully the dylib exists on your system - just directory is wrong.
If so you create symbolic link for where it is..
Can try
find / -name libX11.6.dylib
(Jay did suggest leaving camera support out until later - because of ffmpeg is an issue. Can install it seperately easily unfortunately….)
If someone has a great idea on how to package ffmpeg — or even install it separate to plugin so can be used would be all ears…
(HomeKit bridge packages it like I’m doing, or so I believe. I’m using there version with some additional library support which is needed…)
It's taking a while to find that... in the mean time, I'm using Homebrew to install ffmpeg natively. I'm running an M1 Mac and your ffmpeg binary is x86_64 only. It'll still work with Rosetta 2, I'm sure, but getting ffmpeg built from Homebrew and then copying it over to the plug-in location should fix this. I'll let you know when the build is done.
Ok. Double check the Homebrew settings - the ffmpeg build has specific support for libaac which is needed for HomeKit and audio. It’s not included by default (the older aac is supported)
See here:
https://github.com/homebridge/ffmpeg-for-homebridge
Welcome to link to the build (once going!) as should be able to have ffmpeg and ffmpeg-m1 binaries and programmatically select which one to run depending on underlying machine.
It's not working with the Homebrew-built ffmpeg either. Going to take a break from this for a while...
This is probably relevant https://github.com/homebridge/ffmpeg-for-homebridge/issues/44
Indeed. Now it's working with the arm64 binary of ffpmeg from that page. Thank you.
Thats great news - I’ll see if can add and select which one to run.
Actually you should be able to use the lipo
command to merge the two ffmpeg binaries together into one and distribute a single file with arm64 and x86_64 code.
Perfect - thanks for the pointers. Have used Lipo to successfully combine ffmpeg and pushed update to version 0.2.23 - hopefully fixing this. Confirm this new binary runs well on x86 system
Please test the M1 mac - the x86 one is working fine on my system It will need the quarantine command run again (everytime updated!)
Yep, it works on my M1! And I verified with lipo that it's a Universal binary (x86_64 and arm64). Good job!
That’s great. I did check the ffmpeg as well, with Lipo as well. Was quite straight forward to use
Might close this …
I have a number of SecuritySpy cameras and am using the Cynical SecuritySpy plug-in. I've added them into the plug-in, but when I select the camera in the Home app, it just sits and spins for 5 seconds or so, then gives up.
`HomeKitLink Siri Debug [354c0cb7-b90d-43c9-945e-b055c3460ee0] Starting stream -I'm Here2- with the following parameters: {'v_profile_id': b'\x01', 'v_level': b'\x02', 'width': 1280, 'height': 720, 'fps': 30, 'v_ssrc': 5646290, 'v_payload_type': b'c', 'v_max_bitrate': 299, 'v_rtcp_interval': 0.5, 'v_max_mtu': b'b\x05', 'a_codec': b'\x02', 'a_comfort_noise': b'\x00', 'a_channel': 1, 'a_bitrate': False, 'a_sample_rate': 16, 'a_packet_time': 30, 'a_ssrc': 7199693, 'a_payload_type': b'n', 'a_max_bitrate': 24, 'a_rtcp_interval': 5.0, 'a_comfort_payload_type': b'\r', 'id': UUID('354c0cb7-b90d-43c9-945e-b055c3460ee0'), 'stream_idx': 1, 'address': '10.0.0.11', 'v_port': 49975, 'v_srtp_key': 'rN9Dp2awrEL95DURNTPPsAjRmVr8uxI9cvA2+HMS', 'a_port': 54504, 'a_srtp_key': '9c12CUszKDh4s0ce/cSNd0Z+EjX0Ks39skxRoBSY'} HomeKitLink Siri Debug Input Source rtsp://username:password!!!@imac.local:8000/stream?cameraNum=4&width=1280 HomeKitLink Siri Debug FFmpeg output settings: -map 0:0 -c:v libx264 -bf 0 -pix_fmt yuv420p -color_range mpeg -f rawvideo -r 20 -b:v 299k -bufsize 2392k -maxrate 299k -payload_type 99 -ssrc 5646290 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params rN9Dp2awrEL95DURNTPPsAjRmVr8uxI9cvA2+HMS srtp://10.0.0.11:49975?rtcpport=49975&localrtcpport=49975&pkt_size=1316 HomeKitLink Siri Debug [354c0cb7-b90d-43c9-945e-b055c3460ee0] Starting stream with the following parameters: {'v_profile_id': b'\x01', 'v_level': b'\x02', 'width': 1280, 'height': 720, 'fps': 30, 'v_ssrc': 5646290, 'v_payload_type': b'c', 'v_max_bitrate': 299, 'v_rtcp_interval': 0.5, 'v_max_mtu': b'b\x05', 'a_codec': b'\x02', 'a_comfort_noise': b'\x00', 'a_channel': 1, 'a_bitrate': False, 'a_sample_rate': 16, 'a_packet_time': 30, 'a_ssrc': 7199693, 'a_payload_type': b'n', 'a_max_bitrate': 24, 'a_rtcp_interval': 5.0, 'a_comfort_payload_type': b'\r', 'id': UUID('354c0cb7-b90d-43c9-945e-b055c3460ee0'), 'stream_idx': 1, 'address': '10.0.0.11', 'v_port': 49975, 'v_srtp_key': 'rN9Dp2awrEL95DURNTPPsAjRmVr8uxI9cvA2+HMS', 'a_port': 54504, 'a_srtp_key': '9c12CUszKDh4s0ce/cSNd0Z+EjX0Ks39skxRoBSY'} HomeKitLink Siri Debug
Executing start stream command: ['./ffmpeg/ffmpeg', '-rtsp_transport', 'tcp', '-probesize', '64', '-analyzeduration', '0', '-re', '-i', 'rtsp://boisy:!!!@imac.local:8000/stream?cameraNum=4&width=1280', '-map', '0:0', '-c:v', 'libx264', '-bf', '0', '-pix_fmt', 'yuv420p', '-color_range', 'mpeg', '-f', 'rawvideo', '-r', '20', '-b:v', '299k', '-bufsize', '2392k', '-maxrate', '299k', '-payload_type', '99', '-ssrc', '5646290', '-f', 'rtp', '-srtp_out_suite', 'AES_CM_128_HMAC_SHA1_80', '-srtp_out_params', 'rN9Dp2awrEL95DURNTPPsAjRmVr8uxI9cvA2+HMS', 'srtp://10.0.0.11:49975?rtcpport=49975&localrtcpport=49975&pkt_size=1316']
HomeKitLink Siri [354c0cb7-b90d-43c9-945e-b055c3460ee0] Started stream process - PID 74534 HomeKitLink Siri [354c0cb7-b90d-43c9-945e-b055c3460ee0] Stopping stream.`