Streaming Video Using the Real System in the Graphics Lab HOWTO

Last updated 4/7/2002

We now have the ability to stream audio and video from the Graphics Lab.  This means that we can put links to conference videos on our web pages and let other people watch them immediately instead of having to completely download them first.  This HOWTO describes how to create a Real Audio or Real Video file for streaming, where to put the files so they can be streamed, and how to set up the link on your page to redirect people to the streaming server.


Creating a Real Media File for Streaming

There are two methods of creating a Real Media file of your content.  The first is to use Real Producer, the second is to use Media Cleaner 5.  The latter option is more flexible but also more complicated (although neither is very hard).

Using Real Producer Basic

You can download a version for many different platforms from http://www.real.com, although you will have to dig around a little bit.  Real Producer requires that you have a file in either WAV, AVI or QuickTime format (well, more generally anything you can play back with QuickTime or MediaPlayer).  For either format RealProducer will only be able to transcribe it if the appropriate codecs are installed on brep, viewport or whichever machine you are using.  The easiest way to check this is to try and playback the file on the machine.  Also, Real Producer will only do a pure transcode to Real Media format.  If you need the video to be cropped or resized as part of the process you will need to use Media Cleaner 5 (or munge your video using some other technique before using Real Producer).

Now that that is out of the way, just run Real Producer (it should be somewhere in the Start menu).  It will come up with a dialog box for input and output source.  Select 'File' for input and choose your video file.  Select Real Media file for output and choose where you want to save your file.  Now click 'OK'.  In the main program window you can enter info about the clip on the left.  In the middle you should choose 'Multi-rate SureStream' (if, however, you ever intend to stream this from a normal web server you must choose single-rate since http streaming does not work with multi-rate streams), otherwise only the highest encode rate will get used from the normal web server), and how to bias the audio and video compression.  On the right you can choose one or two different rates you want this file to stream at (if you need more use Media Cleaner 5).  I recommend 384K DSL and 28.8K Modem as those two rates hit the high and the low end.  Now click start and it will grind away for a while.  When it is done there are few more dialogs to click which can be ignored.  You now have your Real Media file!

Using Media Cleaner 5

Media Cleaner 5 is a generic media transcoder and will convert just about any audio or video file into just about any new format.  It is installed on the machine called viz which is in the corner of the lab next to glare and shadow.  Heather should also have the software in her office and you can install it on your own machine, but the software checks the net when run so only one copy can be active on any machine in the lab at one time.  It will do frame size and rate conversions as well as cropping and many other things during the transcode process.  It also allows you to output Real Media format files that support more than just two discrete streaming rates.

To use Media Cleaner, start the program from the Start menu.  You can then open your input file from the file menu.  A box showing the first frame (or just controls if you are doing audio) will pop up.  In that box you can click on settings and either use the wizard interface to choose the output file details, or click 'Advanced Settings' to choose everything manually yourself.  Make sure to choose a target of Internet and an output format of Real if you want to stream from the Real Server.  Once your settings are made click the Play arrow button in the Batch window to begin the transcode process.

Media Cleaner 5 is quite powerful and complicated, so this is just an overview.  You'll have to fool around more on your own if you want to do more advanced things.

However, if you want some good default settings for a high-quality video, try a Real LAN stream at 606 kbps. You probably also want to manually crop because most of the time your footage will have junk on the sides. Simply choose 'manual crop' in the settings menu, then you can click-and-drag on the window displaying a frame from your file to select an area.


Where to Put the Files, and How the Server is Setup

The streaming server is setup on the machine 'mediastream.stanford.edu' (as of now this is actually an alias for graphics.stanford.edu, but this may move over time, so use the alias).  It has a 50GB local disk '/streaming' which can be used for content, or you can store your file anywhere in the graphics lab Unix based file system.

Server Administration

Administering the server is also pretty easy.  Everything is taken care of over a admin web server built into the streaming server.  It can be accessed at http://mediastream.stanford.edu:21361/admin/index.html.  You will need a login name and password from John Gerth (gerth@graphics.stanford.edu) or myself.  From the administration site you can add different directory mount points and configure access control and other things.  You can also monitor the current server load and view reports of the server usage for the current week and past weeks.  Finally you can cause the server to restart in case it is acting flakey.

The actual server files are located in /web/tools/realserver on mediastream.  The configuration file is automatically edited from the web interface, but if you want to edit something manually there is a rmserver.cfg file in that directory.  There is also a file in /etc/init.d called realserverd which is called at startup and can be used to start and stop the server and report software (which is integrated in the admin site but runs separately.


Creating Web Pages with Streaming Files

To stream your audio or video you need to create a special text file with the extension .ram which can be located in any web accessible location.  This file should contain a single line which is a rtsp:// style streaming URL.  A streaming URL  looks like the following:

 rtsp://mediastream.stanford.edu:554/video/vrip-fullframe.rm

The rtsp stands for real-time streaming protocol.  Files that are stored in /streaming on mediastream are accessed at the root in the URL, so in the previous example the file is actually at 'mediastream:/streaming/video/vrip-fullframe.rm'.  Files that are in your home directory can be accessed using the typical '/users/', which is the same as using '/u/' from the Unix command-line.  So if you have something in the video sub-directory of your home directory you could access it as rtsp://mediastream.stanford.edu:554/users/<yourname>/video/myvideo.rm.    In general anything that is going to get moderate to heavy use should probably be moved to mediastream so that it doesn't have to be transferred over our network twice, once for NFS and once out to the consumer.

You can then link directly to this .ram file in your web page.   When a user clicks on the link the .ram file is downloaded and passed to the users Real Player which then follows the link to begin the streaming.  (As an aside, you can also use this technique to stream Real Media files from a normal web site by replacing the rtsp:// with the http:// path to the Real Media file.  Real Player is then smart enough to know that it can begin playing the file before it finishes transferring it from the web server.  The disadvantage of this is that you can't seek in the file or use multi-rate streams which require a streaming server).

Note that you can also just use the rtsp:// URL as the hyperlink in your web page, but Netscape users won't be able to see the video (and only IE5 users will be able to see it for sure-- other browsers haven't been tested).