Ices0 (deze ondersteund mp3) moet je zelf bouwen. Gedaan op Pi
Bouwen op Raspberry Pi
Download libshout vanaf: https://icecast.org/download/
Download ices-04 vanaf: https://icecast.org/ices/
Install additonle packages:
sudo apt install libvorbis-dev libogg-dev libogg0 libmp3lame-dev audacious sudo apt install libflac8 libfaad-dev faad sudo apt install libxml2-devel #dit lukt me maar niet ... sudo apt-get install libxml2-dev # doet het wel.... # MP4 en FLAC krijg ik nog niet aan de praat :)
Eerst libshout bouwen
cd $HOME/libshout-2.4.6 ./configure make sudo make install
Daarna Ices0
cd $HOME/ices-0.4 # # Standaard geven alle exit codes ongelijk 0 aan dat er wat fout is gegaan. # Echter in dit geval is alles goed gegaan. Even glad strijken. # Open je favoriete editor met het bestand ices-0.4/src/setup.c. # Spring naar regel 136 en verander daar exit(1) in exit(0) # ./configure # Let op: je zou nu support moeten hebben voor: # ... # Features: # XML : yes # Python : no # Perl : no # LAME : yes # Vorbis : yes # MP4 : no # FLAC : no # # en natuurlijk mp3 maar daar gebruiken we ices0 juist voor :) # # Maarrrrrrrr ... wil je FLAC ook hebben dan moet je FLAC 1.1.2 gebruiken .. die is oudddddd...... # en je moet libflac-dev via apt install installeren # Ik laat het even voor wat het is ... # make sudo make install
Om ices0 (voor mp3) te gebruiken gebruik je het commando /usr/local/bin/ices
Een voorbeeld configuratie file staat hier: /usr/local/etc/ices.conf.dist
Configureren
Zorg dat je de m3u playlist met mp3 bestanden ergens hebt staan. Maak het je gemakkelijk en noem het test.m3u
Het is een m3u bestand met allemaal mp3’s, dus het mountpunt noemen we /test.mp3 want er komt een mp3 stream aan (die gevoed wordt uit een m3u bestand)
Maak vervolgens in /etc/icecast2/icecast.xml een mountpunt aan voor deze ices0 source:
<mount> <mount-name>/test.mp3</mount-name> <password>hackme</password> </mount>
Maak vervolgens een configuratie bestand (/etc/ices0/test.xml) aan voor deze ices0 instantie
<?xml version="1.0"?> <ices:Configuration xmlns:ices="http://www.icecast.org/projects/ices"> <Playlist> <!-- This is the filename used as a playlist when using the builtin playlist handler. --> <File>/Media/audio/Playlists/arjan/test.m3u</File> <!-- Set this to 0 if you don't want to randomize your playlist, and to 1 if you do. --> <Randomize>1</Randomize> <!-- One of builtin, perl, or python. --> <Type>builtin</Type> <!-- Module name to pass to the playlist handler if using perl or python. If you use the builtin playlist handler then this is ignored --> <Module>ices</Module> <!-- Set this to the number of seconds to crossfade between tracks. Leave out or set to zero to disable crossfading (the default). --> <Crossfade>0</Crossfade> </Playlist> <Execution> <!-- Set this to 1 if you want ices to launch in the background as a daemon --> <Background>0</Background> <!-- Set this to 1 if you want to see more verbose output from ices --> <Verbose>0</Verbose> <!-- This directory specifies where ices should put the logfile, cue file and pid file (if daemonizing). Don't use /tmp if you have l33t h4x0rz on your server. --> <BaseDirectory>/var/log/ices0</BaseDirectory> </Execution> <Stream> <Server> <!-- Hostname or ip of the icecast server you want to connect to --> <Hostname>localhost</Hostname> <!-- Port of the same --> <Port>8000</Port> <!-- Encoder password on the icecast server --> <Password>hackme</Password> <!-- Header protocol to use when communicating with the server. Shoutcast servers need "icy", icecast 1.x needs "xaudiocast", and icecast 2.x needs "http". --> <Protocol>http</Protocol> </Server> <!-- The name of the mountpoint on the icecast server --> <Mountpoint>/test.mp3</Mountpoint> <!-- The name of the dumpfile on the server for your stream. DO NOT set this unless you know what you're doing. <Dumpfile>ices.dump</Dumpfile> --> <!-- The name of you stream, not the name of the song! --> <Name>MP3 Test stream</Name> <!-- Genre of your stream, be it rock or pop or whatever --> <Genre>Diversen</Genre> <!-- Longer description of your stream --> <Description>Van alles wat mp3 stream</Description> <!-- URL to a page describing your stream --> <URL>http://localhost/</URL> <!-- 0 if you don't want the icecast server to publish your stream on the yp server, 1 if you do --> <Public>0</Public> <!-- Stream bitrate, used to specify bitrate if reencoding, otherwise just used for display on YP and on the server. Try to keep it accurate --> <Bitrate>128</Bitrate> <!-- If this is set to 1, and ices is compiled with liblame support, ices will reencode the stream on the fly to the stream bitrate. --> <Reencode>0</Reencode> <!-- Number of channels to reencode to, 1 for mono or 2 for stereo --> <!-- Sampe rate to reencode to in Hz. Leave out for LAME's best choice <Samplerate>44100</Samplerate> --> <Channels>2</Channels> </Stream> </ices:Configuration>
Je kunt testen of het werkt via
ices -c /etc/ices0/test.xml -v
Zorg wel dat je in de configuratie file background op 0 hebt gezet. Waar ik ook tegenaan liep was dat de basedir (/var/log/ices0) soms weg was. Dan gaat er ook van alles fout …
Test het ook als je background op 1 hebt gezet ….. volg de log via journalctl -fa
Maak een service file aan (/etc/systemd/system/ices0-test.service) zodat de ices0 instantie automatisch opgestart kan worden:
# # Copyright (c) 2013 Pascal Bleser <pascal.bleser@opensuse.org> # Authors: # * Pascal Bleser # * http://pyn00b.blogspot.be/2012/11/life-with-systemd-part-2.html # * Werner Fink for the postfix.service file # * Arjan ten Hoopen for modifications for ices # # Description: # # Sart the Ices source for IceCast. # [Unit] Description=Ices source for Playsist test Requires=icecast2.service After=icecast2.service [Service] ExecStart=/usr/local/bin/ices /etc/ices0/test.xml Type=forking User=icecast2 [Install] WantedBy=multi-user.target
De logfiles komen in de directory /var/log/ices/, zorg dat deze bestaat en user icecast2 schrijf rechten heeft!
Doe een deamon reload van systemd zodat systemd ook kennis heeft van deze nieuwe service file van ices0-test.service:
sudo systemctl daemon-reload
Om te zorgen dat ices-betonuur altijd start bij het booten van het systeem:
sudo systemctl enable ices-betonuur
Nu even met de hand starten:
sudo systemctl start ices-betonuur
Controleer of alles geactiveerd is:
sudo systemctl status ices-test
Via de browser naar de IceCast server http://[ip-van-je-icecast2-server]:8000
De stream is nu te vinden via http://[ip-van-je-icecast2-server]:8000/test
Rebooten
Waarom weet ik niet maar de logdir van icecast2 en ices0 is na het rebooten altijd weg. Geen idee hoe het kan … oplossing is bij een reboot deze maken via de cron:
# logdir van icecast2 is (steeds) weg .. eerst ff maken # dit is ook voor ices0 ... waarom ... geen idee @reboot sudo mkdir /var/log/icecast2 ; sudo chown icecast2 /var/log/icecast2 @reboot sudo mkdir /var/log/ices0 ; sudo chown icecast2 /var/log/ices0 ; sudo touch /var/log/ices0/ices.cue ; sudo chown icecast2 /var/log/ices0/ices.cue
Veel plezier
