Il est possible de demander au serveur Linux de streamer tous les mp3 et d’envoyer le flux à une radio SHOUTCast
Pour un élément mieux maintenu, je vous conseille LiquidSoap !
Si vous exécutez un Ubuntu 64 bits, il faut installer les librairies 32 bits
apt-get -y install lib32ncurses5
Passons aux choses sérieuses :
On récupère les fichiers 32bits
wget http://bdd.exolia.fr/shoutcast/sc_trans_posix_040.tgz
On créé le dossier qui va bien
mkdir /opt/shoutcast/transcode
On extrait les données de l’archive
tar zxvf sc_trans_posix_040.tgz
On déplace
mv sc_trans_040 /opt/shoutcast/transcode
On créé le fichier de configuration
nano /opt/transcode/server.conf
Avec en contenu du fichier
; sc_trans accepts the following signals: ; HUP - flush logfiles (close and reopen) -- will make console logging stop ; WINCH - jump to next song ; USR1 - reload playlist off disk (will not interrupt current playing stream) ; USR2 - toggle shuffle on/off ; TERM - normal sc_trans shutdown (clean) ; PlaylistFile (required EVEN IF RELAYING) - playlist file (to create, use ; find /home/mp3/ -type f -name "*.mp3" > /opt/shoutcast/transcode/playlist.lst PlaylistFile=/opt/shoutcast/transcode/playlist.lst ; ServerIP/ServerPort are the target server to send to ServerIP=127.0.0.1 ServerPort=8000 ; Password is the password on the sc_serv you're sending to. Password=password ; StreamTitle/URL/Genre define the data that appears on the directory and in the ; stream info. StreamTitle=_Nom Radio_ StreamURL=http://_votre_serveur_ Genre=mix ; Logfile optionally denotes a text file to log sc_trans to. a kill -HUP ; will force a close and re-open of this file (but will also cease logging to ; the console) LogFile=sc_trans.log ; Shuffle the playlist Shuffle=1 ; Bitrate/SampleRate/Channels recommended values: ; 8kbps 8000/11025/1 ; 16kbps 16000/11025/1 ; 24kbps 24000/22050/1 ; 32kbps 32000/22050/1 ; 64kbps mono 64000/44100/1 ; 64kbps stereo 64000/22050/2 ; 96kbps stereo 96000/44100/2 ; 128kbps stere0 128000/44100/2 Bitrate=64000 SampleRate=22050 Channels=2 ; Quality is from 1-10. 1 is best, 10 is fastest. Quality=1 ; Mode=0 for none, 1 for 100/100->100/0, 2 for 0/100->100/0 CrossfadeMode=1 ; Length is ms. CrossfadeLength=5000 UseID3=0 ; Public determines whether or not this station will show up in the directory Public=1
On créé le daemon
nano /etc/init.d/transcode.sh
Le contenu du fichier
#!/bin/sh ### BEGIN INIT INFO # Provides: transcode # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Transcode daemon # Description: Transcode daemon ### END INIT INFO NOHUP=/usr/bin/nohup DIR=/opt/transcode DAEMON="/opt/transcode/sc_trans_linux" DAEMON_NAME=transcode DAEMON_OPTS="/opt/transcode/server.conf" DAEMON_USER=root # The process ID of the script when it runs is stored here: PIDFILE=/var/run/$DAEMON_NAME.pid . /lib/lsb/init-functions do_start () { log_daemon_msg "Starting system $DAEMON_NAME daemon" $DAEMON $DAEMON_OPTS 2> /dev/null 1> /dev/null & log_end_msg $? } do_stop () { log_daemon_msg "Stopping system $DAEMON_NAME daemon" killall sc_trans_linux log_end_msg $? } case "$1" in start|stop) do_${1} ;; restart|reload|force-reload) do_stop do_start ;; status) status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $? ;; *) echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}" exit 1 ;; esac exit 0
On le rend exécutable et on initialise le script
chmod +x transcode.sh update-rc.d transcode.sh defaults
On exécute le service
/etc/init.d/transcode.sh start
On peut contrôler que le service est opérationnel
ps aux | grep "sc_trans"