2

Problem : I want make live stream from my camera attached to Raspberry pi 3 b+, which is connected to home WiFi. Streaming should be over internet. So that any client like Android/ iOS can stream it from anywhere. It is a security camera. There can be multiple Raspberry pi connected to home WiFi.

What I have tried :

1. Raw H.264

I could achieve the same by generating raw H.264 which android app could render. It was perfect. But this needs global IP and port to stream over internet. Problem in this method - I can not assign global IPs to multiple raspberry pi. and it needs port forwarding. Which is not acceptable in automated setup of security camera.

2. Another way

Tried this way too, but this tutorial shows a way to stream locally.

What is needed? What is preferred way to stream Raspberry Pi camera over internet to any device (at least Android/iOS)?

What could be the methods that YI Home Cameras are using?

hardillb
  • 12,553
  • 1
  • 20
  • 34
  • Hi @KushSwarnkar, please note that cross-posting materially identical questions between sites on Stack Exchange is discouraged—particularly as you have already received multiple answers on the other site. If you need to clarify your question please [edit] to explain why previous answers are not suitable. Thanks. – Aurora0001 Mar 24 '19 at 13:39
  • Hi @Aurora0001, I'm asking how can I made web socket based server which will working as relay switch(bridge) between raspberry pi and android/ IOS App without need of port forwarding.I'm quiet new in web sockets. please guided me how can i setup web sockets server. – Kush Swarnkar Mar 25 '19 at 05:15

2 Answers2

3

If you are not going to allow any form of port forwarding your only option is to have an external server act as a relay.

The cameras will connect out to the known location on the internet and stream video to that location. The mobile app will then also connect to the server and stream data from there.

This solution also means that the mobile app doesn't need to know the IP address of the camera, which might change over time.

This is how nearly all the commercially available IoT "security" cameras work.

hardillb
  • 12,553
  • 1
  • 20
  • 34
  • The simplest solution which most of the people end up with. – atakanyenel Mar 21 '19 at 20:47
  • your answer reaches to our requirement. please guide me how can i setup our own server using python? it is better you guide me flask-socket-io for make web socket connection between server and raspberry pi. I'm waiting for your reply. – Kush Swarnkar Mar 22 '19 at 04:59
1

IPv4 Address: If the Pi has been assigned an RFC 1918 non-routable IPv4 address- as you indicate it has- you'll have to use a DNAT, mapping the local IP of the Pi to the Public IP on the router. You'll configure the DNAT in the router. Then when a viewer attempts to access camera, the router will forward the traffic to the Pi on the internal IP address. In short, access to the camera must be proxied from the router to the camera- no direct connectivity is possible to it from the Internet.

IPv6 Address:. However, if you can assign the Pi a Global Unicast IPv6 address, no NAT'ing is required: viewers can hit the camera directly. Please note though that visitors will themselves require IPv6 connectivity to hit your camera.

Both IPv4 & IPv6 addressing methods will of course require entries in DNS to be accessed by a name.

F1Linux
  • 111
  • 2
  • DNAT is port forwarding.... – hardillb Mar 21 '19 at 16:52
  • 1
    Yes, I know-I’m a network engineer. – F1Linux Mar 21 '19 at 16:59
  • The question specifically says without port forwarding – hardillb Mar 21 '19 at 18:31
  • I know- I was explaining why he cannot gain direct access with IPv4 addressing, only an IPv6 Global Unicast address. RFC-1918 address are non-routable on the Internet. Don’t think the OP understands this nuance about local addresses – F1Linux Mar 21 '19 at 18:40
  • 1
    your answer is fine, for another network engineer. But the main point I was trying to make is that using RFC numbers (without linking to the doc/wikipedia) and acronyms like DNAT without pointing out that it is the technical name for port forwarding doesn't make it easy for a novice to understand. – hardillb Mar 21 '19 at 20:50
  • Very fair point bud! I try to be precise in my answers as the other sin is being too vague. It’s always a bit tricky getting the level right to target an answer – F1Linux Mar 21 '19 at 20:59