|
|
|
by: Silvina Georgieva
These days, web cameras are everywhere. Your friends have one, maybe
your office or the university that you study in also do. So, you decided
to finally go with the crowd and get a camera. Now that you have it at
home and connected to your computer, you probably wonder: "How do I make
this thing show a picture online?" We are here to explain.
Setting up your own web camera is easy: all you need is a computer, the
cam itself, webcam software which will do the broadcasting, and an
Internet connection.
Streaming Video vs. Still Images
The first decision you have to make before putting your camera live is
if it will show streaming video or still images. If you have visited a
webcam directory such as OnlineCamera.com and looked at a few cams, you
have most probably noticed that some of them show a continious stream of
live video, while others refresh the page in your browser and show a
different picture at a pre-set time interval. The first flavor, the
streaming ones, are without doubt more attractive to a viewer, but can
you support such a camera?
|
|
| |
If you have a broadband Internet connection, and you can afford setting
aside much bandwith for your camera to stream, the answer is yes. If
not, you'd better stick with the still image camera - that will make the
proccess lighter for both you and your camera's viewers, and such a
connection can work without problems even if you access the 'net through
a dial-up connection. Also, this will give you the chance to show the
world images with higher picture quality - larger and without grains, -
although those images won't be moving the way they do on TV.
It is also important to consider the image size of the shots being taken
by your webcam: the greater the image, the lower the refresh rate. A
640x480 pixels image can be great looking, but it can be great trouble
for users with slow Internet connections, especially if the refresh rate
of your camera is set to an interval such as 3 seconds. Take a look at
the options of the broadcasting software that came with your webcam, and
think of how different options that it offers would look on other
people's computers. If you have friends and relatives living away from
you who have Internet access, you could ask them to test your camera.
Set it to different combinations of image size and refresh rates, and
ask them to look at it and tell you how it looks. This way you could
have some great fun with your camera even before you show it to the
public. In case you don't have people to experiment with, keep the
following tips in mind: a reasonable image size can be 320x240 pixels if
refreshed every 20-30 seconds. If you want the picture to update more
often, try with an image size of 160x120 pixels. Using that, you can
have refresh rates of up to 10 seconds. If you stream live video, try to
keep an image size of 160x120 so slow Internet connections can see your
webcam without problems.
Methods of Delivering the Webcam Shots
Client Pull
This method is the most popular, designed to show single snapshots from
the webcam. It is the most easy method to set up, and the one that works
perfectly for dial-up Internet connections. It also won't take much
bandwith from your connection, so you'll still be able to surf the web,
get e-mail, and other things while your webcam snaps shots. However, you
won't be able to serve live video feeds with this method.
This method is usually accomplished with an FTP connection that sends
the last shot captured by the WebCam to the site hosting your web pages.
Server Push
This is the most resource-consuming method, and thus, the least
implemented. You should use it if you'd like to stream live video from
your cam to viewers. It has its limitations, some of which are:
It requires a high bandwith connection. You must put a limit to the
video stream for each user connecting to it.
You can't use a dial-up connection for this method. If there is a
firewall in your network, it can disallow you to use this method, or can
limit you in some way or another. Only the most recent browser versions
support server push.
To set up a server push webcam, you'll need a fixed IP (dynamic IP's are
also possible, but you need more resources) and server push software.
How to Refresh the Image Once you've decided which kind of webcam you
are setting up, you need to decide how to make it refresh the image.
To get the latest shot captured by the camera, your viewers will have to
reload it (usually by pushing the F5 button on their keyboard), unless
you add some extra HTML, Javascript code or Java applets which will
autoreload the picture after a given period that you can define. (This
does not apply to the server push method, since it is continously
streaming a video feed).
META Tag Command
Altough this is the oldest method of refreshing a webcam image on a web
page, it is in use in many places, and works perfectly. This way of
refreshing is done via a little HTML code.
There is an HTML tag than can make a page automatically reload after a
period of time (in seconds) is reached. The syntax for this tag is as
follows:
<HEAD>
<META HTTP-EQUIV=REFRESH CONTENT="seconds">
</HEAD>
At the interval in seconds, the browser will reload the current page,
and do it over and over again until the user closes it. The most
significant disadvantage of this method is that the whole page is
reloaded, so a heavy graphics site will be a pain to reload on slow
connections and will result in high bandwith usage.
If you decide to use this method of refreshing your image, keep in mind
that some old browsers don't allow an image to automatically refresh
after some reloads. To work around this bug, add the following code to
your page's HEAD tag:
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
JavaScript Refresh
If you don't want to make your viewers wait for the whole HTML page to
refresh, you can use the JavaScript language to make just the image
refresh. Note that the visitor of your webcam page will have to enable
JavaScript in order to see the image changing (nowadays, 90% of the
audience does have JavaScript enabled).
Java Applets
Java applets are small programs embeded inside a web page, which load
the webcam images freeing the browser form that job. There are hundreds
of Java applets for this purpose available online, such as OnlineCamera
Java Viewer. You can put them anywhere in your webcam page and they'll
refresh the image for you, without refreshing the whole page, just the
image.
Stay with us to learn more in the coming parts of this tutorial.
About The Author
© 2005, OnlineCamera.com, All rights reserved.
Silvina Georgieva is Managing Director of OnlineCamera.com.
Founded in 1996, OnlineCamera is the leading independent webcam
directory on the Internet. It has more than 3000 web sites currently
listed, and grows with more every day.
Contact: http://www.onlinecamera.com/contact.htm
|
|