In this page i am going to explain how to run FFMPEG on your computer to copy a stream from to another streaming server. FFMPEG is an open source program for converting media formats, it happens to support http streaming as well, its a command line program, it doesn’t have a graphical interface.
You will need:
- The stream address of the system you are streaming from
- The login details of the system you are streaming to
- An FFMPEG binary for you system
- A broadband internet connection
1 The stream Address
Most streaming services will provide an playlist file that points to the stream, this is typically in m3u format (https://docs.fileformat.com/audio/m3u/) , it contains pairs of lines, the first starts with a # and contains data about the stream and the second is the stream address that we need to use. Your browser will try to open the stream for you so you will need to save the playlist file and open it in a text editor.
it should like something like http://some.host.com:8080/
2. The login details
You will need a username , a password , a mount point , a server and a port to be able to connect to a server to stream it to, these should be provided by the station owner.
3. An FFMPEG binary
This is the file that contains the program , you can get it from the FFmpeg download page at https://www.ffmpeg.org/download.html
4. A broadband connection
Most peoples home connections should be fine for this without needing to be careful about bandwidth in the home.
If you have problems you can lower the quality to use less bandwidth.
So now we have all the parts, we can start the relay , its just a case of running FFMPEG on the command line and giving a lot of configuration options containing the data we just collected.
To get a command line press Win + R , then type CMD , you will get a black window with a prompt.
The command is pretty complex so i’ve broken out the configuration options into environment variables, with some example content, copy each line separately , paste it into your terminal but edit the values to suit, press enter to submit it.
now you can copy this command in and run that , it will pick up the config you just set before.
ffmpeg -loglevel verbose -re -i "%stream_address%" -acodec copy -f tee -map 0:a "[f=mp3]icecast://%login%:%pass%@%hostname%:%port%/%mount%"
Follow these instructions to open a Terminal window , then in that Terminal where you can follow the linux instructions.
If you are less comfortable with the command line you might want to copy all of the lines into a text editor where you can edit them then copy paste them all at once into the Terminal to run them, doing it this way also makes it easy to save the configuration you use as a file for simple reuse and distribution.
Get to the terminal or a shell , paste in each line and edit the values before pressing enter. then run the ffmpeg line unedited.
ffmpeg -loglevel verbose -re -i $stream_address -acodec copy -f tee -map 0:a "[f=mp3]icecast://$login:$pass@$hostname:$port/$mount"
Running and restarting
You should get text explaining what is happening , to exit press q or Ctrl+C
if you press up you can go back through previous commands , you can the edit and then press enter to re-run them. the values will stay set untill you close the terminal. then when you have finished changing the variables, presss down untill you get the big FFMPEG line, press enter to re run it.