TUTORIAL:  MPEG-4 with QuickTime Player 

 

Why Embedded Video?

External, stand-alone player such as VBrick StreamPlayer, Windows Media Player, Real's player, and Apple's QuickTime require a user to enter the address of a stream to view it.  This adds complexity that most users don't need!  Further, video in a web page provides great flexibility...you can easily customize the graphics that might wrap around a player, add text and links, adjust the size, and perform advanced functions.

It is easy to view video over the Internet directly from the VBrick VBXcast MPEG-4 encoding appliance!  In this brief tutorial, we will use Apple's QuickTime embedded in a web page (VBrick's StreamPlayer has special features such as Closed Captions and Metadata that you may wish to consider for web viewing, but this illustration will use QuickTime). 

Viewing multicast video on your Local Area Network or on true broadband networks such as the Internet2 use different techniques than are illustrated here.  This tutorial will only show how to receive video via networks that only support unicast, such as the public Internet or very old private networks.

Why Use QuickTime? If you are only showing MPEG-4, QuickTime player does not require a license (The VBrick player does require a license because all MPEG-4 decoders require a payment to the MPEG-4 patent holders and the AAC audio patent holders).  However, QuickTime does not support industry standard closed captions (the VBrick player does support industry-standard ISMA closed captions), and QuickTime does not support MPEG-1, MPEG-2 or WM while the VBrick player does. 

 

Method 1, Javascript:

Unfortunately (and rather amazingly), QuickTime does not well support the direct coding of RTSP in the embedded player using the conventional "scr" parameter.  This is probably because of Apple's proprietary (".mov") video heritage, but you can easily work around this using a simple Javascript function as shown below in IE.  See Method 3 for MAC and Windows.  Cut and paste the following to your web page: 

 

This code uses the free Apple QuickTime player (version 6 or above) to decode and play live industry-standard MPEG-4 audio/video from a VBrick.  The "codebase" statement causes any computer that does not already have QuickTime installed to receive it automatically.

Note that the <body onload="playIt()"> event calls the function that tells QuickTime to play the video via the setURL() function.  Edit the qt.setURL line to match your VBrick's IP address and stream name, for example qt.setURL("rtsp://123.123.123.123/vbrickvideo1").

While this is the simplest method, QuickTime does not resize the video.  If your source video is set to 352 x 240, QuickTime will display it in this size regardless of how large you make the player.  This is normally not a problem, but if you wish to resize the video, this method will not work and you may want to use Method 2 or 3 described below. To view this video, click here.

Oddly enough, Apple MAC browsers do not support scripting of QuickTime 6, and version 7 has serious errors (it does not properly edit MPEG-4)  As a result, sophisticated functions for Apple QuickTime only work with Windows.

 

Method 2, Reference Movie:

We will first make a "reference movie" file, which is a very simple XML file that "points" to our live video stream.  Using notepad or similar text editor, copy the following: 

Edit the "<embed src=" line to match your VBrick IP address and stream name. Don't forget to leave the final "/" as shown...this is a XML file not a html file.  Save this file with a .mov file extension and place it on your web server (it is saved as "myvideo.mov" on this server).  

Create a web page. Cut and paste the following to your web page: 

Note that the QuickTime PARAM SRC is set to your new .mov file.  To view this video click here.

The advantage of this method is that the video is resizable in your web page.  Another advantage is that you can just provide a link to your new .mov file without embedding the video (like this, for example), and if the viewer has QuickTime installed, it will play.

As illustrated above, the XML file is quite small.  You can email this file to your viewers as an alternative to posting it on a web server.  Opening the file .mov file will open QuickTime and the video will play.

 

Method 3, Coding for Windows and MAC

 You can put VBrick MPEG-4 video in a web page that will play properly with both Windows IE and MAC Safari by using both the following code.  Note that you will not use the "src" parameter but instead will use "qtsrc".  This parameter forces QuickTime to ignore the MIME type and play the video even though it is not the proprietary ".mov" type.  The good news is that the player will resize normally too.

 To see the above code in action, click here.

  The following illustrates stop/stop control using Javascript that has been properly coded for operation in both Windows IE and MAC Safari:

To see this code in action, click here.

 

Firewalls

The VBrick MPEG-4 video is ideally sent to the player from the VBrick via User Datagram Protocol (UDP). 

The player makes a request to the VBrick on port 554, and the VBrick streams the audio/video to the first player on UDP ports 6970, 6971, 6972 and 6973.  The next player to request a stream uses UDP the next four higher ports (6974 - 6978), and each subsequent player uses the next higher set of four ports up to the maximum the VBrick server supports.  For this reason, any firewalls in the path must be open for port 554 and 6970 - 6973.  

Unfortunately, many firewalls block all UDP by default.  To view the video, the user's firewall must be reconfigured -- sometimes this is an impossible prospect because IT managers will ask you to prove the impossible: "Prove to me that nothing bad will ever happen if I open these ports in the corporate firewall".

In VBrick appliance firmware version 3.1 and above, HTTP tunneling is supported.  With HTTP tunneling, the streams can be sent via HTTP on port 80 or other defined port, thereby getting though most firewalls.  If using HTTP tunneling, you can include the port in your URL, for example "rtsp://123.123.123.123:80/myvideo".  However, QuickTime (version 6.5) and StreamPlayer (version 4.2) will automatically negotiate and select HTTP tunneling if UDP fails. 

 

Multicast

You can display VBrick MPEG-4 multicast using a similar techique as rtsp unicast.  For multicast, simply tell QuickTime player to use the VBrick automatic SDP file.  The following displays VBrick MPEG-4 in a QuickTime player from a VBrick at 192.168.1.110 where the VBrick slot 1 destination 1 is set for multicast:

 

 

Capacity

One VBrick MPEG-4 appliance can webcast to 200 simultaneous viewers on the public Internet, up to a total of 38 Mbps (VBrick firmware version 3.1 and above).  If your audio/video is set to 300 Kbps, ten viewers will require 3000 Kbps (3 Mbps) and 100 viewers will require 30000 Kbps (30 Mbps).  This may be more Internet access bandwidth than you have available.  If so, you may send your video to a "reflector" (see below).

The VBrick appliance allows you to limit the number of viewers.  You can do this by setting the maximum number of simultaneous viewers or the maximum allowable bandwidth.  Viewers that exceed this setting will be denied access and your web page might simply warn: "If you cannot view the video, the system may be at capacity.  Please try again later".

 

VBrick Is A Server

A VBrick MPEG-4 appliance is not just an "encoder"...it is a full multifunction server!  As with any server, it must be accessible to the clients it seeks to serve.  Therefore, if you wish to deliver audio/video from a VBrick directly to Internet clients, the VBrick must be on an "outside" address, or NAT'ed to an outside address.  VBrick appliances are not Windows or Linux servers!!  They are virtually immune to viruses or worms and are very safe to locate on an outside address (although you will want to give them a strong username/password).

If your VBrick includes the VBSTAR option (internal hard disk), you do not even need an additional web server!  You can build and upload all web pages directly to your VBrick server and allow it to deliver the viewing pages directly.  You can even include specially formatted web pages on your VBrick without a hard drive. There are example pages and instructions on www.videoalive.com (see "video players" and select "Integral Players").

 

Reflector Service

Rather than serving viewers directly from the VBrick appliance, you can send one stream to a reflector server and have that reflector server deliver the streams to your viewers.  The advantage of this approach is that you do not need high bandwidth at your encoding location.  Another important advantage is that your source VBrick does not need to be on an "outside" address and my be NAT'ed.

You can host your own reflector server by configuring Apple's free Darwin Server.  Configure your VBrick to unicast to this server, create a SDP file by pressing the "Get SDP" button on your VBrick management interface, and place this SDP file on your server.  You then code your player with the IP address of the reflector server rather than the VBrick server.  Obviously, your reflector server must have adequate bandwidth to deliver (reflect) streams your desired number of viewers.

Public reflector service is available from PowerStream (http://vbrick.powerstream.net).  Their servers have very high speed Internet access and their service automatically uploads the SDP from your VBrick.  This is a very cost-effective and convenient service to deliver video to thousands of viewers on the public Internet.

 

Test Streams

The following live video streams are available for testing your embedded video player code (as of August 2004, but the addresses are subject to change).

URL Description
   
rtsp://132.239.126.114/vbrickvideo1 A direct stream from the University of California. 
   

 

 

Advanced Embedding

With good html, vbscript and/or javascript skills, you can create highly functional web pages that go well beyond just viewing. 

Need help? Contact rmavro AT vbrick.com (email obscured to reduce spam from automatic email harvest engines)