|
Posted by CptDondo on 03/27/07 16:00
Erwin Moller wrote:
> 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
>
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
<http://msdn.microsoft.com/coding4fun/hardware/video/article.aspx?articleid=912407>
):
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.
--Yan
Navigation:
[Reply to this message]
|