Hack 85. Set Up an Internet Television Station

 < Day Day Up > 

Using the free Darwin Streaming Server, create an Internet TV station, complete with a schedule.

Not many of us can afford our own television station. But if you are willing to broadcast your programming over the Internet, you can have your own station up and running in less than an hour. Oh, and it won't cost you anything. Once you have it installed and configured, you will be able to broadcast QuickTime, MPEG-4, and 3GPP movie files.

7.11.1. Downloading the Darwin Streaming Server

Broadcasting video from your computer requires streaming software. Apple has made its Darwin Streaming Server available for free. In fact, it's open source, which means if you know how to program a computer, you can make changes and enhancements to the way the streaming server works.

For people who don't know how to program a computer, or who would rather just install the software and get on with creating their Internet TV station, Apple provides prebuilt installation packages. Packages are available for Mac OS X, Windows 2000 and 2003 Server, Red Hat Linux 9, and Solaris 9. If you want access to the source code, you will need to register and agree to the Apple Public Source License (APSL).

You can download the software at http://developer.apple.com/darwin/projects/ streaming/.

7.11.2. Installing the Server

If you do not have Perl installed on your computer, download and install it before installing the streaming server. Although the streaming server doesn't require Perl to run, the Administration and set-up tool does.

You can download Perl for Windows from ActiveState (http:/ /www.activestate.com).


After downloading the software, or building it from the source code, you need to install it. The prebuilt packages will install everything necessary for you to be up and running quickly. If you are building from the source, follow the included directions.

7.11.3. Configuring the Server

After installing your server, you will need to configure it. You can do so by using a web browser and connecting to http://hostname:1220, where hostname is the name of your streaming server. The web page will then step you through the configuration process.

If you're administering from the server itself, you can connect to your installation at http://127.0.0.1:1220. This is quite useful if you've installed the streaming server on your laptop, for instance.


7.11.3.1. Setting your passwords.

Initially, you will be asked for a username and password. The combination you use will be your Streaming Server Administrator's password and will be required for any changes you wish to make in the future. The username and password combination does not have to be the same as the username and password you are using on your computer. In fact, for security reasons, it should be different.

The next page presented will ask for another password. This password is the one you will use to send an MP3 audio stream to the server. The password should be different than the Administrator's password you entered on the previous page.

7.11.3.2. Performing the initial configuration.

If your server has a valid secure sockets layer (SSL) certificate and you would like to securely administer the server, you can enable SSL by simply clicking the checkbox. Figure 7-33 shows the SSL configuration page.

Figure 7-33. Enabling SSL (only if you have a certificate)


The Media Folder is where you will need to place your media files. I recommend using the default setting, although you can stream files from anywhere on your computer. Take note of where the server will expect your media files to exist. Figure 7-34 shows the default Media Folder configuration.

Figure 7-34. Streaming movies and music from the Media Folder


If you change the location, make sure the directory you choose allows the streaming server access to the files by assigning the appropriate permissions. The Streaming Server needs read/write access.


The streaming server can send data over port 80, which is the standard port for serving web pages. Enabling streaming media over port 80 will allow people who are behind restrictive firewalls to view your content (so long as they can view web pages). If the computer you have installed onto also serves web pages, then do not enable this feature. Figure 7-35 shows the configuration option to enable streaming on Port 80.

Figure 7-35. Enabling streaming on Port 80 (only when necessary)


When you have finished the initial configuration, you should see "Server is Running" at the top left of the web page. If you see "Server is Idle," you will need to manually start the server. Hopefully, this will not be the case. Figure 7-36 shows QuickTime Streaming Server running.

Figure 7-36. Server is Running… as it should be


At the time of this writing, a method to start/stop the server is not a part of the web-based Administration tool. If you need to start the server manually, you will need to run a Perl program:

  • Mac OS X: /usr/sbin/stramingadminserver.pl

  • Windows: \Program Files\Darwin Streaming Server\ streamingadminserver.pl

To run the program from the command line:

  • Mac OS X: open the Terminal application, located in the Utilities folder.

  • Windows: open the Run… item from the Start menu, and then type command.

Then, type:

  • Mac OS X: perl /usr/sbin/stramingadminserver.pl

  • Windows: perl \Program Files\Darwin Streaming Server\ streamingadminserver.pl


To test your installation, launch your video player and open the URL rtsp:// hostname/sample_300kbit.mp4. An animated QuickTime logo should play almost immediately. Figure 7-37 shows the 300kbit sample movie playing from a streaming server.

Figure 7-37. A streaming movie


You do not need QuickTime Player to view your broadcasts. There are sample movies in a QuickTime-specific file, but you will be able to stream MPEG-4 videos, in addition to QuickTime and 3GPP formats.


7.11.4. Creating Your Schedule

Now that the streaming server is up and running, you need to add some movies to broadcast. Locate the directory you selected for your Media Folder, as noted earlier. Then, find the movies you would like to broadcast and place them into the directory you've selected as your Media Folder.

Using the Administration tool, click on the Playlists link. You should notice there is already a Playlist called sample. Click on the New Movie Playlist link. You will then see a list of all the movies you have placed in your Media Folder. In order for your files to stream correctly, they need to be encoded for streaming [Hack #83].

Configuring the playlist is rather easy. Your playlist's Name and Mount Point should be the same, except that the extension .sdp should be added to the name of the Mount Point. The Play mode offers three options: Sequential, Sequential Looped, and Weighted Random. In order to add movies to your Playlist, click and drag a movie from the Available Content list (list on the left) to the Playlist (list on the right). Figure 7-38 shows a playlist, named "monday," being created.

Figure 7-38. All available content displayed in the list on the left side


Selecting the Sequential mode will simply stream the movies in your playlist from the first movie in the list to the last. If you would like your playlist to continue broadcasting until you stop it, you have two options. The first option is to use the Sequential Looped mode, which will start at the first movie in your list and play in order to the last. It will then start at the top again and continue this process until you stop it.

The second option is to use the Weighted Random mode, which will broadcast a random selection from your playlist. There are two criteria that are examined when using this mode. The Repetition setting limits the selection to movies that have not been broadcast yet, until the number of movies broadcast exceeds the number of repetitions you've entered.

Make sure you don't set the Repetition number higher than the total number of movies in your Playlist.


The other variable you can set is the Weight. You accomplish this by clicking on the up and down arrows next to a movie's title in the playlist. Higher weighted movies will play more often than lower weighted movies. You can assign a weight between 1 and 10 to each movie.

Upon saving your changes, you will return to the Playlists page. Your newly created Playlist should be listed, however its Status will be Stopped. In order to start broadcasting, click the Play button. The status should then change to Playing. Figure 7-39 shows the "monday" playlist as available and Playing.

Figure 7-39. Two playlists available: one playing, one stopped


To access your broadcast, launch your player application and open the URL rtsp://hostname/myPlaylist.sdp, where hostname is the name of your streaming server and myPlaylist is the name you assigned to your playlist.

7.11.5. Allowing People to Tune In

Because your broadcast is streaming, people need to know where and when to tune in. You can distribute the URL to your broadcast via email or web page. If you plan on allowing people to view your content from a web page, you can either create a basic link or embed the broadcast into the page.

I feel that embedding your movie in a web page is too restrictive, because your viewers will not be able to resize the movie.


You can create a basic link to view the broadcast like this:

    <a href="rtsp://hostname/myPlaylist.sdp">Click here to tune in</a> 

When a visitor clicks the link, his preferred video player will open your broadcast. He can then sit back, relax, and watch your programs.

The final hurdle is to figure out what you are broadcasting and at what time. Your broadcast will begin when you click the play button on the Playlists page, so you need to plan accordingly. It will be important to know how long your movies are and in what order they are playing (unless, of course, you have selected Random Weighted mode).

For example, if you have five 30-minute movies playing, and you began broadcasting at 10:00 am PST, your schedule will look something like this:

Highway America - 10:00 a.m.
Gone Fishin' - 10:30 a.m.
Science Today - 11:00 a.m.
The Finer Things - 11:30 a.m.
Come 'n Get It! - 12:00 p.m.

If you have selected the Sequential Loop mode, Highway America will begin playing again at 12:30 p.m. (after Come 'n Get It! ends), Gone Fishin' will begin at 1:00 p.m., and so on. This is because your playlist is in a "loop" and will continue playing in order, from first to last.

     < Day Day Up > 


    Digital Video Hacks
    Digital Video Hacks: Tips & Tools for Shooting, Editing, and Sharing (OReillys Hacks Series)
    ISBN: 0596009461
    EAN: 2147483647
    Year: 2005
    Pages: 158
    Authors: Joshua Paul

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net