ipcam to stream?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have an airlink101 ipcam.  It "streams" jpeg images to a web browser.

Basically, the camera sends a never-ending http page, and continually  
retransmits a jpeg image.

This sort of works, but eventually the browser tries to save the file.  
It's also impossible to embed in a page.

What I really want is to grab that stream at the web server level using  
something like php, and create a stream similar to a webcam so that I  
can show embedded live video on the page.

I have never done anything like this, though, and my google searches  
have not revealed anything useful - mostly how-tos on creating  
proprietary streams using desktop tools.

I need something that can automagically create a stream that a browser  
can understand.

I've tried mplayer/mencoder and motion, but neither will produce a  

The web server is running linux (debian etch), apache2, and php5.

I would appreciate any pointers or guidance.



Re: ipcam to stream?

CptDondo wrote:

Quoted text here. Click to load it


Really? A never ending http page that refreshes the image all the time?
Do they use some meta-refresh header for that?

They would be better off using JavaScript, and simply replace the image all  
the time (better performance).

But I think you can just look at the URL of the image, and my bet is that  
that same image changes all the time. Right?

If so: what you need in PHP to get the stream of images is simply  
rerequesting the same image all the time and store them on HD or something.

So you need something simple as:

// Look up the path in the sourcecode of you page that displays the jpg
$imageSourcePath = "http://localhost/path/to/your/cam/image.jpg";
$saveDir = "/home/Yan/webcam/";
$nrOfPicsToCapture = 1000;

for ($counter=0;$counter<$nrOfPicsToCapture;$counter++){
 // make sure nobody caches
 $theImg = $imageSourcePath."?rand="+microtime();
 // get new picture
 $content = file_get_contents($theImg);
 // safe it in a file
 $fileName = $saveDir."image".$counter.".jpg";
(not tested of course)

How you make a movie out of the seperate jpg files, I don't know, but I am  
sure some software out there can help you with that (try sourceforge eg).

Hope that helps.

Erwin Moller

Quoted text here. Click to load it

Re: ipcam to stream?

Erwin Moller wrote:
Quoted text here. Click to load it

That was my first cut....  But it takes about 1-2 seconds to refresh,  
and the camera frame rate is 10 fps.  Here's the description of the  
process the camera uses (from  

MotionJPEG over HTTP uses the Content-Type header  
"multipart/x-mixed-replace" along with a configurable boundary. This  
means that the stream is made up of Multiple Parts (hence multipart) and  
each new frame should replace the previous frame (hence  
x-mixed-replace). This particular camera sends an HTTP Header like this:

Content-Type: multipart/x-mixed-replace;boundary=--video boundary--

So..  I'm kind of stuck on how to deal with that.  I want to take that  
stream and display it an an embedded object.


Re: ipcam to stream?

CptDondo wrote:

Quoted text here. Click to load it
Quoted text here. Click to load it

Yes, I see.
Sorry, I have no clue how to proceed either. I never did that before. :-/
Maybe dig into RFC that describe this type of stream?

Good luck


Quoted text here. Click to load it

Re: ipcam to stream?

CptDondo wrote:
Quoted text here. Click to load it


I've never tried it either, but I've seen it done.  It normally requires  
more than just dumping the jpeg repeatedly to the browser.  HTTP is a  
request/response protocol - it's not really designed to have one request  
go on for long periods of time.

You could take a look at .  He's  
doing the same thing I think you want to do, using some javascript.  It  
might give you some ideas.

Unfortunately I don't have the webmaster's email - I bookmarked this a  
couple of years ago as a neat site and have since lost contact with him.

You could also try asking over on alt.www.webmasters - some of them  
might have some ideas.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline