Inhaltsverzeichnis

Ices2


Ices2 ist ein Kommandozeilen Source Client aus dem Icecast Projekt. Dabei sendet Ices2 Ogg/Vorbis Audiodateien aus einer Playlist oder Soundkartenausgabe an Icecast2. Bevor Ices2 den Stream an Icecast2 übergibt, kann Ices2 die Samplerate und Bandbreite bearbeiten. Aus Lizenzrechlichen Gründen verarbeitet Ices2 nur Ogg/Vorbis Dateien.



Installation


Beispielinstallation aus den Debian Quellen.

root@host:~# apt-get install ices2





Konfiguration


Nach der Installation von Ices2 befinden sich im Verzeichnis „/usr/share/doc/ices2“ das Beispiel init Skript „ices.init.example“, welches verwendet werden kann um Ices2 beim Systemstart zu aktivieren. Ices2 Konfigurationsbeispiele befinden sich im Verzeichnis „/usr/share/doc/ices2/examples“. Die Konfiguration von Ices2 findet über XML Dateien statt.

root@host:/usr/share/doc/ices2/examples# ll
insgesamt 24
-rw-r--r-- 1 root root 3429 Jun  5  2012 ices-alsa.xml
-rw-r--r-- 1 root root 3427 Jan  3  2005 ices-oss.xml
-rw-r--r-- 1 root root 4245 Jul 19  2004 ices-playlist.xml
-rw-r--r-- 1 root root 4529 Jun  5  2012 ices-roar.xml



Ices2 Beispiel Konfigurationsdateien




Die Verzeichnisse für Ices2 müssen mit den jeweiligen Rechten zuerst erstellt werden.

root@host:/var/log# mkdir ices
root@host:/var/log# chgrp icecast ices



root@host:/etc# mkdir ices2
root@host:/etc# chgrp icecast ices2





Lokale Audiodateien aus Textdatei


Um mit einer Lokalen Textdatei zu arbeiten, die Datei „/usr/share/doc/ices2/examples/ices-playlist.xml“ in das Verzeichnis „/etc/ices2“ kopieren und die Rechte anpassen.

root@host:/etc/ices2# cp /usr/share/doc/ices2/examples/ices-playlist.xml .
root@host:/etc/ices2# chmod 660 ices-playlist.xml
root@host:/etc/ices2# chgrp icecast ices-playlist.xml




Die Beispiel Konfigurationsdatei „ices-playlist.xml“ stellt sich wie folgt dar.

<?xml version="1.0"?>
<ices>
    <!-- run in background -->
    <background>1</background>
    <!-- where logs, etc go. -->
    <logpath>/var/log/ices</logpath>
    <logfile>ices.log</logfile>
    <!-- 1=error,2=warn,3=info,4=debug -->
    <loglevel>2</loglevel>
    <!-- set this to 1 to log to the console instead of to the file above -->
    <consolelog>0</consolelog>

    <!-- optional filename to write process id to -->
    <!-- <pidfile>/home/ices/ices.pid</pidfile> -->




    <stream>
        <!-- metadata used for stream listing (not currently used) -->
        <metadata>
            <name>Example stream name</name>
            <genre>Example genre</genre>
            <description>A short description of your stream</description>
        </metadata>

        <!-- input module

            The module used here is the playlist module - it has 
            'submodules' for different types of playlist. There are
            two currently implemented, 'basic', which is a simple
            file-based playlist, and 'script' which invokes a command
            to returns a filename to start playing. -->

        <input>
            <module>playlist</module>
            <param name="type">basic</param>
            <param name="file">playlist.txt</param>
            <!-- random play -->
            <param name="random">0</param>
            <!-- if the playlist get updated that start at the beginning -->
            <param name="restart-after-reread">0</param>
            <!-- if set to 1 , plays once through, then exits. -->
            <param name="once">0</param>
        </input>

            <!-- Stream instance
            You may have one or more instances here. This allows you to 
            send the same input data to one or more servers (or to different
            mountpoints on the same server). Each of them can have different
            parameters. This is primarily useful for a) relaying to multiple
            independent servers, and b) encoding/reencoding to multiple
            bitrates.
            If one instance fails (for example, the associated server goes
            down, etc), the others will continue to function correctly.
            This example defines two instances as two mountpoints on the
            same server.  -->
        <instance>
            <!-- Server details:
                You define hostname and port for the server here, along with
                the source password and mountpoint.  -->
            <hostname>localhost</hostname>
            <port>8000</port>
            <password>hackme</password>
            <mount>/example1.ogg</mount>

            <!-- Reconnect parameters:
                When something goes wrong (e.g. the server crashes, or the
                network drops) and ices disconnects from the server, these
                control how often it tries to reconnect, and how many times
                it tries to reconnect. Delay is in seconds.
                If you set reconnectattempts to -1, it will continue 
                indefinately. Suggest setting reconnectdelay to a large value
                if you do this.
            -->
            <reconnectdelay>2</reconnectdelay>
            <reconnectattempts>5</reconnectattempts> 

            <!-- maxqueuelength:
                This describes how long the internal data queues may be. This
                basically lets you control how much data gets buffered before
                ices decides it can't send to the server fast enough, and 
                either shuts down or flushes the queue (dropping the data)
                and continues. 
                For advanced users only.
            -->
            <maxqueuelength>80</maxqueuelength>

            <!-- Live encoding/reencoding:
                Currrently, the parameters given here for encoding MUST
                match the input data for channels and sample rate. That 
                restriction will be relaxed in the future.
            -->
            <encode>  
                <nominal-bitrate>64000</nominal-bitrate> <!-- bps. e.g. 64000 for 64 kbps -->
                <samplerate>44100</samplerate>
                <channels>2</channels>
            </encode>
        </instance>
        </stream>
</ices>





Jetzt muss noch im Verzeichnis „/etc/ices2/“ die Datei „playlist.txt“ erstellt und die Rechte angepasst werden. In der Playlist Datei sollten die Vollständigen Pfade zu den Audiodateien eingetragen werden.

/Pfad/zur/Audidatei/Beispiel1.ogg
/Pfad/zur/Audidatei/Beispiel2.ogg
/Pfad/zur/Audidatei/Beispiel3.ogg
...





Ices2 Start/Stopp


Gestartet wird Ices2 mit folgenden Kommando.

ices2 /Pfad/zu/ices-xxx.xml



Jetzt kann Ices2 den Audiostream an den Server senden und beim Aufruf der Icecast2 Seite im Browser wird der Stream Client und verschiedene Statusinformationen sichtbar.



Beendet werden kann Ices2 mit hilfe der Kommandos pidof und kill.

kill -15 `pidof ices2`





Cloud