It's a complicated project. You should take it to some parts. It's my suggestion and would be happy if other experts improve it.
Anyone can buy a domain name. To do so, you visit a domain name registrar, such as GoDaddy or Namecheap, key in the domain you want to buy, and pay a fee. You can't buy just any domain, of course only one that isn't already registered by another person or business and that bears a valid domain suffix.
Imagine you bought the domain name below:
Find the public IP address
Find your mobile network public IP address by this site:
What's My IP Address? Networking Tools & More
Another approach is that you will connect raspberry pi to your mobile hotspot and fire this command:
Imagine you got the output below after running that command as your public IP address:
- Sign up on cloudflare and add your domain name there.
- Add the Cloudflare preferred NS1/NS2 DNS to your domain name on the domain name registrar.
- Add these DNS query on your domain dashboard on Cloudflare:
220.127.116.11 would be your mobile network public IP address.
domain.com would be the domain name that you have bought.
Set name servers on RPi
Add the line below to
static domain_name_servers=18.104.22.168 22.214.171.124
126.96.36.199 is the Cloudflare nameserver.
Now, it's possible to access your raspberry pi over the internet by a domain name. Note that, generally the IP address of the mobile networks continuously changing and you should change it on Cloudflare manually or do it by the API.
motion package on the raspberry pi as your camera web-streamer.
apt install motion
Video Streaming from raspberry to an external server
You can configure stream quality according your bandwidth limitations.
Make it more secure:
If you are concerned about the security of the streams, you can make it much more secure with some configuration and insight.
motion camera streams would be checked on
The same as camera streaming, there is a lot of tools for you to stream your raspberry pi's audio.
For that, check the link below:
Streaming Audio from a remote Raspberry Pi to my computer
Don't stream audio on the same port number as
motion which is
8081. You should choose another port number and match these two UDP streaming port by your web development coding like JS, etc.
You are going to set a domain name to your variable IP address then access your live Audio & Video/camera streaming. Note that it's a suggestion and you can find a better solution for each part.