Is it possible to send an mp3 file to IceCast via a script from a webpage?

973 Views Asked by At

Can someone please tell me if its possible to have a server send an mp3 to our own Icecast server (running on linux). Could this be achieved in Perl or PHP?

Maybe there is a better way to push audio clips remotely to other computers though?

Here is the complete idea or hope:

  1. A user visits a website where they reorder audio clips.

  2. These clips are then joined together to make a single mp3 file (using mp3cat for example) which can then be sent to an IceCast server to be broadcast.

  3. The computers will be left running and remain listening to the station 24/7. We do not want them to disconnect from the station during moments of silence on the station. The computers will playback silence for a lot of the time until a web visitor makes an audio file to be broadcast. If there is no audio to be played by IceCast would that force the radio playback to disconnect or would it just playback silence until it received an audio clip?

Is this possible?
Would websockets or some push framework be another or better option to achieve the same thing?

1

There are 1 best solutions below

2
On

The way to do this project would be to do your Icecast source connections server-side. Write an application that accepts control commands from the browser client (AJAX, WebSockets, anything) and then encodes all of the audio for the correct codec and bitrate server-side, sending this final stream to Icecast. This server is also responsible for generating silence while nothing is playing.

I've actually built something similar to this awhile back. I used Node.js and Socket.IO for the browser part, and a loopback audio driver for the rest. If I were to do it again, I would probably utilize FFMPEG or VLC for the playback/encoding server-side.