Jump to content


Photo

Video survailance


  • Please log in to reply
16 replies to this topic

#1 babylonsr

babylonsr
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 October 2006 - 06:02 PM

Hi all

I am new to PHP! I am creating a project with my friends about video survailance. Our goal is to monitor few webcams as in LAN, i mean in the same building and also to put few webcams in another place and monitor them remotely via internet. Anyone has any idea before starting. We would like to do it using PHP, so is it possible?

Thanks all


#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 05 October 2006 - 06:07 PM

I think you can do it if you are able to stream the video feed. Make a script to run from the command line and have the code inside an infinite loop*, that should make it work.

* an infinite loop is something like this:
while(1==1)
{

}


#3 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 05 October 2006 - 06:27 PM

I suggest you don't use infinite loops for anything, just because they're infinite loops. You should be able to easily stream the video feed without any PHP at all. As to exactly how you would do that, you should refer to your webcams' manuals or manufacturers.
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#4 babylonsr

babylonsr
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 October 2006 - 06:42 PM

I found few interesting softwares like Active WebCam... but i am not sure if it is good to use it. We would like to access by LAN and also via Internet, so i can view the cams and also any other guest. Advice!

#5 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 05 October 2006 - 06:45 PM

check to see if your webcams have an ethernet port on them - if so, you can plug them directly into your network and they'll act as a regular network device. The one we have at work has a little httpd server that you can access to see the stream - I'm not sure as to the capabilities of yours, but it might be worth looking into.
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#6 babylonsr

babylonsr
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 October 2006 - 06:47 PM

Tell me any brand of such cams. I haven't bought anything yet, i am trying on few small USB webcams, but we sure will buy with enternet port as you said... Since u have tested it what is the brand... Thanks

#7 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 05 October 2006 - 06:50 PM

I don't know the brand, but when I get to work, I'll look and get the brand and model. I didn't set it up, but I use it regularly, so I know it works. :)
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#8 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 05 October 2006 - 06:56 PM

I suggest you don't use infinite loops for anything


If you need an application to run until something happens, then you would need an infinite loop. Try to look at some C/C++ tutorials, many of them tells you to use an infinite loop, well, not entirely infinite as it might be some like this (not sure if it's correct - I'm not very good at C):
#include <stdio.h>

int main()
{
	int option;
	
	while(1==1)
	{
		option = menu();
		if(option == 1)
		{
			printf("Hello");
		}
		else if(option == 0)
		{
			printf("Bye!");
			break;
		}
		else {
			printf("Invalid option!");
		}
	}
	
	return 0;
}

int menu()
{
	int user_option;

	printf("MENU:");
	printf("1) Say hello");
	printf("----------");
	printf("0) Exit");
	
	scanf("%d", &user_option);
	
	return user_option;
}

I know it might be stupid to post a C example on a PHP forum, but it's the only thing I could come up with. And the reason why I said how he could do it in PHP is that he requested it to be like this.

#9 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 05 October 2006 - 07:13 PM

daniel, scripting languages do not work the same way as compiled programming languages. with programming languages, loops work perfectly as you can manipulate screen contents in the middle of a loop.

what you need to remember is that PHP essentially creates a HTML document, and until the script has finished its job of doing that, nothing is output to the browser. so setting PHP into an infinite loop will give you an infinite page of blankness - until a script timeout error occurs, of course.

if you were to type something like this: (pseudocode, just for cross-language idea):

for ($i = 0; $i < 100000; $i++)
{
   echo 'hello world ';
}

run something like it in C/C++/whatever, and you'll see each word come on the screen one by one.
do this in a scripting language (PHP/ASP/JSP, etc) and you wont see anything until ALL 100000 'hello world's' have been output - the '"echo" in a scripting language is essentially forming part of the HTML to be sent out in one go, and not outputting it to the screen directly with each loop iteration.
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#10 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 06 October 2006 - 01:49 AM

Sorry, a bit OT, but....

do this in a scripting language (PHP/ASP/JSP, etc) and you wont see anything until ALL 100000 'hello world's' have been output


Not entirely true. This is more to do with the fact that your working within a web environment. If you run your example using php's cli the output is exactly the same as it would be done in C/C++/whatever.

Ive written quite a few daemons in scripting languages, bash, python and php, its just http that makes this sort of thing more difficult.

#11 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 06 October 2006 - 05:31 AM

daniel, scripting languages do not work the same way as compiled programming languages


Depends on how you run it. If you run it using a webserver, then it don't, but if you run it from command-line it will work sort of the same way.

#12 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 06 October 2006 - 06:11 AM

daniel, scripting languages do not work the same way as compiled programming languages


Depends on how you run it. If you run it using a webserver, then it don't, but if you run it from command-line it will work sort of the same way.


Huh. Is that how it works?
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#13 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 06 October 2006 - 08:51 AM

i didnt know that either :) cheers thorpe/daniel.

however i get the feeling from the original post that "monitoring webcambs" and "via the internet" would effectively mean that this sort of infinite loop would not be applicable as the final app would be running via the browser.
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#14 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 06 October 2006 - 12:43 PM

In fact I think it runs like that on a webserver too, but it will interpret the code for the webserver and while it does that, it sends it to the webserver continuously. When it is all done the webserver sends the result to the client in one piece. That gives the illusion that nothing is output before script execution.

The main difference between compiled and interpreted languages is that compiles languages is interpreted into something the computer can understand one time where interpreted languages is interpreted each time. So in my oppinion PHP is just as much a "real" programming language as the compiled ones.

#15 freeloader

freeloader
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 07 October 2006 - 04:25 PM

I would't start a project like this in PHP if you're not familiar with the language. Also, I think it'll be more stable in C/C++.

#16 anatak

anatak
  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 23 October 2006 - 05:35 AM

this may sound stupd
but why do you want to program that ?
the webcams that have an ethernet interface come mostly with surveilance software that let you do exactly what you want.

Unless it is for a school project of something similar.

here is a case of why and how webcams were used.
http://www.windfinde...d/webcam_en.htm

http://www.macworld....s207w/index.php

wireless (beware for security problems)
http://www.amazon.co...m/dp/B000067JZF

and not wireless
http://computing.kel...100basemtx.html
takasi.8008@docomo.ne.jp
tourokum@0508.jp

#17 R_P

R_P
  • Members
  • PipPipPip
  • Advanced Member
  • 98 posts

Posted 24 October 2006 - 08:19 PM

Your cams, depending on their capability should have that sort of feature built-in. You may need a third party streaming server to do the streaming to the web, which would be a very tall order to create, even for someone with a lot of programming experience. You can use PHP to build your website around the streams, thats fine, but not to control the streams themselves.

Also, for those of you who have never used it, PHP has a very comprehensive CLI (Command Line Interface) and I've written a number of very efficient (and stable) daemons including listeners and chat bots using PHP on the command line.  Using PHP-GTK you can even write your own client software using PHP which is also little-known to PHP developers.
Pro in: Win2K3S | Apache2 | PHP5 | Perl5 | MySQL | MSSQL | Firefox | Photoshop
Student of: Ubuntu6 | Java | C | VB.NET | ASP.NET
Developer: Roddzilla Webstudios, Burrson CG, DVIDSHUB, The Four Nations
Student: Georgia Tech, Georgia Tech College of Computing




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users