[How-to] Stream non ogg radio to js radio resource

Hi,

A little tuto to explain to you a little interesting trick allowing you to stream non-ogg radios to ogg supported by the js radio resource on windows or linux server.

Links:


1 - Install Icecast2 from https://icecast.org/download/
edit the config file icecast2.xml ( C:\Program Files (x86)\Icecast2\Icecast.xml or /etc/icecast2/icecast.xml )
Define the main parameters <location>,<admin> and <hostname> (optional), <sources> is the number of stream to serve, and clients the max client allowed to listen on your server.
Change the <admin-user> and <admin-password> at your convenience (not leave defaut).
Define a hard and useless <relay-password> (not leave defaut).
Define a hard <source-password> which you will need later.
Finally uncomment the line <binddd-adress> and change it from:

<!-- <bind-address>127.0.0.1</bind-address> -->

To

<bind-address>0.0.0.0</bind-address>

Possibly if you want to change the default port which is 8000 …
After that, start icecast with the .bat include with the config file on windows, on linux depending on your installation, /etc/init.d/icecast2 restart or …

2 - Download and extract/install ffmpeg
On windows you need to have the bin/ffmpeg.exe. On linux you need to install it with your distro depot or use a static build to have the binary ffmpeg.

In both cases, the command is almost identical. Create a new text file, .bat on windows, .sh on linux and place the code below, by adapting ‘your_source_password’,‘http://url_from_other_radio/stream.mp3’ and ‘your_radio_name’ parameters
On windows:

a:
ffmpeg -i http://url_from_other_radio/stream.mp3 -c:a libvorbis -q:a 1 -content_type application/ogg -f ogg icecast://source:your_source_password@127.0.0.1:8000/your_radio_name.ogg
goto a:

On linux:

#!/bin/bash
while true do
ffmpeg -i http://url_from_other_radio/stream.mp3 -c:a libvorbis -q:a 1 -content_type application/ogg -f ogg icecast://source:your_source_password@127.0.0.1:8000/your_radio_name.ogg
end

Adapt the path of the executable if necessary to it and run this command file. On linux make it executable with chmod +x radio.sh.
Normally, ffmpeg should transcode from the original radio format to ogg in quality fully supported by our GTA =)
Listenable here: http://127.0.0.1:8000/your_radio_name.ogg

FFmpeg may return errors if there are issues such as:
401 - wrong source password with icecast server
libvorbis not supported, under linux depending on your distribution you may need to look for the name of the library allowing you to transcode to ogg.
Remember to open port 8000 on your server.
You can also watch the streams being broadcast at http://127.0.0.1:8000/status.xsl

So, in js radio, the url for your radio to set is http://your_server_address:8000/your_radio_name.ogg

And you can replay as many as you want by recreating a command file, just change the broadcast name at the end of the icecast address (your_radio_name.ogg) and the source url to another radio to stream. Think to edit the icecast.xml if you want to stream more than 5 sources

In case of problems always say, if ever I can help I would!

5 Likes

i think this is in the wrong category

I have done all that is needed but when i go on to where the .ogg should be i get a empty list like this: Screenshot - 5f83d9fffcadfd13536f45fdf6b01eb5 - Gyazo

This is because your ffmpeg doesnt transcode on it !
Check the ffmpeg window to show if error is returned (404,403 or bad url?)

If you are on about the .bat when i open it, it just closes straight away

So, to show error, on start menu type “cmd” and press enter, after that type:

CD C:\path\to\ffmpegbat

If your ffmpeg.bat is i e on your desktop, the path should look like this:

CD C:\Users\YourUserName\Desktop\

if there is on another hard disk you must call it to switch (befor or after the cd command, same), for D in example:
D:
CD D:\path\to\ffmpeg
And after, call the .bat file directly in this window, it shouldn’t close that way so you can show error.

Hey there,

i’m very new to all this stuff but i figured out how to get this running.
Now i’m searching for a solution to put different streams into only one batch. Are there any ideas how to do this?
For now i’ve simply copied the command shown in first post but then only the first radiostream will start and there are no errors shown.

Kind regards :wink:

Hi !

use “start” commande beforte start your program, but I think is not a good idea, the batch file it’s a loop to restart transcoding whein it’s stop/bug, the “start” windows command start the program followed in a new thread, this not stop the actual thread to wait which the transcoding stop/bug, so you must think to a new solution with that ^^’
On linux I’ve started multiple streams whith a “screen” (detached command line window). But on windows, I dont known how help you now !

I get this not work how to fix?

I have Icecast server on OrangePi at IP 192.168.1.27 on Local

this is a .sh file

Can you show me your listen section from icecast.xml please?

Now i can run without .sh script it’s worked!

i need help with this on windows it not works i get a loop of things