Streaming Server

sabby said:
Anyway, I really want to complete this. I've to submit the working theories and my ideas by december although it will be continued to next semester. Special thanks to Ryunosuke, I explored a bit more about icecast today. Tried the tools like ffmpeg2theora, oggfwd etc. ffmpeg2theora is working fine. But the problem is oggfwd. It only works on linux. And in linux (I'm in suse 11.0), there's no built way to stop the icecast server whereas, there's a GUI for icecast in windows. That means, I had to create new instance of icecast servers every time I wanted to change the icecast.xml as the previously mentioned listener port is not available. :(

That is also no problem for me as icecast doesn't consume much resources. Besides, for rtp/rtsp support ( for unicast or multicast for VoD ), I can create as many instance as I want for every IGMP group or user. For VoD, I can put the .ogv files ( batch converted by ffmpeg2theora ) so that live encoding is not needed. But I'm a bit confused about the mountpoint. I've set a mount point "/home/sabby/abc.ogv" which is preconverted by ffmpeg. But whenever I run the oggfwd command, the status said connected and then nothing happens. Btw, I've already bound an instance of VLC player to my ip at the filedeliver port of icecast.

In the the /etc/icecast.xml, there is a script called whenever a listener is connected which is "/home/icecast/stream-start" but there is no such directory I can found and I think that is causing the problem.

Back in windows, I tried ezstream. But I couldn't create the configuration file to stream a video. The all example xml configs were about audio streaming. :(

I want to assign ip to contents dynamically. Which is why trying to use rtsp. What is ACL btw? :ashamed:

Lemme take the problem in iterative statement manner. The Icecast server port is 8000 by Default and I used it only. Each Source client can have multiple mount-points on the server and all Ogg Vorbis streams should have mountpoints that end in .ogg (i,e. /mystream.ogg). This is due to the lazy way most media players infer the type of stream. MP3 streams usually do not contain an extension (/mystream). Mount points also should not contain any spaces or odd characters (again due to the lazy way many of the media players are coded).

The issue we faced regarding Server instance was that the server couldn't be manually stopped. In order to stop a stream u had to kill the source client feed. This was partly because of the server instance being governed by the user and group called "Icecast" which was automatically created when server was installed. As I made this project alongwith one more fella, I have mailed him too as my details are sketchy and the softcopy I have contains incomplete information as we didn't want to hand a fully working and functioning projects to our Teachers as some them are known to tag 'em as their own idea and profit from them, even monetary.:@

The video stream too will have .ogg extension, ours was simply /<dir name>/theora.ogg and we didn't used converted file, it was converted and streamed on-the-fly :hap2:

The Ezstream config file is

Code:
ezstream -c /usr/local/icecast2/conf/ezstream.cfg

and it looks something like this

Code:
<ezstream>

    <url>http://icecast.mydomain.com:8000/test.ogg</url>

    <sourcepassword>letmein</sourcepassword>

    <format>OGGVORBIS</format>

    <filename>streaming.ogg</filename>

    <svrinfoname>Test Stream</svrinfoname>

    <svrinfourl>http://icecast.mydomain.org</svrinfourl>

    <svrinfogenre>Classical</svrinfogenre>

    <svrinfodescription>This is a stream description</svrinfodescription>

    <svrinfobitrate>192</svrinfobitrate>

    <svrinfoquality>4.0</svrinfoquality>

    <svrinfochannels>2</svrinfochannels>

    <svrinfosamplerate>44100</svrinfosamplerate>

    <svrinfopublic>1</svrinfopublic>

</ezstream>

ezstream now supports reencoding. This means that your output stream need not be the same bitrate/samplerate or even format as your input files.

Reencoding is supported via the use of external programs. There are a few items required once reencoding is enabled:
  1. You define a "decoder" for each type of input file.
  2. You define a "encoder" for each possible type of output stream.

So if you had a mixture of MP3 and Vorbis files in your playlist, you will need to make sure that a decoder is provided for each type. Ezstream will take the output of the decoder and send it directly to the specific encoder. All output of the decoder should be written to stdout and should be in raw form. Most decoder support this mode. Encoders should all be configured also with raw input and should read it from stdin.

The following decoder/encoders can be used

MP3

  • Decoder- madplay
  • Encoder- lame

Vorbis

  • Decoder- oggdec
  • Encoder- oggenc

Now look at the code below

Code:
 	 	 <reencode>

        <enable>1</enable>

        <encdec>

        

                <format>FLAC</format> 

                <match>.flac</match>  

                <decode>flac -s -d --force-raw-format --sign=signed 

                              --endian=little @T@ -o -</decode>

                <encode>Not supported Yet</encode>

        </encdec>

        <encdec>

        

                <format>MP3</format>

                <match>.mp3</match>

                <decode>madplay -o raw:- @T@ 2>/dev/null</decode>

                <encode>lame -r -x -b 56 -s 44.1 --resample 22.05 -a - - 

                              2>/dev/null</encode>

        </encdec>

        <encdec>

        

                <format>VORBIS</format>

                <match>.ogg</match>

                <decode>oggdec --raw=1 @T@ -o - 2>/dev/null</decode>

                <encode>oggenc -Q -r -q 0 --resample=44100 --downmix 

                              -t "@M@" -c STREAMER=ezstream -</encode>

        </encdec>

</reencode>

Here under the proper encdec tags, u have to create a config like this

Code:
<encdec>

                 

                  <format>THEORA</format>
                  <match>.avi</match>
             <decode>ffmpeg2theora -x 192 -y 128 -a -1 -v 0 @T@ -o  /dev/stdout</decode>

         </encdec>

         

       <encdec>

                 

                  <format>THEORA</format>

                  <match>.mpg</match>

                  <decode>ffmpeg2theora -a -1 -v 2 @T@ -o /dev/stdout</decode>

         </encdec>

After that if u want u can also check the config file,
Code:
[COLOR=#ffffff]ezstream  -c /etc/icecast2/ezstream_video.cfg[/COLOR]

Check the Xiph's page for Ezstream here. To see it in action, check this YouTube Video too.

Assign IP to contents dynamically :S please explain this to me. ACL is access control list . While Icecast allows security by defining Usernames and Passwords for access at multiple level, u can use the Linux's in-built ACL in conjunction with Path settings to Allow or Deny connections.

Code:
 	 	 <paths>

         <basedir>./</basedir>

        <logdir>./logs</logdir>

        <pidfile>./icecast.pid</pidfile>

        <webroot>./web</webroot>

        <adminroot>./admin</adminroot>

        <allow-ip>/path/to/ip_allowlist</allow-ip>

        <deny-ip>/path_to_ip_denylist</deny-ip>

        <alias source="/foo" dest="/bar"/>

    </paths>

Here the allow-ip and deny-ip specifies the location of a file that contains a list of IP addresses that will be allowed to connect to Icecast and those IP addressess that will be dropped immediately. This is mainly for problem clients when you have no access to any firewall configuration. The format of the file is simple, one IP per line.

Hope this help :cool2:
 
Thanks mate, this will help me for sure.

I'll get back to you after tomorrow after the first theory exam of this semester :P
 
All right. I'm almost done with my project ( using VLC ). But there is one bug. VLC can't join any existing UDP stream. But if I keep the VLC open in receiving mode and then start the streaming, it can show the stream. :S It worked fine before. Don't know if its a bug or something.

Can anyone tell me another media plyer which can play udp stream ?
 
ALL RIGHT !!!!!!

Apparently that was an issue of UDP protocol itself. Now I'm using RTP and its fine. :hap2:

Thanks for your suggestion though. :)
 
Aha !!! Finished it at last. Got to code for last two days. Haven't spent this much time in java coding since 2nd yr. :P Gonna show to my guide tomorrow.:)
 
sabby said:
Aha !!! Finished it at last. Got to code for last two days. Haven't spent this much time in java coding since 2nd yr. :P Gonna show to my guide tomorrow.:)

Congo bongo dude :) And believe me you do need the marks. Ask me, the person who lost a job in Infy coz of not having throughout 60% :(
 
Back
Top