Processing Video with PHP

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

Threaded View

Is there a Linux PHP module so that I can process web cam video with
Linux PHP from multiple USB ports? (I'm working on a video surveillance
idea since I found out that my office spent a whopping $30K on their 8
camera system and were told it would cost $13K for 3 more cameras to be
added. If that inspires you to do your own system, please do so -- I
love it when people can make big cash with Linux!)

For discussions here, realize that I'm talking about wired, not
wireless, video cams. Many big corps don't allow wireless video traffic
because it can be jammed with sophisticated tools. I'm also interested
in only non-motion activated video because that's what the security
guard needs to see. (That is, unless I use motion activated video
stream for what gets written to disk, but non-motion activated video
stream goes straight to the security guard. I could combine the two
cameras under a single camera bubble in the ceiling.)

Here's some questions about this if you happen to have ideas.

1) How do I not only record the video to hard drive, but serve it up to
a monitor that the security guard can watch?

2) How do I provide real time video to the security guard, yet for what
gets written to disk, record only time slices with lossy compression so
that it uses less disk space?

3) So, if you answer the separation question in #2, how do I use PHP to
convert video input on USB into time-sliced, lossy compression
recordings to disk?

4) Is it possible to have a single Linux PC process the video from
multiple USB ports, simultaneously?

5) Any ideas on the cheapest way to run USB over very long distances in
an office? I hear I can use ordinary, powered hubs to repeat the
signal, but this requires that I get an electrician to wire me an AC
plug in the drop ceiling somewhere. Has anyone used ordinary CAT 5 to
carry the signal longer?

6) Using this API, how much can I realistically write to disk in a
usual office setting? I'm trying to figure out how much disk space I'll
need. The idea would be that the Linux PC would store the video data on
disk up to about x number of months, making nightly backups to a
DVD-RAM drive that ejects automatically every week. The IT Operations
Manager would then replace the DVD-RAM disc on Friday and store the
other offsite for long-term retention.

Re: Processing Video with PHP

Quoted text here. Click to load it

Hmmm, for 30k I could make that (depending on the actual specs :)

Quoted text here. Click to load it

There was a related question sometime (about 1month) ago, search the
archives for streaming.

You need a multiplexer, one of the connections to the multiplexer simply
writes the stream to disc.

Quoted text here. Click to load it

The disc writer should do that (it could simply drop frames).

Quoted text here. Click to load it

By calling external programs, PHP isn't necessary in the picture.

Quoted text here. Click to load it

Yes, but I can't imagine anything worse than USB for this job (okay
parallel port)... Spend some money on decend UTP cams (maybe with motion
detection) and hardware (mpeg) compression.

The only job PHP has in this whole setup is streaming and selecting the
stream to the watchers.

Re: Processing Video with PHP

Google Mike wrote:
  > Here's some questions about this if you happen to have ideas.
Quoted text here. Click to load it
I guess you could use standard linux webcam tools and run them using to catch errors/output. Other then that I shouldn't
use php.

Quoted text here. Click to load it
Again I would use webcam tools.

Quoted text here. Click to load it
Try :">
Quoted text here. Click to load it

visit my site :

Re: Processing Video with PHP

Google Mike wrote:

Quoted text here. Click to load it

No. Leave PHP out of the equation. It'll make your life simpler.

Regards the remainder of your questions - stop being so cheap. The USB
webcams that sit on top of your monitor have a very short focus. You're
also going to have problems with long USB cables. I can recommend Axis web
cameras which have 'proper' lenses, an embedded (Linux) controller and an
ethernet connector. They also come with the software to support multiple
simultaeneous connections at different resolutions and good support. And
they're not all *that* expensive (basic one is around $500).



Re: Processing Video with PHP

All of you have had some good advice about PHP and video. I guess I'll
shell out of PHP and use other opensource command line tools written in
C/C++ to do my bidding, then use PHP and web-browser plugins to harness
this and display it back.

Many of you have said that USB video is not the option, even with
inexpensive cable extenders that can give you distances of 140 feet
using CAT5 or CAT6:

....because USB video has been mostly for shorter focus, closer range
stuff. (If you don't click the link -- just note that someone has
inexpensively figured out how to eliminate the short distance problem
of USB cables with a couple non-powered jacks that don't cost much.)

The problems I have with cameras that create MPEG4 data and send it
over ordinary CAT5 Ethernet are that there are fewer drivers for Linux
and the cameras cost way more than USB cams.

So I'm going to see if I can stick with USB cams so that I get better
drivers and a lower cost. The only thing I need to figure out is how to
get good quality for the right video range and at the right dollar --
hopefully $250 or less per camera.

Another advantage with the USB cams is that I can bring them all
together on a single PC with multiple USB ports. With the non-USB
solution, you have to purchase expensive cards or an expensive

So, here's what I'd like to see eventually:

* I prove that the USB video works to at least 100 feet using the
non-powered USB cable extender jacks and CAT6.

* I find a USB camera under $250 that gets a decent focal range.

* I prove that I can bring it all back and read it using command line
Linux tools into files and display it back again through a web page.

* I wrap this with PHP and open source the project so that many people
can cheaply build this at home and make a TON of money. That way, I get
to benefit by open source suggestions, tweaks, and free developers who
want to enhance my work, and I'm not at risk of competition because I'm
in a part of the USA where no one really knows Linux but people are
willing to spend $10 to $15K on video surveillance.

* I turn around and make money selling this as a packaged solution to
other startups, as well as resell the hardware, just like what the
original guys on the Asterisk project are doing.

Site Timeline