Building your own gateway - components I used
I have a set of Foscam cameras and wanted to show them on Echo Spot and FireTV without connecting them to Foscam’s cloud service. The Monocle Alexa skill is superb and I am grateful for it. Unfortunately I was not able to make progress with the monocle-gateway component. It appeared to be facilitating the connection but Alexa inexplicably would not connect. (Tried the tunnel, proxy, proxy-tcp tags in the Monocle web configuration.)
When I started going deep into the rabbit hole, I found the postings by Monocle developer Robert on the Amazon developers forum, source modifications to the live555 rtsp proxy server to support Foscams (among others), and generally a lot of tweaking and hacking to make Alexa accept our cameras. All of this for a donation-supported service - thank you @Monocle .
Anyway, I don’t know why monocle-gateway didn’t work, but I decided to try to build out the same thing on my own little Linux box serving my home.
- rtsp-simple-server to proxy RTSP from the cameras
stunnelin front of that for TLS
- a public DNS name in my own domain pointing to the internal IP of my Linux server
- Let’s Encrypt certificate using DNS validation - use the acme.sh script
And the issue with the Foscams is that their SDP contain normal descriptions of RTP payload 0 (PCMU) but Alexa really wants to see an
rtpmapattribute even for that well-known payload. So I used
ffmpegto restream from the cameras into the
rtsp-simple-serveraccording to their documentation (github readme). Since there’s no transcoding going on, this work does not add much delay or CPU usage on my little Linux server.
In the Monocle web configuration, I put my cameras as simply: rtsp://fqdn:443/path where fqdn is the name I put in DNS and got the certificate for and /path is defined in the
And, it works!
In conclusion: just use the great work that @Monocle has already done. He figured out all the hard parts and included all the necessary workarounds in his service. But if you decide to build some of it yourself, the aforementioned components can get you there and if you have any specific questions about them please feel free to ask me.
Simoncle - what type of performance are you seeing? I’ve got a BlueIris server handling my Monocle connection and that added a 3 second delay that doesn’t exist when I go direct to a camera. Very interested in your configuration but I don’t have the platform running to reproduce. Can you share your thoughts?
Did this work for both the 5, 8 and 10 models - do you have the ability to verify?
@jshimota Performance is good. I get a 1-second difference between the stream through Alexa and a direct connection to the camera. I don’t know what you are asking about 5, 8 and 10 models. I have two different models of Foscam (R2C and X2) and Echo Spot, Fire TV stick (2nd gen, non-4k, with Alexa), and Fire Tablet 7" (5th gen).
Attached image shows the stream on the Fire Tablet and VLC connected directly to the camera’s RTSP endpoint.
This post is deleted!
ah. I didn’t pay close enough attention- I see the firestick now - there has been recent dialogs about a nuance between the 5 and 10" vs the 8" having some problems with SSL cert and I have 1 of each so was looking for your feedback thats why my stupid question.
1 sec speeds - wow. I’ve a full 5 second display delay - but I blame that on the BlueIris server being underpowered on my end (and too many HD cams feeding!)
I recently installed a 10Gb switch at a prison to handle some traffic of the 300+ cameras - I’ve been considering getting one for the house and then a few 10Gb NIC for each of my machines (3 servers, 1 workstation). Not sure if that will have any impact on the delay tho. I guess I could throttle the streams and see if the speed improves. When I switched from Direct to cam using Monocle web proxy to BlueIris front ending my cameras I doubled the delay from 2.5 secs to 5. I had to do this because certain cams just won’t work due to various reasons - but the BI solution got all my cameras going :) I’m looking at your solution as a way to possibly improve that delayed response. thanks for all the input!