473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Using PHP to proxy access to streaming source

Hi all,

Anybody tried this? Know of any published work on the topic? More
specifically, I am have a webcam (hardware device which connects directly
to the network) which will be behind a public webserver (LAMP). The
webserver will serve up predominantly static content. I want it to mediate
access to the camera for security reasons (camera control is exposed via
HTTP, also provides different URLs for different protocols / resolutions)
to manage bandwidth more cleverly.
TIA,

C.
Jul 17 '05 #1
1 4158
Colin McKinnon <Colin McKinnon <co**************@andthis.mms3.com>> wrote:
Anybody tried this? Know of any published work on the topic? More
specifically, I am have a webcam (hardware device which connects directly
to the network) which will be behind a public webserver (LAMP). The
webserver will serve up predominantly static content. I want it to mediate
access to the camera for security reasons (camera control is exposed via
HTTP, also provides different URLs for different protocols / resolutions)
to manage bandwidth more cleverly.

I hope I got this right: The webcam capture is an image, obtainable through
HTTP? If so, you could grab the image using file_get_contents() and then
open and resize it using the gd library <http://www.php.net/gd>. Either on
demand on the server or invoked as a cronjob every x minutes.
I understand "different protocols" as "HTTP, FTP, maybe some more", so you
would need the image as file(s) on the hard disk. Since you can't check for
requests to the image via FTP (as long as you don't use special software) I
would suggest using the cronjob and a command line script (untested!):
(You need PHP as binary to do so!)

<?php
set_time_limit(0); // could take some time ;)
// getting the original image
$image = file_get_contents('http://webcamserver/path/to/webcamshot.jpg');
fwrite($f = fopen('original.jpg', 'w'), $image);
fclose($f); unset($image);

// the width of the resized images
// (height will be calculated)
$resolutions = array(
400,
320,
240,
160,
80 // no comma here!
);

// opening the original image
$orig = ImageCreateFromJPEG('original.jpg');
$ow = ImageSX($orig);
$oh = ImageSY($orig);
$ratio= ((float) $oh) / ((float) $ow);
$path = 'path/to/public/images/';

foreach ($resolutions as $w) {
$h = round($ratio * $w);
$im = ImageCreateTrueColor($w, $h);
ImageCopyResampled($im, $dest, 0, 0, 0, 0, $w, $h, $ow, $oh);
ImageJPEG($im,$path.$w.'.jpeg',80);
ImageDestroy($im);
}

?>

--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Fuzzyman | last post by:
In a nutshell - the question I'm asking is, how do I make a socket conenction go via a proxy server ? All our internet traffic has to go through a proxy-server at location 'dav-serv:8080' and I...
6
by: John Sheppard | last post by:
Hello there, I am unsure as to where to ask for help about this, so I thought I might try here. Our website works correctly for 99.9% of customers, however we have one set of customers who...
6
by: Evan David Light | last post by:
After agonizing over this problem for a few days, I've decided to seek help. No, not the variety that involes a jacket that zips up the back but this august body of intrepid individuals. I've...
1
by: tasa3dit | last post by:
hi i've to develop a streaming proxy for rtsp and i've some questions : - how can i know from rtsp requests and responses if the stream is direct (live) or differred? - how can implement...
5
by: Benne Smith | last post by:
Hi, I have three enviroments; a development, a testing and a production enviroment. I'm making a big application (.exe), which uses alot of different webservices. I don't use the webservices...
0
by: George | last post by:
Hello, I'm running an ASPX application "WebApplication1" which consumes a web service (service1.asmx) hosted on a machine with IP (128.1.7.x) . The web service is located in the intranet. The...
6
by: Bob Weiner | last post by:
I have a few dll's that return their own version of Account objects. In the asp code I am writing now I would like to define an interface, called IAccount, and convert each of these objects (...
0
by: reco | last post by:
Hi, I am only new to development and have been given a task to convert a Perl script to a Windows Service. The issue I am facing is that the current Perl Script uses a SOAP call to an Apache Web...
4
by: Jon | last post by:
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.