'Here There Be Bias'
As a prelude to this article I am stating that to all who wish to
engage me on the issue; Yes, I know there are other ways to stream
video. I am not purporting that the way I describe here is the only way
or even the best way. It is simply A way to do it and to do it on the
cheap. I did this for simplicity sake and not because is inferior in any way.
'Back In The Day'
When the web was young it was full of promise. It was going to change
all of our lives in ways that we couldn't even image. Now that things
have settled down, bubble has burst and fingers have been pointed; we
can deal with the realities of what the web can really deliver. One
thing has become apparent is that it the web is a usable transport for
delivering streaming messages. The web is filled with streaming audio
sites and the courts are full of lawsuits to try and make sense of the
ever changing copyright implications. I'll spare you my rant on this
issue. If you are really interested or just bored, email me and I'll
give you a bag full of it.
Streaming video is not nearly as popular. While there are sites
offering streaming video, more and more are going off-line or converting
to pay-per-view sites. (Do you remember when foxnews.com used to stream
live? Those were the wild days of the web.) The simple reason is that
streaming video consumes bandwidth in a big way. Bandwidth is one of the
few constraints on the 'Net both at the server and at the client. At
last count roughly 50% of American households had a broadband connection
to the 'Net of some kind. Therefore, for most streaming video
applications, your available market is only ˝ of the connected users.
(Assuming you are targeting American consumers)
'A Journey of 1,000 Steps Starts With Tool Selection'
Having now depressed you by telling you that ˝ of your audience is
deaf and blind to your message; let me brighten your spirits a bit.
Converting existing digital video content to something that can be
streamed is easier hooking up the average home entertainment system.
Most of the tools we need are open source and free., In the case of
Windows users, the tools aren't free but you've already paid for them so
they seem free.
The tools we will need are:
- A Web Server
If you don't already have one and you are using a Windows machine, go
here and grab this. http://sourceforge.net/projects/miniserver/ Linux
or Mac OSX try http://www.apache.org
- Helix Producer
http://www.realnetworks.com/products/free_trial.html This is the heart
of what we are going to be doing. This converts many different video
formats into Real Media.
- Video content
You are on your own on this one. I'm assuming that if you are reading
this then you know how to make this. Otherwise, you need to back up a
few steps.
- Real One
http://www.real.com/freeplayer/?rppr=rnwk This is the player that will
play our content. This is installed on 99% of the computers in the US
but in case you are part of the 1% that missed out, go grab it and
install it before going too much further.
These are the 4 keys to streaming video. If you've got all 4 then
the door is unlocked, please step inside. If you are missing any of the
above you may want to pause your game and go get them before continuing.
You cannot complete the quest without them.
I'll warn you though streaming video, even low quality streaming,
takes up a lot of bandwidth. If your connection to the 'Net is a cable
modem or a home DSL line, you are going to suck it dry with one or two
connections. The example I show here is streaming video from a web
server on your computer to a player on your computer. If your computer
has an IP address on the 'Net then others can view your video as well.
I'd be careful who you give the address too.
'This Ain't HDTV'
Now let's talk about video quality for a minute. When we talk about
streaming video quality we are really talking about two things, picture
size and frames per second. The combination of these two factors, times
the number of concurrent streams you want to support, will determine how
much bandwidth you will need.
Luckily, Helix Producer wraps all of these up into a single metric
for us, Kbs. They conveniently group the different streams into
'audiences'. An audience in this case is a particular bandwidth target.
(i.e. 56k, ISDN Single, ISDN Dual, etc.) This makes it easier for us
to determine our bandwidth needs.
Now that we all understand the basics, let's determine our needs. For
the sake of this article, we will assume that we have a cable modem to
work with. This means we need to make a decision. DO we want to limit
the quality of our video (Fewer fps, lower audio quality) or do we want
to limit the number of simultaneous streams we will server. Let's strike
a balance. Let's chose 128k Dual ISDN as our audience. This has a Kbs
rate of 100Kbs. Given that most cable connections are capped at 256Kbs
these days, this gives us a maximum of 2 simultaneous users.
(2X100Kbs=200Kbs<256Kbs. You see this, right?)
'Hi-Ho, Hi-Ho, Encoding We Will Go'
Now, let's encode that video. This is the easy part. Let's fire up
our encoder, Helix Producer Basic. The first thing you will notice is
that the interface is intuitive if you were born with a video camera in
your hand. For the rest of us, it takes a bit of getting used to. The
basics are this. On the left is your source, on the right is your
output. To select your input file just click on the browse button about
˝ way down the screen. Use the dialog to find your file and then click
on Open. Clicking on the 'Source Properties' button will show you
interesting but altogether useless information on your input file. Now
let's prepare the output.
As we talked about above, you have to tell it what "audience" to
encode the file for. Helix Producer Basic will encode a file for
multiple audiences and store the streams in the same file if you wish.
For the purposes of this article DO NOT DO THIS! Once you get a Helix
server setup and running you can experiment with multiple bit rates but
if you are doing this the poor -man's way as I am describing it,
multiple bit rates are not your friend.
Click on the Audiences button and then select '128k Dual ISDN ' from
the dialog on the left. Click on the arrow between the two boxes to move
it over to the Audiences box. Now click on Save. No, wait, don't do
that as they seem to have forgotten to give us a save button. (This is
a good example of bad interface design!) Click on the little X in the
upper right hand corner. This is the only way to exit the dialog. (There
is no cancel so don't you dare mess up!)
Another example of less-than-perfect interface design is the way you
specify a destination other than the same directory that your source
file is in. If you need to put the destination in another place, click
on the pencil icon about 2/3 the way down on the right hand side of the
screen. This will bring up the standard windows 'Save As' dialog. Select
your new destination and click Save.
We are now ready to push the 'whoopie' button. (For those not paying
attention, most computer applications have a whoopee button. It's the
button you click to get things done, make things happen and potentially
mess things up. Be very carefull with the whoopee button.) In the lower
right corner of the Helix Producer screen is the Encode button. If
everything looks right, press it. Now go get coffee. Depending on the
size of your video clip, this could take a while. It's a 2 pass process.
In the first pass, Helix Producer analyzes the video and audio. In the
second pass, it actually creates the file.
"Hi I'm Apache and I'll be Your Server Tonight."
Ok, back from our coffee break and it's almost done. Let's take a
moment to discuss the actual streaming part. You now have (or soon will
have) a file encoded in Real.com's proprietary format Real Media. (.rm)
Most of the time files of this nature are served up by a Helix Server.
Helix Server is a good technology and available for free in certain
situations. However, it's a bit cumbersome if you are only going to
stream a single file to a couple of people. For that we can use our
existing (or soon to be existing) web server. If you are running a
flavor of Windows, chances are good that you have a version of IIS
installed. I'll spare you my usual rant about security here and just say
that if you've got that then you are good to go. If you don't, you need
a web server. My favorite web server is Apache. (www.apache.org) Not
because it servers better than 60% of the web, not because security
vulnerabilities are fixed within 24 hours of being found, bit because
it's all that and free. Like any product you want to run under Windows
it requires installing and configuring just to make it work.
There is a better way. Visit SourceForge.net
(http://sourceforge.net/projects/miniserver/) and download a copy of
Uniform Server if you haven't already. This is a zip file containing a
pre-configured version of Apahce, PHP, MySQL and Perl. It's way more
than we need for this project but that's ok.
Unzip it into a working directory and find the Start.bat icon. Leave
the DOS box alone. You can minimize it if it really irritates you but
don't close it. For those of you who closed it before reading this,
click the Start.bat again.
Congratulations, you now have a fully working web server running on
your machine. It's that simple. Read the documentation if you want to
find out everything this incredible package is capable of. For our
purposes, we're done with setup.
If you open My Computer (and I STILL feel weird telling people to
open MY Computer) you will notice a new drive on your computer, 'W:'.
You've probably figured out that it's not a real drive. It was created
when you started the web server and it will go away when you shut it
down. It points to a directory where all your content will go. It's the
w:\www directory that we are interested in.
FINALLY!
Now let's bring it all together. Make sure your web server is up and
running. If you are not using Uniform Server then you need to do some
translating below. Whenever I refer to w:\www you put in the drive and
directory where your web files go. Now, place your newly converted
video in w:\www. I named mine becky.rm since it's a video my beautiful
daughter did. You call yours whatever you want, but unless you call it
becky.rm you'll need to do even more translating.
Create a new file with notepad. (IMHO, Notepad was the last program
that Microsoft got right. Since then it's been down-hill) and in it put
the line:
http://localhost/becky.rm
Save it as w:\www\becky.ram. NOTE make sure it's .ram, not .rm. If
you are paying attention you'll know that you already have a .rm file.
Convention dictates that both the .ram and the .rm file have the same
base name. However, this is not a requirement.
Here we go. You've stuck with me this far wading through bad jokes
and incomprehensible rants to get to this point, let's do the deed.
Open a web browser (have I mentioned that my favorite is
www.mozilla.org) and type in http://localhost/becky.ram. (not
http://localhost/becky.rm, this is an important fact)
If you did everything correctly and you have Real Video loaded on
your machine then you should now be watching your video.
The RAM file is a pointer file. If we tried to open
http://localhost/becky.rm, the browser would prompt us to save or open
the file. Even if we opened it at this point, the file would download
completely before it started playing. (This is NOT streaming! This is
downloading. People I can't stress this enough.)
'End Game'
Well, that's it. That's really all you have to do to put a video
file up for streaming playback. Now for the bad news, this will choke a
web server real quick. Yes, it can be done in a production environment.
I did it at http://www.jjonline.com/ram/hisTruthStillMarchesOn.ram.
Only because it's the only streaming video on that site. It wasn't worth
the hassle and expense of setting up Helix Server. If you anticipate
more than 3-4 simultaneous streams then I would seriously consider
setting up Helix Server. Almost everything you've read here is
applicable…but it's not as easy to set the server up.
As with everything I write, I sincerely hope it helps. If you have
any questions, don't hesitate to write.