You are here: Re: ipcam to stream? « PHP Programming Language « IT news, forums, messages
Re: ipcam to stream?

Posted by Erwin Moller on 03/27/07 14:12

CptDondo wrote:

> 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.

Hi,

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";
file_put_contents($fileName,$content);
}
*****************************
(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.

Regards,
Erwin Moller


>
> 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
> stream....
>
> The web server is running linux (debian etch), apache2, and php5.
>
> I would appreciate any pointers or guidance.
>
> Thanks,
>
> --Yan

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация