ECAL: Usando darkice en Gentoo para alimentar un Icecast
Si el título les asustó, les explico: icecast es un servidor de streams multimedia, es decir, una especie de radio de sonido y video para su computador. Para que funcione, necesita que otro programa le diga que cosa debe tocar, al cual se le denomina cliente. Si hiciésemos la analogía con una radio de verdad, icecast es la antena que transmite al mundo, en tanto que el cliente es el micrófono o la máquina de CD que contiene la música a tocar.
En un artículo anterior, explique como usar icecast y ices2 para transmitir música en internet a partir de un listado de oggs. Verbaton me pidió que explicara como se puede hacer lo mismo con Darkice utilizando una señal en vivo; ices2 también cuenta con una opción para utilizar la entrada de OSS o ALSA, pero veamos como nos resulta con el programa solicitado.
En mi Gentoo, instalé el programa usando el viejo emerge darkice. El archivo de configuración se encuentra en /etc/darkice.cfg, que a simple vista luce así
# sample DarkIce configuration file, edit for your needs before using
# see the darkice.cfg man page for details
# this section describes general aspects of the live streaming session
[general]
duration = 60 # duration of encoding, in seconds. 0 means forever
bufferSecs = 5 # 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/dsp # OSS DSP soundcard device for the audio input
sampleRate = 22050 # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16 # bits per sample. try 16
channel = 2 # channels. 1 = mono, 2 = stereo
# this section describes a streaming connection to an IceCast server
# there may be up to 8 of these sections, named [icecast-0] ... [icecast-7]
# these can be mixed with [icecast2-x] and [shoutcast-x] sections
[icecast-0]
bitrateMode = cbr # constant bit rate
bitrate = 96 # bitrate of the mp3 stream sent to the server
quality = 0.8 # encoding quality
server = yp.yourserver.com
# host name of the server
port = 8000 # port of the IceCast server, usually 8000
password = hackme # source password to the IceCast server
mountPoint = sample96 # mount point of this stream on the IceCast server
name = DarkIce trial
# 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 # genre of the stream
public = yes # advertise this stream?
# 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 # average bit rate
format = vorbis # format of the stream: ogg vorbis
bitrate = 96 # bitrate of the stream sent to the server
server = yp.yourserver.com
# host name of the server
port = 8000 # port of the IceCast2 server, usually 8000
password = hackme # source password to the IceCast2 server
mountPoint = sample96 # mount point of this stream on the IceCast2 server
name = DarkIce trial
# 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 # genre of the stream
public = yes # advertise this stream?
# this section describes a streaming connection to a ShoutCast server
# there may be up to 8 of these sections, named [shoutcast-0] ... [shoutcast-7]
# these can be mixed with [icecast-x] and [icecast2-x] sections
[shoutcast-0]
bitrateMode = vbr # variable bit rate mode
quality = 0.5 # encoding quality
server = yp.yourserver.com
# host name of the server
port = 8001 # source port of the ShoutCast server, usually 8001
password = hackme # source password to the ShoutCast server
name = DarkIce trial
# name of the stream
url = http://www.yourserver.com
# URL related to the stream
genre = my own # genre of the stream
public = yes # advertise this stream?
irc = irc.yourserver.com
# IRC info related to the stream
aim = aim here # AIM info related to the stream
icq = I see you too
# ICQ info related to the stream
Para correr darkice es necesario darle la ruta del archivo de configuración, así que sería bueno hacer una copia de éste en la carpeta de usuario, con
cp /etc/darkice.cfg ~/darkice.cfg
Lo primero es dejar que darkice corra de forma indefinida. Para ello, en la sección [general], cambiamos duration a 0
Lo segundo es definir desde donde se recibirá la señal. Por defecto considera que es /dev/dsp, pero si utilizamos alsa es mejor no utilizar el modo de emulación. Para ello, en la sección [input], cambiamos device a hw0,0, o el valor que corresponda a tu configuración.
Ahora viene lo interesante. Darkice puede alimentar a un servidor icecast 1, icecast 2 o shoutcast. Como tengo un icecast 2, elimino todo lo que está abajo de [icecast-0] y todo lo que sigue a [shoutcast-0].
Los dos valores necesarios para que el sistema funcione son server y password. server debe corresponder a la dirección IP donde se encuentra mi servidor icecast2. password es el código que va en la sección (a la Xpath) //authentication/source-password del archivo de configuración de icecast2.
Es bueno, también, cambiar el nombre del punto de montaje en mountPoint a la extensión del formato que estamos ocupando. Por ejemplo, si utilizamos vorbis, es bueno poner al final del punto de montaje .ogg para asegurar que el programa que toque la radio no se confunda.
El resultado final de nuestro archivo de configuración se vería así
# sample DarkIce configuration file, edit for your needs before using
# see the darkice.cfg man page for details
# this section describes general aspects of the live streaming session
[general]
duration = 0 # Puesto a 0, para que no pare
reconnect = yes # reconectar si se desconecta
# this section describes the audio input that will be streamed
[input]
device = hw:0,0 # Primera tarjeta en ALSA
sampleRate = 22050 # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16 # bits per sample. try 16
channel = 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 # average bit rate
format = vorbis # puede ser mp3 o vorbis
bitrate = 128 # bitrate of the stream sent to the server
server = 192.168.0.250 # servidor icecast
port = 8000 # port of the IceCast2 server, usually 8000
password = PASSWORD
# password para fuentes del servidor icecast
mountPoint = test_en_vivo.ogg
# Punto de montaje
name = Mi radio en vivo
# name of the stream
description = This is only a trial
# description of the stream
url = http://musica.apsique.com
# URL related to the stream
genre = my own # genre of the stream
public = yes # advertise this stream?
Para probar nuestro darkice, debemos hacer en la consola
$ darkice -c ~/darkice.cfg
Y voila, tenemos nuestro darkice en funcionamiento.
Si no escuchan nada en su player, vigilen que el nivel de captura de su ALSA sea adecuado. Para ello, hagan alsamixer, presionen F4 para ver los dispositivos de captura y busquen la barra que dice CAPTURE. Si esta abajo, deben aumentar el volumen para que el feed la pueda capturar.
Happy streaming!
- 6740 lecturas

Muchas gracias por aclararme este tema.
Yo para que no me produjera un error de buffer tuve que poner /dev/dsp, y añadire el delay de segundos (bufferSecs) de la seccion general, pero aparte de esto, el resto todo genial.
Gracias, gracias, gracias, gracias, gracias,....
(hasta el infinito y mas alla, y mas y mas...)
Para eso estamos.
todo ta chevere , pero como instalo el darkice,
por mas q trato no me sale.
pase un buen rato tratando de instalar el icecast, estoy trabajando en ubuntu, que da mucha lata, pero tengo q hacer este proyecto en esta distribucion, el icecast ya lo instale, y al probarlo por web "http://localhost:8000" funciona pero no puedo hacer nada al momento que me pide usuario y contraceña.
un pajarito me dijo que instale el darkice que con eso se arregla, pero q hay de cierto?
ayudaaaaaaa por faaaaaaa
tengo que presentar este proyecto ayer....
xOOOO aki ni dicen la password de la rcon y la ip po loko xiii
xXxPornoxXx
Yo tengo un gentoo y segui tus pasos para instalarlo, tengo el alsa todo funcionando
pero cuando trato de correr el darkice me da este mensaje y para:
DarkIce 0.18.1 live audio streamer, http://darkice.tyrell.hu/
Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/
Using config file: /etc/darkice.cfg
Using ALSA DSP input device: hw:0,0
Using POSIX real-time scheduling, priority 98
DarkIce: AlsaDspSource.cpp:265: Input/output error [0]
Alguna Idea?
Gracias
Muy buen aporte...
Una duda.. yo tengo instalado el darkice conel icecast-... pero solo transmito lo q tengo en el microfo.. como le hago para transmitor mis mp3 sin usar el microfono?
1. trata de compilar tu darkice.
o bien... cambia el parametro de hw a /dev/dsp
Revisa el artículo sobre el uso de icecast con ices en http://php.apsique.com/node/523
Enviar un comentario nuevo