Wednesday, January 03, 2007

Icecast2 Streaming server

I have test in Debian testing (Sid)

for more doc www.xiph.org

# apt-get install icecast2

edit /etc/default/icecast2
icecast2
=====
ENABLE=true
=====

start the icecast
/etc/init.d/icecast2 start

edit /etc/icecast2/icecast.xml enable the relay if you want.

There are two types of relays: a "Master server relay" or a "Specific Mountpoint relay." A Master server relay is only supported between icecast2 servers and is used to relays all mountpoints on a remote icecast2 server.

icecast.xml
=======
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

relays-on-demand 1 relays-on-demand
on-demand 1 on-demand
relay-shoutcast-metadata 1 relay-shoutcast-metadata

example:

relay
server 127.0.0.1 server
port 8001 port
mount /example.ogg mount
local-mount different.ogg local-mount
on-demand 1 on-demand

(if your want to stream the mounted /example.ogg via /different.ogg in server)
========

restart the icecast server
/etc/init.d/icecast2 restart

with your browser
http://localhost:8000/
(user: admin, pass: hackme, by default)

copy a audio.ogg or video.ogg in your "/usr/share/icecast2/web/" and test it with your player.


Ices2 config
(Ogg Vorbis streaming source for Icecast 2)

#apt-get install ices2

cd /usr/share/doc/ices2/examples/

To stream some pre-encoded ogg files

cp /usr/share/doc/ices2/examples/ices-playlist.xml /usr/share/icecast2/web/

edit the /usr/share/icecast2/web/ices-playlist.xml

ices-playlist.xml
==========
hostname localhost hostname
port 8000 port
password hackme password
mount /example1.ogg mount

param name="restart-after-reread" 1 param (optional)
==========
you can hear it via
http://localhost:8000/example1.ogg

if you change it to /example.ogg,
then you can hear it via
http://localhost:8000/example.ogg
or
http://localhost:8000/different.ogg (via the relay)

create a playlist "playlist.txt" in /usr/share/icecast2/web/

playlist.txt
=======
fordername/01-name.ogg
fordername/02-name.ogg
fordername/03-name.ogg
...........................
=======

start the stream
# ices2 ices-playlist.xml


To stream from Input (alsa or oss)

cp /usr/share/doc/ices2/examples/ices-alsa.xml /usr/share/icecast2/web/

edit the /usr/share/icecast2/web/ices-alsa.xml if your need.

ices-alsa.xml
=========
hostname localhost hostname
port 8000 port
password hackme password
mount /example1.ogg mount
===========
you can hear it via
http://localhost:8000/example1.ogg

if you change it to /example.ogg,
then you can hear it via
http://localhost:8000/example.ogg
or
http://localhost:8000/different.ogg (via the relay)


start the live stream
# ices2 ices-alsa.xml


Video Streaming

#apt-get install ffmpeg ffmpeg2theora oggfwd

example:
#ffmpeg2theora output.ogg -x 320 -y 240 -V 150 -A 64 -o - --optimize | oggfwd localhost 8000 hackme /theora.ogg

(if your want to stream the output.ogg via mountpoint /theora.ogg in icecast server)
play http://localhost:8000/theora.ogg

done :)


1 comment:

bhuvan said...

How to stream audio and video both at the same time? I tried to give -i /dev/dsp -f oss but it say's -i invalid. I am checking with ffmpeg but no luck.