Any using Homebridge to view their SecuritySpy cameras in HomeKit... how's the experience?
According to the Tested Configurations page it looks like it's a pretty simple process to connect SecuritySpy -> HomeKit through Homebridge:
https://github.com/KhaosT/homebridge-camera-ffmpeg/wiki/Tested-Configurations#securityspy-for-macos
If anyone is currently running this, mind weighing in on the following?
•How reliable is the configuration?
•Approx how long does it take in HomeKit for a live stream of one of your SecuritySpy cameras to start playing back?
•Are you able to get audio (in addition to video) from your SecuritySpy cameras when viewing them in HomeKit?
•What about two-way audio? Like sending audio back from HomeKit to your camera's speaker (if your camera has a hardware speaker of course)
•Does the homebridge-camera-ffmpeg plugin create a "motion sensor" accessory in HomeKit from your SecuritySpy's camera motion detector? (I don't think so but would like to confirm.)
•Any other general thoughts on the setup?
Thanks in advance!
Comments
-
Reliable - yes, for snapshots every 10 seconds, more so than video.
It takes around 10 seconds to start a live stream after selecting a snapshot in the home app. I'm running homebridge on a 2019 Mac Mini.
No two way audio (that I'm aware of)
General thoughts - I did this just to have a snapshot view in the home app, via homekit. It doesn't work great for live viewing, and I would not suggest it as a replacement, it is not even close to the functionality of the SS app. It is nice to have a single spot to view all smart home devices quickly, which is what I use it for. -
Awesome, thanks for the feedback @startak11 Good to know ahead of time that it's good for quick reference of snapshots but not great for live viewing. Appreciate your post!
-
@startak11, are you using "one-way" audio? For hearing the audio coming from your cameras? (understood that two-audio isn't possible)
-
It works but only to view. I haven’t managed to get 1-way audio to work. There is either a missing library for ffmpeg or I need a setting in my config.json. There is a 12 second lag in streaming. I’m running homebridge on a Raspberry Pi 3b+ and SS on a 2012 Mac Mini.
-
I have 4 PoE cams:
2 x Gadinan 1080p
1 x Lorex (LNB8963) 3840p
1 x JideTech PTZ (IPD-E2B5Y18) 1080p (20x optical)
All working in SS and all cameras have "deny all" in firewall LAN setup.
I use ZeroTier to access SS via iOS or webpage so no port forwarding setup on router nor do I need any dyndns service with ZT.
I have Hoobs configured and am using ffmpeg plugin to go directly to cameras given PTZ is not available that I can see.
If SS offered passthrough (obviously/only if desired cam equal to HomeKit encode requirements) of camera and PTZ, I'd switch in a heartbeat!
Currently, feeds take about 4 seconds and that is ~ the lag also.
Cheers -
I have this working well, though without audio, using the "Authentication in URL" method described in the web server docs.
http://bensoftware.com/securityspy/web-server-spec.html#authInURLDiv
I don't know why doing it this way works better, but it does. Here's a config example:
{
"name": "Camera FFmpeg",
"cameras": [
{
"name": "Front Door",
"videoConfig": {
"source": "-i https://192.168.1.1:8088/++video?auth=YOUR-BASE64-ENCODED-CREDENTIALS&cameraNum=0&width=1600&height=1200",
"stillImageSource": "-i https://192.168.1.1:8088/++image?auth=YOUR-BASE64-ENCODED-CREDENTIALS&cameraNum=0&width=1600&height=1200",
"maxStreams": 6,
"maxFPS": 10
}
}
],
"platform": "Camera-ffmpeg"
},
}
The cameras I'm using all output 2560x1920 (4:3) into SecuritySpy and I only use 10 fps. They work extremely reliably via Homebridge now with stills and instantly starting video in the Home app.
Sadly, every time I try to enable audio the feed falls over, though as this is going through FFMPEG there is bound to be a way to fix that, I'm just not bothered enough to try. The only time I review audio tends to be from the recorded file, which is one of the things I use the SecuritySpy iOS app for. -
@andydvsn I'm using your configuration here to pull one of my cameras into Homebridge to test.
The preview works, but live video never loads. But if I go to the URL of my "videoSource" in a browser, it loads instantly. Any thoughts of what I can poke at to get it working?
-
Follow up, if you found a way to use motion detection to Monck a doorbell via Security Spy, I’ll buy you a beer if you walk me through it.
-
@mikejandreau Hmm, that's odd - something has changed, and recently at that. It used to work fine but now I see the same issue as you; the previews load but the live video doesn't play. This is with the latest Homebridge and running Camera FFmpeg as a child bridge (which usually improves performance). I'll need to have a mess around.
Motion detection to mimic a doorbell... do I have that right?
-
Okay, I've had a mess around and something is just plain weird.
The only way I got some sort of choppy video to work was with these sort of settings:
{
"platform": "Camera-ffmpeg",
"name": "Camera FFmpeg",
"videoProcessor": "/usr/local/bin/ffmpeg",
"cameras": [
{
"name": "Front Door",
"videoConfig": {
"source": "-i http://127.0.0.1:8080/++video?auth=[key]&cameraNum=0&width=1600&height=1200",
"stillImageSource": "-i http://127.0.0.1:8080/++image?auth=[key]&cameraNum=0&width=1600&height=1200",
"maxStreams": 6,
"maxFPS": 10,
"maxBitrate": 8000,
"packetSize": 188,
"forceMax": true,
"vcodec": "h264_videotoolbox"
}
Basically, the bitrate seemed to be awfully low, so I forced it up and brought the packet size down. It doesn't work well, but it sometimes shows a slideshow of images. I have no idea what has broken, but it's not SecuritySpy. 😕
The h264_videotoolbox setting is probably a good idea on any recent Mac to use hardware encoding.
Guess it's just one to keep an eye on unless somebody has a brainwave.
-
"Basically, the bitrate seemed to be awfully low."
The ideal settings for Homekit cameras are h264 variable bitrate at 2Mbits with a 4 second keyframe interval, either 15 or 30 fps, and aac audio. Your bitrate is actually four times what Homekit likes. With a variable bitrate the video is quite good for being 2Mbits.
If you want to get video from Security Spy to Homekit you should really use Scrypted. I used Homebridge and video would take 4-5 seconds or longer to load. With Scrypted I have 15+ cameras and they literally load instantly. AND it supports HKSV so you get recording, object detection and facial recognition. It's MUCH better for cameras than Homebridge is.
All of these cameras are being fed into Scrypted using RTSP from Security Spy:
Here's a link for it. It runs fine on a Raspberry Pi. It's so much better for cameras in Homebridge that's it's hard to even compare them.
-
Hey @emergent - very interesting, thank you for this. I'd not heard of Scrypted before, I shall investigate.
Sorry, I should have been clearer - the bitrate being requested by HomeKit was awfully low, so ffmpeg was battling to squash the footage to the requested size. Regardless, my interest has already turned away from this and towards Scrypted. How fickle I am. 😁
-
Played with this a bit last week, on the whole I'd say Scrypted is indeed a better solution for getting SecuritySpy cameras into HomeKit than using Camera FFMPEG under Homebridge. For whatever reason the Homebridge solution never worked with audio, ever. That's one element which works just fine with Scrypted. Also, whatever weird bug had recently begun preventing live video from working at all is not present in Scrypted, so two points up.
I've discovered that a motion sensor of some description can be tied to a camera to enable HomeKit Secure Video, but it's pointless running that motion detection through Scrypted as SecuritySpy is likely already processing this for you. What I'd like to figure out is how to trigger the virtual motion sensors with a script fired by SecuritySpy... though there is some argument that this is pointless given SecuritySpy is likely also handling all your capture needs too. Could be a useful backup, I suppose.
@kaps For my use fetching direct from SecuritySpy has been the best solution, as Scrypted is running on the same machine. That way you're not doubling your network traffic and load on the cameras. You can also downscale your video with minimal overhead, which I've found is necessary, as HomeKit chokes if I send the full resolution. These are the URLs I use for the snapshot and live video respectively:
http://127.0.0.1:8080/++image?auth=[token]&width=640&height=480&cameraNum=3
rtsp://127.0.0.1:8080/stream?auth=[token]&width=1280&height=960&cameraNum=3
Sadly, I do appear to need to use HomeKit Transcoding to make the video reliable, otherwise it just never loads. On the HomeKit Transcoding tab I have both "Transcode Streaming" options ticked and these settings for "Video Decoder Arguments" and "FFmpeg arguments" respectively:
-hwaccel auto
`-c:v h264_videotoolbox -b:v ${request.video.max_bit_rate * 8}k`
HomeKit always requests video at a max bitrate of "299" and this results in a mushy slideshow. Increasing the multiplier to 8 sets a rate of about 2400 kbps, which appears to have minimal overhead on my system and streams usually kick in within 3-5 seconds of selecting them in the Home app.
-
i've installed scrypted trying to move this from homebridge, but after adding my camera streams from security spy , it's still black in scrypted's live preview, although i've been able to add it as a bridge to my home.
i'm using your URLs, although with my server's port number as i'm running sabnzbd on 8080, (and i have scrypted running on the same machine as SS)
did you have any trouble?
i can view the streams via VLC / and the image via a browser. the only error's i'm seeing in the console are 401, which i think have to do with bad passwords. I was assuming it was authenticating with security spy using the username and password fields, but now i'm thinking i should be including them in the URL?
this would be tricky as some of my passwords have syntax such as "@".
Thanks for any thoughts you might have.
-
Sounds like you need to add your authentication token into the URL, it shouldn't be asking for a username and password.
Read the "Authentication in URL" section at the bottom of this page and replace [token] in the URL with your actual Base64-encoded username and password. And, obviously, keep your token secret. :)
-
first, thank you for your quick response. i'm embarrassed that i had found that page, read the top half and then called it a day before seeing the base64 part. Thank you, i only blame that it was midnight when i found out about this and 2 when i gave up.
however now i'm just getting invalid argument errrors. (unable to find a suitable output format for rtsp://xxxxxxx invalid argument)
it even does this when i only leave in the auth string and camera number string.
to double check the syntax "rtsp://127.0.0.1:8000/stream?auth=myuser:passwordencodedinbase64&cameraNum=0
tried different camera numbers, and i'm using "perform URL safe encoding" in the base64 page. i've tried it using the codec argument on and off, and want it the way you have it (for 720p).
not sure what i'm still doing wrong. Apologies.
-
Hi @jessedegenerate I can tell you that the format of that RTSP URL is correct, assuming that the camera number and auth parameter are OK. You can see camera numbers in the Camera Info window in SecuritySpy (if you don't see this column, click the header bar where you see the column names for a menu that allows you to add/remove columns). The error about a "suitable output format" does not come from SecuritySpy.
-
thanks ben, must be with authentication, as they work in VLC (which prompts me). Can you confirm i can use "perform URL safe encoding" when turning my passwords into hash's in the base64 page? i need it for some of my passwords that contain characters like @ that would be parsed.
-
Just looking at your URL, @jessedegenerate... I think you've only encoded your password. The token needs to be both your username AND password separated by a colon in Base64. So you need to enter "username:password" without quotes into the website.
That would explain why it's not working and why VLC still prompts you to authenticate. When it's correct all authentication required is in the URL already.
-
For those running Scrypted, how are you adding a Linked Motion Sensor in order to enable HKSV? It looks like Scrypted can't see any HomeKit sensors or switches, but there is a Dummy Switch plug-in for Scrypted. Maybe if you add that, it will also show up in HomeKit, and then allow SecuritySpy to flip that Scrypted Dummy switch and start recording? I just installed this tonight so I haven't had much time with it. Most of my time was getting the rtsp feed from SecuritySpy to feed into Scrypted.
Side note: To get the rtsp feed to work, you must enable http web server (not just https), and use that http port for rtsp port. AND, if that port is already in use, you won't see a notification or error when SecuritySpy starts, and rtsp still won't work. So, check your error logs or pick a port you know isn't being used.
-
That's the approach I was going with, but as I use SecuritySpy for my recordings I've been in no hurry to complete this, so haven't got any further. Scrypted is working well for getting the video into HomeKit and that's pretty much all I needed. It's only there so family can quickly view the SS feeds without needing to install anything extra. Zero effort on their part wins the day.
My plan was to use SS's own motion detection to trigger a script to run, which would do something (maybe an HTTP request) into Scrypted and trigger that virtual switch attached to the camera. If you get anywhere, please post back! :)
-
So I was able to trigger HKSV to record by using a Scrypted Dummy Switch. In the Dummy Switch Plug-in Settings, I clicked 'Add Dummy Device (shell script)'. I just typed in a name like 'Test Switch'. It will then show up below (same screen) as a switch that you then need to configure. I selected Type: Switch, then ROOM then checked HomeKit. I left REST at 10 seconds. That's how long the video clip will be.
Go back to your Scrypted camera settings, and you'll see now for HKSV, you can select your new Dummy Switch.
The Dummy Switch will also show up in HomeKit so you can trigger/test it out. This should trigger a video clip, but for awhile it didn't work.
At first, it was not working, even though I was routinely restarting Scrypted, HomeKit, even Rebooted. But eventually, I could trigger the switch in the Home app, and get a video clip.
What I haven't been able to do, because I think there is a strange bug in Security Spy, at least for me, is to get Security Spy to activate the Dummy Switch that was setup in Scrypted. Normally you just need to add a HomeKit Action using SecuritySpy, and then in the Actions section of SecuritySpy, you can select a HomeKit Action when motion is detected. The Action would be this new Scrypted Dummy Switch. For me, my Actions dropdown in SecuritySpy just says NONE. My HomeKit Actions are actually showing up as HomeKit TRIGGERS in SecuritySpy. For some reason, they aren't showing up as an Action that I can select when motion is detected.
OH! Also, the Home app on my phone at some point gave me some new Windows/Messages/Options... it was weird... it said my iCloud+ account was upgraded to support unlimited cameras, and then I could tap 'Continue' and setup which cameras recorded, and when, etc, but yeah, I think you might wanna keep an eye out for this as well. Things didn't start recording in HKSV until I saw that on my phone, and tapped through it's prompts. Scrypted seems to have triggered something on Apple's backend that needed to change, as I had no other HKSV cameras configured UNTIL I started running Scrypted.
-
@andydvsn I am just starting working to get Scrypted setup in a similar manner to you (running on the same Mac as SecuritySpy to avoid extra overhead/load on the cameras and network.
You said: "You can also downscale your video with minimal overhead, which I've found is necessary, as HomeKit chokes if I send the full resolution"
How are you doing this exactly? Doing that ONLY via setting the width and height in the URL? Or are you using a lower-quality sub-stream from the camera itself?
Although Scrypted seems pretty cool, the "documentation" seems disjointed and far-flung so it may take me a little while to get this going. But certainly, some of the information in this thread should help. Thanks!
-
@andydvsn I re-read your post and it seems you are not using a substream to feed Scrypted.
Now I am trying to configure the Snapshot URL and the RTSP Stream URL. This is new to me. Here's what I came up with
https://10.0.1.17:8001/++image?auth=[Base64encodeduser:pass]&width=640&height=480&cameraNum=1
rtsp://10.0.1.17:8001/stream?auth=[Base64encodeduser:pass]&width=1280&height=960&cameraNum=1
The Snapshot URL works. The RTSP stream does not :-(. IP address and encoded username/password seem to work OK since its the same as the one I used in the snapshot URL (which does work).
This RTSP fails even in VLC so I don't think my problem is specific to Scrypted. Does anyone have any ideas?
-
Read through my posts here. Maybe its the same problem I had getting RTSP to work. I had said.... Side note: To get the rtsp feed to work, you must enable http web server (not just https), and use that http port for rtsp port. AND, if that port is already in use, you won't see a notification or error when SecuritySpy starts, and rtsp still won't work. So, check your error logs or pick a port you know isn't being used.
I had not checked http in SecuritySpy, so I had to do that, and then I also had to change the port as SecuritySpy logs complained port was already in use.
-
Yes, that sounds pretty likely as the RTSP stream is not encrypted so is likely provided by the same server as the HTTP feed. I personally don't feel there's much need to bother with HTTPS on your internal home network, but your opinion may differ.
-
Activated http (8000) in SS and confirmed that worked. Thanks for that! I guess I didn't realize that it would have mattered. But when @andydvsn said "the RTSP stream is not encrypted" that got me thinking...is this like the difference between HTTP and HTTPS? Was there an RTSPS equivalent? The answer is YES.
I have now deactivated HTTP/8000 in Security Spy and use
https://10.0.1.17:8001/++image?auth=[Base64encodeduser:pass]&width=640&height=480&cameraNum=1
rtsps://10.0.1.17:8001/stream?auth=[Base64encodeduser:pass]&width=1280&height=960&cameraNum=1
Now I have my cake (HKSV/Scrypted feed) AND can eat that proverbial cake (SSL security), too.While I agreee with @andydvsn that this may not be overly necessary for internal home network use, I still prefer it.
Long story short...change RTSP:// to RTSPS:// and you can use 8001 successfully for this use case. Just wanted to share that in case it is useful for others. I love this community.
-Cameron
-
Oh cool.. I did not know about RTSPS! Thanks for the info!
BTW, Im sending Apple 1920x1080, however at one point I was sending 4K, and contrary to what Ive been reading about HKSV limited to 1080, it was storing 4K. I could download it back from iCloud, into the photos app, and it said 4K 3840x2160. For some reason when I tried it again, it wasnt working. But SecuritySpy didnt like it either. SecuritySpy would throw up an error "Sustained hang.." Memory or CPU issue, I dont know. Anyway, not only does Scrypted give easy access through Home App, and offline backup, I am now able to use my Ring doorbell camera. I even use my other Cameras to be the motion trigger for Ring camera, so it now records more often, and is easy to view in HomeKIt. W/o a Ring subscription it wasn't very useful.
-
I'll play around with the resolution as well as enabling VBR on the cameras themselves (I am pretty sure all 10 cameras use CBR currently). Right now just feeding 1280x960 which looks "OK". But at least I have all the cameras showing up in the Home app now. So that was my first day with Scrypted.
Now I have to learn how to actually store, view, and retrieve recordings to/from iCloud. Haven't done that yet - right now everything is just "dumb"/direct live stream from SS to HomeKit.
I'm sure I'll figure all this out in due time, but if you (or anyone else) wants to shortcut my education, here are some questions I don't yet know the answers to:
What steps are required to enable recordings to iCloud? Currently, my cameras in Home app have no options to record (or use automation). So obviously there is still something to configure/enable I haven't gotten to yet.
Can you get Homekit notifications from motion detection if you don't go all the way back to the camera to feed Scrypted? I get that if you feed Scrypted directly from the camera you can use the camera-built-in motion detection. But is something similar possible if you feed Scrypted via RTSP from SecuritySpy? If so, what process "tells" scripted there is motion detected by SecuritySpy?
Thanks, everyone.
