Icecast streaming server over local lan and/or internet

sezione dedicata ai sistemi operativi alternativi Open Source

Icecast streaming server over local lan and/or internet

Messaggio da leggereda root » 09/03/2019, 19:51

Tested on LEDE 17.01.6 and OpenWRT 18.06.2


note: USB /overlay needed

- install software:

opkg update
opkg install libshout ices libtheora libspeex alsa-lib kmod-sound-core kmod-input-core icecast libxslt libcurl libvorbisidec librt
opkg install wget open
ssl-util

- disable icecast autostart at boot:

/etc/init.d/icecast disable
/etc/init.d/icecast stop


- create local user (icecast does not start as user root)

opkg install shadow-useradd
useradd pilovis
passwd pilovis
mkdir /home
mkdir /home/pilovis
chown pilovis /home/pilovis


- remove icecast default configuration file:

cp /etc/icecast.xml /etc/icecast.xml.orig
rm /etc/icecast.xml


- edit new icecast configuration file:

nano /etc/icecast.xml

<icecast>

<!-- LIMITS -->
<limits>
<clients>10</clients>
<sources>10</sources>
<threadpool>5</threadpool>
<queue-size>524288</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>10</source-timeout>
<burst-on-connect>1</burst-on-connect>
<burst-size>65535</burst-size>
</limits>

<!-- GENRIC -->
<authentication>
<source-password>changeme</source-password>
<admin-user>admin</admin-user>
<admin-password>changeme</admin-password>
</authentication>
<hostname>openwrt</hostname>
<listen-socket>
<port>8000</port>
</listen-socket>
<fileserve>1</fileserve>

<!-- PATHES -->
<paths>
<!-- basedir is only used if chroot is enabled -->
<basedir>/usr/share/icecast</basedir>

<!-- Note that if <chroot> is turned on below, these paths must both
be relative to the new root, not the original root -->
<logdir>/tmp</logdir>
<webroot>/usr/share/icecast/web</webroot>
<adminroot>/usr/share/icecast/admin</adminroot>
<!-- <pidfile>/usr/share/icecast/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" destination="/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="/" destination="/status.xsl"/>
<!-- The certificate file needs to contain both public and private part.
Both should be PEM encoded.
<ssl-certificate>/usr/share/icecast/icecast.pem</ssl-certificate>
-->
</paths>

<!-- LOG -->
<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<playlistlog>playlist.log</playlistlog>
<loglevel>1</loglevel>
<logsize>10000</logsize>
<logarchive>1</logarchive>
</logging>

<!-- SECURITY -->
<security>
<chroot>0</chroot>
<changeowner>
<user>pilovis</user>
<group>nogroup</group>
</changeowner>
</security>

</icecast>


- create and edit ices configuration file:

nano /etc/ices.xml

<ices>

<!-- GENERIC -->
<background>1</background>
<pidfile>/var/run/icecast/ices1.pid</pidfile>

<!-- LOGGING -->
<logpath>/tmp</logpath>
<logfile>ices1.log</logfile>
<logsize>2048</logsize>
<loglevel>3</loglevel>
<consolelog>0</consolelog>

<!-- STREAM -->
<stream>
<metadata>
<name>Testradio: One</name>
<genre>Varios</genre>
<description>Local Test Radio</description>
<url>http://openwrt:8000/</url>;
</metadata>
<input>
<param name="type">basic</param>
<param name="file">/root/playlist1.txt</param>
<param name="random">1</param>
<param name="once">0</param>
<param name="restart-after-reread">1</param>
</input>
<instance>
<hostname>openwrt</hostname>
<port>8000</port>
<password>changeme</password>
<mount>/Radio88</mount>
</instance>
</stream>

</ices>


- download some .ogg music files in /root/music directory:
https://patrickdearteaga.com/royalty-free-music/

mkdir /root/music
cd /root/music
wget https://patrickdearteaga.com/audio/Not% ... g%20Up.ogg
wget https://patrickdearteaga.com/audio/Spring%20Village.ogg
wget https://patrickdearteaga.com/audio/La%2 ... %20Ile.ogg
wget https://patrickdearteaga.com/audio/Las% ... nteras.ogg


- create playlist file (you need to regenerate it every time you add files in music directory):

rm /root/playlist1.txt
find /root/music -name "*.ogg" > /root/playlist1.txt


- start icecast and ices (you might put these two lines on /etc/rc.local to autostart streaming at boot):

/usr/bin/icecast -b -c /etc/icecast.xml
/usr/bin/ices /etc/ices.xml


- test icecast streaming server:

http://router-ipaddress:8000

Immagine
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 453
Iscritto il: 10/04/2012, 10:55
Località: Turin

Re: Icecast streaming server over local lan and/or internet

Messaggio da leggereda root » 09/03/2019, 20:13

cpu and memory usage - Openwrt @300 Mhz CPU & 64 Mbytes RAM (32 is enough)

Codice: Seleziona tutto
 PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
 5479     1 pilovis  S     6904  11%   1% /usr/bin/icecast -b -c /etc/icecast.xml
 5489     1 root     S     6960  12%   1% /usr/bin/ices /etc/ices.xml

note that icecast runs as normal user "pilovis" and ices as user "root"
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 453
Iscritto il: 10/04/2012, 10:55
Località: Turin


Torna a OpenWRT

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite

cron