Live Webcasting

Introduction

Darwin/QuickTime Streaming Server can reflect live RTSP/RTP broadcasts. The components of a live webcasting system are:

How encoders send streams

The Live Encoder can send streams to the server in one of three ways:

  1. The encoder can send a Unicast Stream to the IP address of the server on specific ports. In the QuickTime Broacaster application this is referred to as a "manual unicast." In order for clients to tune in on the web cast, a Session Description Protocol file (.sdp) must be created by the encoder and manually copied to the server.
  2. The encoder can send a Unicast Stream to the IP address of the server on specific ports and automatically send the .sdp file to the server. In the QuickTime Broacaster application this is referred to as a "automatic unicast." The encoder must support the RTSP Announce Protocol for this to occur. Since most encoders don't support this capability, method #1 above is more common.
  3. The encoder can send a Multicast Stream to the Network. For this to work, the encoder and the server must be on the same multicast enabled network (the current Internet does not support Multicast traffic). The Streaming Server can reflect the Multicast Stream as Unicast streams to clients on the Internet. This is a useful setup for environments that want to reflect an internal Multicast stream to the Internet. In order for clients to tune in on the web cast from the streaming server, a Session Description Protocol file (.sdp) must be created by the encoder and manually copied to the server.

The Session Description Protocol file

To reflect a live stream from an encoder, the streaming server requires an IETF Session Description Protocol file (.sdp file). This fiile describes network and format information for the stream. Most encoders create sdp files automatically. The sdp file provides the streaming server with information requires to tune in on the encoder's stream. When clients connect to the sdp file, the server reflects that stream as a Unicast to the client. So, the generic steps required to reflect a live stream from through the streaming server are:

  1. Configure the encoder. This will involve setting up the source for video and audio, the bit-rates to send for video/audio streams, the IP address and port numbers to send to, etc.
  2. Generate the .sdp file from the encoder.
  3. Copy the .sdp file to the streaming server's Movies directory or a sub-directory of the Movies directory.
  4. Test the stream by tuning in on the .sdp file from a QuickTime Player on a client system. For instance, if the .sdp file named "live.sdp" was copied to a streaming server at "stream.demo.com", the live stream could be viewed by opening
    rtsp://stream.demo.com/live.sdp
    From QuickTime Player.

Note that step 3 above is automated if the encoder supports the RTSP Announce protocol (part of the IETF RTSP RFC).

Reflecting a Manual Unicast Stream

The following example demonstrates how a Unicast Stream originating at a JVC DM-NC40 Network Encoder can be reflected through the Streaming Server. In this example the encoder is located at the IP address 192.168.0.222 and the streaming server is located at 192.168.0.210.

The first step is to configure the encoder. The DM-NC40 can be configured via a web browser. First, the encoding parameters are configured for a high quality, 1 megabit per second ISMA MPEG-4 stream:

Once the video and audio encoding parameters are configured, the Unicast streaming parameters need to be setup. The destination address should be the streaming server. The video and audio port numbers should be even numbers over 7000:

Once the encoder is configured and started, we can retrieve the sdp file. The JVC encoder allows the retrieval of the unicast .sdp file via http. To save this into a file on a Unix-based system (Mac OS X, Linux, Solaris, BSD, etc), we can use the curl command combined with redirection to a file:

Since Windows doesn't have curl, we can use a freeware utility such as NetLeech to retrieve the .sdp file on a Windows system:

The captured .sdp file must be placed in the streaming server's movies directory. Then QuickTime Player can tune in on the file by opening a URL from the File menu:

Then entering the URL to the .sdp file:

QuickTime Player will now display a live stream:

The live stream can be linked to a web page just like any other streaming movie as described here.

Setting up for Automatic Unicasts (Configuring for RTSP Announcements)

Automatic Unicast is part of the RTSP standard implemented by Apple's QuickTime Broadcaster, Wirecast, and Abstract Plane Uplink Broadcaster. To configure your QuickTime or Darwin Streaming server to accept incoming automatic unicasts, follow steps outlined below. The procedure outlined works for both QuickTime Streaming Server and Darwin Streaming Server and provides a method to configure multiple users or groups with automatic unicast capability. On QuickTime Streaming Server a simplified method is available through the Server Admin application interface, which is outlined at the bottom of this page.

Note: If you are running Broadcaster and Streaming Server on the same system, these steps aren't necessary. In that case you can just configure Broadcaster to send the Automatic Unicast to the loopback address (127.0.0.1) and leave the username and password blank.

Creating Users & the qtaccess file for Automatic Unicast

  1. First, make sure that your streaming server is set up properly. After you install and configure the streaming server, you should be test by accessing the server. Sample files are part of the standard installation. Using QuickTime Player, try accessing one of the sample files by opening the url to the file. For example: rtsp://<ServerIP>/sample_300kbit.mp4
  2. Next, you need to set up a qtusers file. The streaming server references the qtusers file in combination with the qtaccess file described below. The qtusers file is stored in the streaming server's config directory. On Mac OS X, this is /Library/QuickTimeStreaming/Config/qtusers. The file is root accessible for security. To add a user to the file, you will need to execute the qtpasswd command as root. The screen shot below outlines the process of creating a new user named "bcast"

    NOTE: If the qtusers file does not exist, use the -c flag to create a new file. For example: sudo qtpasswd -c bcast
  3. Similar to Apache's htaccess files, qtaccess files can be placed in any directory off of your main movies directory. Then all the files in that directory and it's subdirectories will inherit those access controls. For announced Unicasts, you will want to create a qtaccess file in the main movies directory of your server (/Library/QuickTimeStreaming/Movies/ by default on Mac OS X Server). The simple example below limits write access to the user bcast, and allows everyone else read access. Automatic Unicast users must have write privileges so that they can generate the sdp file on the server.

QTSS Broadcast Password Configuration with Server Admin

On Mac OS X Server, the Server Admin application provides a graphical interface for configuring a broadcast users. After launching Server Admin and connecting to your server, click on QuickTime Streaming in the Computers & Services pane, the Settings tab at the bottom of the Window, and the Access tab near the top. Then check off "Accept incoming broadcasts" and click the "Set Password" button:

This method provides a simple method to configure a single broadcast user and password. Additional users or groups can be added using the manual method outlined at the top of this page.

Live Encoders & Automatic Unicast

Once you have configured the streaming server as outlined above, you are ready to accept automatic unicasts. From QuickTime Broadcaster, automatic unicasts are configured under the network tab. For example:

In the example above, the Streaming Server configured for autounicast is at the address 192.168.0.210. The user "bcast" has been configured as outlined above. The .sdp file will be created and named "broadcast.sdp" on the server (specifying the extension is optional in QuickTime Broadcaster). The broadcast and creation of the sdp file will begin when the Broadcast button is clicked. Once the broadcast starts, you can tune in on it by opening a url in QuickTime Player:
rtsp://<ServerIP>/<BroadcastName>.sdp

In the example above, this would be
rtsp://192.168.0.210/broadcast.sdp

The live stream can be linked to a web page just like any other streaming movie as described here.

Note: It is also important that the user that the QuickTimeStreamingServer process us running under has write permission to the Movies directory. In version 5 of QuickTime Streaming Server, this user is "qtss" and the permissions on the default Movies directory are as follows:

As you can see the qtss user has full read-write privileges to the Movies directory allowing streaming server process the ability to write the sdp file to that directory when the broadcast is announced.