FiveM Modding Tutorial
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.
1 – Install Icecast2 from https://icecast.org/download/
edit the config file icecast2.xml ( C:Program Files (x86)Icecast2Icecast.xml or /etc/icecast2/icecast.xml )
Define the main parameters
<sources> is the number of stream to serve, and clients the max client allowed to listen on your server.
<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> – >
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
a: ffmpeg -i http://url_from_other_radio/stream.mp3 -c:a libvorbis -q:a 1 -content_type application/ogg -f ogg icecast://source:[email protected]:8000/your_radio_name.ogg goto a:
#!/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:[email protected]: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!
Original source: https://forum.cfx.re/t/how-to-stream-non-ogg-radio-to-js-radio-resource/1691368