icecast2 на FreeBSD или транслируем интернет радио в сеть

Как написано на офф сайте, Icecast -это проект, представляющий из себя набор программ и библиотек для организации потокового аудио через Интернет. Ниже в статье будет описано, как ретранслировать интернет-радио в вашу сеть, посредством Icecast2. Сервер будет, конечно же, на FreeBSD.
Сначала ищем нужный нам порт:
cd /usr/ports
make search name=icecast

вижу:
Port: icecast-1.3.12_2
Path: /usr/ports/audio/icecast
Info: A streaming mp3 audio server
Maint: ports@FreeBSD.org
B-deps:
R-deps:
WWW: http://www.icecast.org/

Port: icecast2-2.3.2_7,1
Path: /usr/ports/audio/icecast2
Info: A streaming mp3/ogg-vorbis audio server
Maint: sunpoet@FreeBSD.org
B-deps: ca_root_nss-3.12.6 curl-7.21.3 gettext-0.18.1.1 gmake-3.81_4 libgcrypt-1.4.6 libgpg-error-1.10 libiconv-1.13.1_1 libogg-1.2.2,4 libshout2-2.2.2_4,1 libtheora-1.1.1_2 libvorbis-1.3.2,3 libxml2-2.7.8_1 libxslt-1.1.26_2 pkg-config-0.25_1 speex-1.2.r1_3,1
R-deps: ca_root_nss-3.12.6 curl-7.21.3 gettext-0.18.1.1 libgcrypt-1.4.6 libgpg-error-1.10 libiconv-1.13.1_1 libogg-1.2.2,4 libshout2-2.2.2_4,1 libtheora-1.1.1_2 libvorbis-1.3.2,3 libxml2-2.7.8_1 libxslt-1.1.26_2 pkg-config-0.25_1 speex-1.2.r1_3,1
WWW: http://www.icecast.org/

нашли, ставим icecast2:
make BATCH=yes -C/usr/ports/audio/icecast2 install clean
rehash

в конце вижу:
=== Installing rc.d startup script(s)
To start icecast at system boot, copy
/usr/local/etc/icecast.xml.sample to /usr/local/etc/icecast.xml, customize
to your environment as desired and add:

icecast_enable=»YES»

to /etc/rc.conf. See the icecast -h command for optional additional
flags. To specify an alternative config file for example add:

icecast_flags=»-c /path/to/your/configuration.xml»

**********************************************************************
** Make sure the section in your configuration file **
** is NOT commented out. Icecast will refuse to run as root. **
** **
** Also make sure that the user you choose is able to write to your **
** configured log directory, otherwise icecast will refuse to run. **
**********************************************************************
=== Registering installation for icecast2-2.3.2_7,1
=== SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/bin/icecast

This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/icecast2

If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type ‘make deinstall’
to deinstall the port if this is a concern.

For more information, and contact details about the security
status of this software, see the following webpage:
http://www.icecast.org/
=== Cleaning for libshout2-2.2.2_5,1
=== Cleaning for speex-1.2.r1_3,1
=== Cleaning for libtheora-1.1.1_2
=== Cleaning for libvorbis-1.3.2,3
=== Cleaning for libogg-1.2.2,4
=== Cleaning for icecast2-2.3.2_7,1

Так и делаем. в /etc/rc.conf добавяем строку:
icecast_enable="YES"
icecast_config="/usr/local/etc/icecast_pop.xml"

Далее:
cp /usr/local/etc/icecast.xml.sample /usr/local/etc/icecast_pop.xml
ee /usr/local/etc/icecast_pop.xml

правим до следующего состояния:
<icecast>

<limits>
<clients>100</clients>
<sources>5</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>

<authentication>
<source-password>icpass</source-password>
<relay-password>icpass</relay-password>
<admin-user>admin</admin-user>
<admin-password>icpass</admin-password>
</authentication>

<hostname>10.36.1.9</hostname>
<listen-socket>
<port>8000</port>
<bind-address>10.36.1.9</bind-address>
</listen-socket>
<fileserve>1</fileserve>

<paths>
<basedir>/usr/local/share/icecast</basedir>
<logdir>/var/log/icecast</logdir>
<webroot>/usr/local/share/icecast/web</webroot>
<adminroot>/usr/local/share/icecast/admin</adminroot>
</paths>

<mount>
<charset>UTF8</charset>
</mount>

<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<loglevel>2</loglevel>
<logsize>1000</logsize>
<logarchive>1</logarchive>
</logging>

<security>
<chroot>0</chroot>
<changeowner>
<user>nobody</user>
<group>nogroup</group>
</changeowner>
</security>

<relay>
<server>radio.solo.by</server>
<port>8001</port>
<mount>/loverussian</mount>
<local-mount>/loverussian</local-mount>
<on-demand>0</on-demand>
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>

<relay>
<server>nullwave.ru</server>
<port>8000</port>
<mount>/russian_pop</mount>
<local-mount>/nullwave_pop</local-mount>
<on-demand>0</on-demand>
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>

<relay>
<server>radio02-cn03.akadostream.ru</server>
<port>8000</port>
<mount>/russianradio128.mp3</mount>
<local-mount>/russianradio128</local-mount>
<on-demand>0</on-demand>
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>

</icecast>

здесь:
admin — логин учётной записи администратора, нужна будет, чтобы зайти на веб-интерфейс
icpass — пароль учётной записи admin(смените на свой)
8000 -номер порта на который будет перекидываться интренет-радио
10.36.1.9 -на какой адрес перекидывать интренет-радио(адрес вашего сервера в локальной сети)
security — раскомментировали этот параметр, чтобы разрешить запуск icecast от root’a
relay — их в конфиге у меня 3-и, но может быть и больше. Это как раз перечилены интернет-радиостанции
То есть, если вы нашли радио с ссылкой вида http://radio.solo.by:8001/loverussian , то раздел конфига должен иметь вид:

<relay>
<server>radio.solo.by</server>
<port>8001</port>
<mount>/loverussian</mount>
<local-mount>/loverussian</local-mount>
<on-demand>0</on-demand>
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>

здесь local-mount — это приписка к адресу уже в вашей локальной сети, тоесть открывать клиентам в плеере надо будет http://ip_сервера:8000/loverussian

создаём для логов:
mkdir /var/log/icecast
chmod 0777 /var/log/icecast

Пробуем запуститься:
icecast -b -c /usr/local/etc/icecast_pop.xml

Если всё запускается, то хорошо идём в плеер ваш любимый, умеющий играть музычку из интернета и открываем в нём:
http://10.36.1.9:8000/loverussian

можно посмотреть статистику:
http://10.36.1.9:8000/admin/
пользователь:
admin
пароль:
icpass

команды, freebsd, настройка, установка, сервер, server, ubuntu

Если понадобится, то вот ещё маленький список станций:

  • http://78.111.81.4:8080/
  • http://92.255.121.55:8000/
  • http://broadcast05.station.ru/rusradio
  • http://217.106.236.36:80/rusradio
  • http://radio.solo.by:8001/loverussian
  • http://nullwave.ru:8000/russian_pop
  • http://mp3.nashe.ru:80/nashe-192
  • http://89.149.226.199:8100/
  • http://www.zaycev.fm:9001/ZaycevFM(128)
  • http://stream1.radiostyle.ru:8001/radiokinozaltv
  • http://rt.kanal12.ru:8005

Добавить комментарий