AllInfo
Main: Info Blog Temp Mail


unix 2017-01-06 19-44-44

Устанавливаем Darkice


Для создания аудио потока со звуковой карты на сервер IceCast воспользуемся программой Darkice.

# cd /usr/ports/ && make search name=darkice

# cd /usr/ports/audio/darkice && make install clean

Выбираем параметры установки, нас пока интересует mp3 для высоких скоростей и низких скоростей рекомендую использовать FAAC, что бы использовать протокол aacp :

┌────────────────────────────────────────────────────────────────────┐
│ Options for darkice 0.19 │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │ [ ] VORBIS Ogg Vorbis support │ │
│ │ [X] LAME LAME support for MP3 │ │
│ │ [ ] TWOLAME TwoLAME support for MP2 │ │
│ │ [X] FAAC FAAC support for AAC │ │
│ │ [ ] JACK Jack support │ │

Копируем пример конфигурационного файла:

# cd /usr/local/etc/ && cp darkice.cfg darkice.cfg.orig

И правим darkice.cfg:

# this section describes general aspects of the live streaming session
[general]
duration = 0 # (Время проигрывания 0-не ограничено) duration of encoding, in seconds. 0 means forever
bufferSecs = 2 # (Буфер в секундах) size of internal slip buffer, in seconds
reconnect = yes # (Автоматическое переподключение)reconnect to the server(s) if disconnected

# this section describes the audio input that will be streamed
[input]
device = /dev/dsp0.0 # (Звуковая карта)OSS DSP soundcard device for the audio input
sampleRate = 44100 # (Частота дискретизации) sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16 # (Динамический диапазон 16 бит) bits per sample. try 16
channel = 2 # (2 -стерео) channels. 1 = mono, 2 = stereo

# this section describes a streaming connection to an IceCast2 server
# there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7]
# these can be mixed with [icecast-x] and [shoutcast-x] sections
[icecast2-0]
bitrateMode = abr # (abr-Переменный битрейт, для постоянного битрейта cbr)average bit rate
format = mp3 # (Формат потока)format of the stream: ogg vorbis
bitrate = 128 # (Битрейт посылаемого на сервер IceCast потока)bitrate of the stream sent to the server
server = localhost
# (Имя сервера)host name of the server
port = 8000 # (Порт)port of the IceCast2 server, usually 8000
password = hackme # (Пароль, который указывали в теге <source-password>hackme</source-password> для IceCast2)source password to the IceCast2 server
mountPoint = sample128 # (точка монтировани, то что будет видно для клиента при подключении к серверу) mount point of this stream on the IceCast2 server
name = DarkIce Trial 128
# (Имя потока) name of the stream
description = This is only a trial
# (Комментарий потока) description of the stream
url = http://www.yourserver.com
# URL related to the stream
genre = my own # (Жанр потока (pop, rock,....)) genre of the stream
public = yes # advertise this str

Если нам нужен поток с другими параметрами, то добавляем еще одну секцию в файл darkice.cfg:

[icecast2-1]
bitrateMode = abr
format = mp3
bitrate = 256
server = localhost
port = 8000
password = hackme
mountPoint = sample256
name = DarkIce Trial 256
description = This is only a trial
url = http://www.yourserver.com
genre = my own
public = yes

Теперь скорость 32кБит/с, то добавляем еще одну секцию в файл darkice.cfg:

[icecast2-2]
bitrateMode = abr
format = aacp
bitrate = 32
channel = 2
server = localhost
port = 8000
password = hackme
mountPoint = sample32
name = DarkIce Trial 32
description = This is only a trial
url = http://www.yourserver.com
genre = my own
public = yes

Для запуска в автоматическом режиме можно воспользоваться скриптом /usr/local/etc/rc.d/darkice:

#!/bin/sh
case $1 in
[Ss][Tt][Oo][Pp])
/usr/bin/killall darkice && echo "darkice stoped"
;;
[Ss][Tt][Aa][Rr][Tt])
/usr/bin/su darkice -c '/usr/local/bin/darkice -c /usr/local/etc/darkice.cfg & 1>/dev/null 2>&1' && echo "darkice startted"
;;
*)
echo "Use $0 [start|stop]"
;;
esac

Теперь, если нам требуется брать аудио поток еще с нескольких звуковых карт, то необходимо создать новый конфигурационный файл darkice.cfg, например 2.darkice.cfg, изменить параметр device, например:

device = /dev/dsp1.0

и создать еще один скрипт запуска darkice с использования нового конфигурационного файла.
Не забудьте увеличить <sources>4</sources> в icecast.xml!

http://i-rrv.ru/wiki/index.php/IceCast_%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0_-_%D1%81%D0%B5%D1%82%D0%B5%D0%B2%D0%BE%D0%B5_%D0%B2%D0%B5%D1%89%D0%B0%D0%BD%D0%B8%D0%B5

3.145.173.132 / 2024-04-28_16-36-09 UTC.