Pages

Monday, 20 May 2013

流媒体服务器软件-Litestream

Litestream was originally written by Gene Kan and is an incredibly tight and clean piece of software. 
After his death maintainership passed on to Rick Bradley 
and Sean /The RIMBoy/ Jewett. 
The latest version of litestream can be obtained via github at:  http://github.com/rick/litestream/

Litestream is made available under the terms of the BSD license found in the LICENSE file.


INSTALLATION AND USAGE


1.  Build Litestream.

 The included Makefile may work with your version of make.  If it
 does not, you may have to edit it a little.  Works fine with
 GNU make 3.78.1.

1.a.  Solaris

 For Solaris you must uncomment then "-lnsl -lresolv" in the LDFLAGS
 line in the Makefile.  You must also add
 "typedef unsigned short u_int16_t;" to the beginning of any file
 where you see the error "unknown type u_int16_t" or something of
 that sort.  I will get around to automated configuration.

1.b.  Mac OS X

 Litestream requires Mac OS X 10.2 or better.  Previous versions did
 not include a native strtok_r(3) function.  If you wish to use
 litestream on Mac OS X prior to 10.2 please inquire on the
 litestream-devel mailing list for assistance.

2.  Start Litestream Server.

 ./litestream <source port> <stream host> <stream port> <max listeners> <log ident> [<yp host> <yp port>]

 <source port> is the listening port.  That is where you will
 point your streaming source.

 <stream host> is the fully qualified hostname or IP address of
 the computer which is running Litestream Server.  The reason you
 must specify this parameter is because it is difficult or
 impossible to determine this automatically.

 <stream port> is the port on which Litestream Server will wait
 for stream listeners.

 <max listeners> is the maximum number of listeners this instance
 of Litestream Server can support.  Typically I would calculate
 this by dividing the throughput of my Internet connection by the
 bitrate of the stream.  For example, for a T1 broadcasting a
 160 Kbps stream:

  1500000/160000 = 9

 <log ident> is the syslog identifier which will be prepended to
 each log message generated by Litestream Server.  Litestream
 MP3 Streaming System logs all messages on LOCAL0.

 YP PARAMETERS:

 If you don't specify both the <yp host> and <yp port> there will
 be no YP reporting.  That means that whether or not your streaming
 source specifies the stream is public, no YP reporting will take
 place.

 <yp host> is the hostname or IP address of the YP server.

 <yp port> is the port on which the YP server is listening.

 Example:

 ./litestream 8000 www.litestream.net 8888 10 stream yp.shoutcast.com 80

3. Connect a streaming source.

 Litestream Server will not register with the YP server until a
 streaming source is connected to Litestream Server.

 Litestream 1.0 beta 1 is compatible with Nullsoft Winamp and
 Litestream Streaming Source, and possibly others.

 If you want to use Litestream Streaming Source, which is a
 non-reencoding streaming source which simply loops over the
 files in your playlist, here's how to execute it:

 ./source <ip or hostname> <port> <name> <genre> <url> <irc> <icq> <aim> <public? (0, 1)> <reported bitrate (16, 18, 56, 128, etc.)> <playlist.txt>

 <ip or hostname> is the hostname or IP address of the computer
 running Litestream Server.

 <port> is the port on which Litestream Server is waiting for a
 streaming source.

 <name> is the name of your stream.

 <genre> is the genre of your stream.

 <url> is the URL for your stream's web page.

 <irc> is the IRC channel for your stream.

 <icq> is your ICQ ID.

 <aim> is your AIM ID.

 <public> is either 0 or 1.  0 for private, 1 for public.

 <reported bitrate> is the stream bitrate which will be reported
 to the YP server.  This does not necessarily reflect the actual
 bitrate of your stream.

 <playlist.txt> is the name of the file containing your playlist.

 <log ident> is the syslog identifier which will be prepended to
 each log message generated by Litestream Streaming Source.
  Litestream MP3 Streaming System logs all messages on LOCAL0.

 Example:

 Here are a few lines from my playlist file:

 /usr/litestream/mp3/paul_oakenfold/Fluro___Disk_1/We_re_Not_Alone.mp3
 /usr/litestream/mp3/paul_oakenfold/Fluro___Disk_1/Merry_Christmas_Mr._Lawrence.mp3
 /usr/litestream/mp3/paul_oakenfold/Fluro___Disk_1/Mystery_Land.mp3

 Here is how I run my Litestream Streaming Source:

 ./source localhost 8000 'Ibiza Euphoria!' Techno http://www.litestream.net #gotgrub 0 N/A 1 160 /usr/litestream/bin/playlist.m3u source

 Take note that some shells will not like the '#' in the IRC channel
 name.  You will have to escape it with a backslash (\#) or use
 whatever method your shell requires to make the '#' a regular
 character.  (Normally '#' is used to begin a shell comment.)

4. Optionally start one or more Literestream Servers.

 ./literestream <mirror tag> <source host> <source port> <stream host> <stream port> <max listeners> <log ident> [<yp host> <yp port>]

 <mirror tag> is the name by which the mirror will be known.
 This should be a short and geographically descriptive.  It
 will be displayed on the YP server.

 <source host> is the hostname of the computer running
 Litestream Server.

 <source port> is the port on which Litestream Server is
 waiting for listeners.

 <stream host> is the fully qualified hostname or IP address
 of the computer running Literestream Server.

 <stream port> is the port on which Literestream Server will
 wait for stream listeners.

 The remaining arguments correspond to their Litestream Server
 counterparts (above).

 Example:

 ./literestream 'XCF, UC Berkeley CA USA' www.litestream.net 8888 scam.xcf.berkeley.edu 8888 600 restream yp.shoutcast.com 80

5.  Add /etc/hosts entries.

 For all the IP addresses and hostnames you used above, create
 an entry in the /etc/hosts file.  This will prevent catastrophe
 in the case of DNS failure.

 For example, I add the line:

205.188.245.119  yp.shoutcast.com

 Without that line, Litestream Server would sit there trying to
 figure out the hostname for yp.shoutcast.com instead of what doing
 it's supposed to do.

--- BEGIN HISTORICAL README ---

Litestream MP3 Streaming System

For more information, help, etc., 
please email me at Gene Kan <genehkan@xcf.berkeley.edu>
 
 from https://github.com/rick/litestream