2

I am looking for a way to live stream the audio from my USB microphone through a WiFi hotspot via mobile data to an online website / the cloud. My goal is to stream my performances to the people who could not come. Since there is no available WiFi usually, I wish to use my phone as a WiFi hotspot, connect the Pi and have it livestreaming.

Icecast could be used by port forwarding, but that is not possible on a phone hotspot.

I found multiple ways for livestreaming video to YouTube, and if it is possible to add my audio to such livestream I would be happy to add a Pi Camera. But I couldn't find if it is possible to add audio to a YouTube livestream.

Does anyone have a recommendation on how to solve this problem?

StevenCellist
  • 33
  • 2
  • 8

1 Answers1

3

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.


Domain name

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:

domain.com

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:

curl icanhazip.com

Imagine you got the output below after running that command as your public IP address:

12.34.56.78

Cloudflare

  1. Sign up on cloudflare and add your domain name there.
  2. Add the Cloudflare preferred NS1/NS2 DNS to your domain name on the domain name registrar.
  3. Add these DNS query on your domain dashboard on Cloudflare:
    Cloudflare DNS query
    • 12.34.56.78 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 /etc/dhcpcd.conf:

static domain_name_servers=1.1.1.1 8.8.8.8

The 1.1.1.1 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.


Camera stream

Install motion package on the raspberry pi as your camera web-streamer.

apt install motion
  1. installation:
    Video Streaming from raspberry to an external server

  2. Configuration:
    /etc/motion/motion.conf
    You can configure stream quality according your bandwidth limitations.

  3. Make it more secure:
    Motion security
    If you are concerned about the security of the streams, you can make it much more secure with some configuration and insight.

The motion camera streams would be checked on domain.com:8081.


Audio stream

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.


Conclusion

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.


References

Mohi Rostami
  • 4,434
  • 1
  • 20
  • 39