Server streaming ICECAST2 ICES2 EZSTREAM (Debian)

26/05/2006 by - Linux

– Server streaming audio OGG (debian)

apt-get install icecast2 ices2

/etc/default/icecast2 –> modificare false->true

modificare /etc/icecast2/icecast.xml

libxslt1-dev libtheora

aggiungere al source.list

deb http://yomix.org/debian/ binary/
deb-src http://yomix.org/debian/ source/

per poter utilizzare ezstrem debianizzato

Per lo streaming audio si può utilizzare ices2 debian…

la differenza tra ices0 e ices2 files

ogg vorbis per ices2

mp3 ices0 (http://www.mp3licensing.com/royalty/software.html)

– un -HUP al pid di ices2 passa alla prossima traccia

esempio config.xml per ices2

<?xml version=”1.0″?>
<ices>
<!– run in background –>
<background>1</background>
<!– where logs, etc go. –>
<logpath>/var/www/icecast2/</logpath>
<logfile>ices2.log</logfile>
<!– 1=error,2=warn,3=info,4=debug –>
<loglevel>4</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>/var/www/icecast2/ices2.pid</pidfile>

<stream>
<!– metadata used for stream listing (not currently used) –>
<metadata>
<name>StrEasybit </name>
<genre>Trance</genre>
<description>ServerDiProvaStremingOGG</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”>/var/www/icecast2/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>tex</hostname>
<port>8000</port>
<password>passsword</password>
<mount>/easy.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> <!– 44100 –>
<channels>2</channels>
</encode>
</instance>

</stream>
</ices>

devono essere create le dir per il log… inoltre la playlist

esempio

/var/www/icecast2/mp3/13-Dratura&Bratura.ogg
/var/www/icecast2/mp3/acidicpsytrance.ogg
/var/www/icecast2/mp3/asd.ogg
/var/www/icecast2/mp3/Sputnik.ogg
/var/www/icecast2/mp3/the_door.ogg
/var/www/icecast2/mp3/victorious.ogg

comando per lanciare ices2

ices2 ices.xml &

_____________________________

icecast 2.2

/etc/default/icecast2 <– mettere ENABLE=true

# Defaults for icecast2 initscript
# sourced by /etc/init.d/icecast2
# installed at /etc/default/icecast2 by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Full path to the server configuration file
CONFIGFILE=”/etc/icecast2/icecast.xml”

# Name or ID of the user and group the daemon should run under
USERID=icecast2
GROUPID=icecast

# Edit /etc/icecast2/icecast.xml and change at least the passwords.
# Change this to true when done to enable the init.d script
ENABLE=true

file /etc/icecast/icecast.xml

<icecast>
<limits>
<clients>100</clients>
<sources>2</sources>
<threadpool>5</threadpool>
<queue-size>102400</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>10</source-timeout>
<!– If enabled, this will provide a burst of data when a client
first connects, thereby significantly reducing the startup
time for listeners that do substantial buffering. However,
it also significantly increases latency between the source
client and listening client. For low-latency setups, you
might want to disable this. –>
<burst-on-connect>1</burst-on-connect>
<!– same as burst-on-connect, but this allows for being more
specific on how much to burst. Most people won’t need to
change from the default 64k. Applies to all mountpoints –>
<burst-size>65535</burst-size>
</limits>

<authentication>
<!– Sources log in with username ‘source’ –>
<source-password>passssssword</source-password>
<!– Relays log in username ‘relay’ –>
<relay-password>hackmypwd</relay-password>

<!– Admin logs in with the username given below –>
<admin-user>texilee</admin-user>
<admin-password>passsword</admin-password>
</authentication>

<!– Uncomment this if you want directory listings –>
<!–
<directory>
<yp-url-timeout>15</yp-url-timeout>
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
</directory>
<directory>
<yp-url-timeout>15</yp-url-timeout>
<yp-url>http://www.oddsock.org/cgi-bin/yp-cgi</yp-url>
</directory>
–>

<!– This is the hostname other people will use to connect to your server.
It affects mainly the urls generated by Icecast for playlists and yp
listings. –>
<hostname>tex</hostname>

<!– You can use these two if you only want a single listener –>
<!–<port>8000</port> –>
<!–<bind-address>127.0.0.1</bind-address>–>

<!– You may have multiple <listener> elements –>
<listen-socket>
<port>8000</port>
<bind-address>192.168.5.52</bind-address>
</listen-socket>
<!–
<listen-socket>
<port>8001</port>
</listen-socket>
–>

<!–<master-server>127.0.0.1</master-server>–>
<!–<master-server-port>8001</master-server-port>–>
<!–<master-update-interval>120</master-update-interval>–>
<!–<master-password>hackme</master-password>–>
<!–
<relay>
<server>127.0.0.1</server>
<port>8001</port>
<mount>/example.ogg</mount>
<local-mount>/different.ogg</local-mount>

<relay-shoutcast-metadata>0</relay-shoutcast-metadata>
</relay>
–>

<!– Only define a <mount> section if you want to use advanced options,
like alternative usernames or passwords
<mount>
<mount-name>/example-complex.ogg</mount-name>

<username>othersource</username>
<password>hackmemore</password>

<max-listeners>1</max-listeners>
<dump-file>/tmp/dump-example1.ogg</dump-file>
<burst-size>65536</burst-size>
<fallback-mount>/example2.ogg</fallback-mount>
<fallback-override>1</fallback-override>
<hidden>1</hidden>
<no-yp>1</no-yp>
<authentication type=”htpasswd”>
<option name=”filename” value=”myauth”/>
<option name=”allow_duplicate_users” value=”0″/>
</authentication>
</mount>
–>

<fileserve>1</fileserve>

<!– set the mountpoint for a shoutcast source to use, the default if not
specified is /stream but you can change it here if an alternative is
wanted or an extension is required
<shoutcast-mount>/live.nsv</shoutcast-mount>
–>

<paths>
<!– basedir is only used if chroot is enabled –>
<basedir>/usr/share/icecast2</basedir>

<!– Note that if <chroot> is turned on below, these paths must both
be relative to the new root, not the original root –>
<logdir>/var/log/icecast2</logdir>
<webroot>/usr/share/icecast2/web</webroot>
<adminroot>/usr/share/icecast2/admin</adminroot>
<!– <pidfile>/usr/share/icecast2/icecast.pid</pidfile> –>

<!– Aliases: treat requests for ‘source’ path as being for ‘dest’ path
May be made specific to a port or bound address using the “port”
and “bind-address” attributes.
–>
<!–
<alias source=”/foo” dest=”/bar”/>
–>
<!– Aliases: can also be used for simple redirections as well,
this example will redirect all requests for http://server:port/ to
the status page
–>
<alias source=”/” dest=”/status.xsl”/>
</paths>

<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<!– <playlistlog>playlist.log</playlistlog> –>
<loglevel>4</loglevel> <!– 4 Debug, 3 Info, 2 Warn, 1 Error –>
</logging>

<!–
<security>
<chroot>0</chroot>

<changeowner>
<user>icecast2</user>
<group>icecast</group>
</changeowner>

</security>
–>
</icecast>

Convertire i file da mp3 a ogg con

apt-get install mp32ogg

VIDEO
—————
VEDERE CONvERSIONe FORMATI
—————

bisogna installare le librerie libtheora prima di icecast

apt-get install libtheora0

per visualizzare in streaming un file .ogg basta lanciare ezstream associato al file xml

<ezstream>
<url>http://tex:8000/theora.ogg</url>
<sourcepassword>strreplace</sourcepassword>
<format>OGGVORBIS</format>
<filename>a.ogg</filename> <—– FILE NAME
<svrinfoname>My Stream</svrinfoname>
<svrinfourl>http://www.oddsock.org</svrinfourl>
<svrinfogenre>RockNRoll</svrinfogenre>
<svrinfodescription>This is a stream description</svrinfodescription>
<svrinfobitrate>192</svrinfobitrate>
<svrinfoquality>4.0</svrinfoquality>
<svrinfochannels>2</svrinfochannels>
<svrinfosamplerate>44100</svrinfosamplerate>
<svrinfopublic>1</svrinfopublic>
</ezstream>

_______________________________________________________

si può con l’ausilio di encoder e decoder già installati sulla macchina convertire al volo il flusso video da inviare al server icecast

in questo esempio si crea una playlist con l’elenco di file mpg o avi che si voglioni visualizzare

il comando per far partire ezstream è

ezstream -b -c config_file.xml

-b background

________________________________________________________________________________
<!– This example is for a input playlist that can contain
avi and mpg (video) files files and a output stream that
is OggTheora. The output stream settings (bitrate, channels, etc.)
are controlled by the parameters to ffmpeg2theora. (see the decode setting
for the THEORA format later in this file). –>
<ezstream>

<url>http://tex:8000/theora.ogg</url>
<sourcepassword>strreplace</sourcepassword>
<!– This is what form your output will take. If you are
reencoding, this is the format to reencode to, if not
then you need to make sure all your input files are in this
format. –>
<format>THEORA</format>
<filename>tracks.m3u</filename>
<!– The following settings are used to describe your stream
to the server. It’s up to you to make sure the
bitrate/quality/samplerate/channels
match up to your output stream –>
<svrinfoname>My Stream</svrinfoname>
<svrinfourl>http://www.oddsock.org</svrinfourl>
<svrinfogenre>RockNRoll</svrinfogenre>
<svrinfodescription>This is a stream description</svrinfodescription>
<svrinfobitrate>128</svrinfobitrate>
<!– Quality is only applicable to ogg vorbis streams –>
<!– <svrinfoquality>1.0</svrinfoquality> –>
<svrinfochannels>2</svrinfochannels>
<svrinfosamplerate>44100</svrinfosamplerate>
<svrinfopublic>1</svrinfopublic>
<reencode>
<enable>1</enable>
<!– Each encdec block specifies a pair of programs used for decoding and
encoding of the stream. If reencoding is enabled, then all input files
must be first decoded before being sent to the encoder. EZSTREAM uses
file extensions to match up input files with the appropraite decoder,
and uses the <format> setting to match up the output format with the
appropriate encoder.

Note: It it up to you to set the appropriate bitrate/samplerate/channels
of the output stream by using command line paramters to the encoders. Use
the examples defined here as a guide. All output from decoders should be in
RAW format, and all input to the encoders should also be in RAW format. –>

<encdec>
<!– Support for THEORA (ffmpeg2theora does both decoding and encoding
so we don’t need an encode part) –>
<format>THEORA</format>
<match>.avi</match>
<!– <decode>ffmpeg2theora -x 192 -y 128 -a -1 -v 0 “@T@” -o -</decode> –>
<decode>ffmpeg2theora -p preview -a -1 -v 0 “@T@” -o -</decode>

</encdec>
<encdec>
<!– Support for THEORA (ffmpeg2theora does both decoding and encoding
so we don’t need an encode part) –>
<format>THEORA</format>
<match>.mpg</match>
<decode>ffmpeg2theora -a -1 -v 2 “@T@” -o -</decode>
</encdec>
<!– New encdec sections can be added for new input/output formats –>
</reencode>
</ezstream>
_______________________________________________________________



Lascia un commento

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.