So I have a FM radio at my homestead. I move with a mobile studio around and stream fm at different locations. I want to be able to stream audio from location over ethernet to another pi in another network wich receives the audio and sends that signal to the fm stream. So basically my question is how can I simply connect those two pi's over the internet. I hope it's possible that I just have to plug the pi in the power and plug in the ethernet and the pi's connect over the internet automatically to each other.

note: the pi's will be both on a different network and won't be under my control.

This is what I thought I could do:

Using a VPN they connect to and use those intern IP addresses on the vpn network to let them connect to each other. The only problem I'm facing is how I can stream the audio.


So as some people saw this question as answered already... Here the explaination with a diagram:


So I don't know what hardware or software I'll need to accomplish this. Is there someone who can answer this question as soon as possible?

I want to know what PI headers I'll need and what software and how to configure the setup. It doesn't need to be a public stream, I only want a private tunnel to stream audio from point A to point B in another network.

If the diagram above is a bit too less, here is an extended version:


Thanks for the help

Regards Robin

  • Welcome to the site. This is a fairly confusingly worded question - can you confirm that, basically, you'd like to stream some audio from one Pi to another over the internet?
    – goobering
    Feb 5, 2017 at 11:09
  • Yes that is my main goal.
    – Robin
    Feb 5, 2017 at 14:09
  • 3
    Possible duplicate of RPi Streaming Audio Server
    – goobering
    Feb 5, 2017 at 14:36
  • @goobering its not what I want. The thing is the connection between the two pi's can't be accessed. So I don't want to stream to a (public) server. I want to stream from pi1 to pi2 and get the audio from pi2 and listen to the music from pi2 (wich will be connected to an fm stream).
    – Robin
    Feb 5, 2017 at 17:29
  • To the user who keeps flagging @goobering's comment about this being a possible duplicate. Please stop doing so - that is not a reasonable use of flags for moderator intervention. Other users should be able to make up their mind about whether this is a dupe or not themselves. Just because you disagree with that statement is no reason to remove that comment.
    – Ghanima
    Feb 10, 2017 at 23:50

2 Answers 2


You need

  • 1x Raspberry Pi as streaming server with
    • DarkIce
    • IceCast
    • USB soundcard
    • No-IP client


  • 1 x Raspberry Pi client with
    • USB soundcard
    • Music Player Daemon

Diagram of the setup

  1. Use the following guide to set up a streaming server: https://stmllr.net/blog/live-mp3-streaming-from-audio-in-with-darkice-and-icecast2-on-raspberry-pi/
  2. Create an account on no-ip.com and install their client software: https://www.noip.com/support/knowledgebase/install-ip-duc-onto-raspberry-pi/
  3. Memorise your No-IP domainname and the IceCast port number
  4. Open the IceCast port (normally 8000) on your Router ("port forwarding")
  5. Setup MPD on the client Pi : http://raspberry-at-home.com/mpd-music-player-daemon/
  6. Use any smartphone or commandline client to add your No-IP address to the MPD playlist
  7. You are now streaming music or audio over the internet !

well, Seems like pretty idea! Here is how it works:-

First you need to dedicate public ip for both Raspberry Pi's whether Server Client Connection or Server Server or Client Client

Then use that ip to communicate both Pi's :

here is the code for the Server Pi

import socket
class VideoStreamingTest(object):
def __init__(self):

    self.server_socket = socket.socket()
    self.server_socket.bind(('', 8000))# here is your Pi 1 Ip
    self.connection, self.client_address = self.server_socket.accept()
    self.connection = self.connection.makefile('rb')

def streaming(self):

        print "Connection from: ", self.client_address
        print "Streaming..."
        print "Press 'q' to exit"

        stream_bytes = ' '
        while True:
            stream_bytes += self.connection.read(1024)
            first = stream_bytes.find('\xff\xd8')
            last = stream_bytes.find('\xff\xd9')
            if first != -1 and last != -1:
                jpg = stream_bytes[first:last + 2]
                stream_bytes = stream_bytes[last + 2:]

Here is the code for the Client Pi

import io
import socket
import struct
import time
import picamera # Just for Demo
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('', 8000)) # your server IP
connection = client_socket.makefile('wb')

try: # Here is your Code to initialize something Let's Say from Rpi Camera  

    with picamera.PiCamera() as camera:

    time.sleep(2)            # give 2 secs for camera to initilize
    start = time.time()
    stream = io.BytesIO() # here is the main concept

    # send jpeg format video stream
    for foo in camera.capture_continuous(stream, 'jpeg', use_video_port = True):
        connection.write(struct.pack('<L', stream.tell()))
        if time.time() - start > 600:
connection.write(struct.pack('<L', 0))

N.B : i haven't tried with Audio but it works in Video Streaming! the only thing that you need to Change is the Camera Option! if you think this way is better i can help you with code of changing Audio Signals to Bytes! Cheers Isru


Check this Image to Know How it works

  • Let us continue this discussion in chat.
    – Isru
    Feb 11, 2017 at 20:40
  • -1 This does not solve the problem of audio transmission at all.
    – flakeshake
    Feb 15, 2017 at 12:16
  • The question isn't about a problem it's asking a method!
    – Isru
    Feb 15, 2017 at 12:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.