Building a Security Camera System, by S.S.

I have been working for several years on building a security camera system. I have finally found a camera that I really like. Previously, I had tried a number of things that did not work very well:

  • Old-fashioned NTSC cameras with coax to a PCI video card resulted in terrible video quality, no matter how much money was spent.
  • Webcams of various types offered pretty good video quality but were limited by the length of the USB cable.
  • The Toshiba IK-WB02A IP network camera were too much money for not very good quality imaging. I bought several of these at about $100 to $150 and liked them at first, but in the end, the 640×480 resolution was just not good enough.
  • The Panasonic WV-SP305 1.3MP IP network camera had decent video quality, but the price was around $400. The camera I have was purchased by my office as an evaluation item and then turned over to me when the decision was made to go with similar resolution Axis M1113 cameras at about $450 each. The price for both of these is more than I could really afford in setting up something at my house.

So, while I am not in the security system business, I have spent a considerable amount of time and money studying the subject. What had really puzzled me was the differential between the ordinary consumer photo cameras, which had low prices and good quality, versus the security world, where low quality and high prices were the rule. I reasoned that since these were much the same inside, eventually someone would repackage the parts into what I wanted. So I kept looking on eBay for an inexpensive camera with good quality.

AOTE Camera from China

Six months ago, I found a seller on eBay who was offering 5MP cameras for around $150. There was no information about this AOTE brand anywhere on the Internet, but still the package was tempting and I ordered one. It arrived in about 15 days from China and was well packaged.

Below is the eBay link to one of the cameras. There are lots of different models. These mostly differ in the housing and how many LED lights are attached. The cameras inside are comprised of a small stack of 1.5 inch square circuit boards that actually take up very little room in the housing. By adding another layer to the board stack, you can get additional features, such as Power over Ethernet (POE) option. Alternatively, you can get different CCD sensor options on the front board layer. There are also various lens that can be selected.

The following link is for one version with the camera options that I liked:

The box contained the camera, a CD Rom disk, a power supply, and a sheet of paper with some brief instructions. I do not normally use the Windows operating system. Instead, all of the computers around my house run various flavors of Linux. I used the Linux Wine program to install the supplied software. It ran somewhat but not too well. I dumped the .EXE file using the Strings program and was able to locate some URLs in the code. With this information, I was able to stream video from the camera using the VLC program as the client.

Encouraged, I ordered another and then later another, as money allowed. I now own three of these cameras.


I was able to puzzle out the Open Network Video Interface Forum (ONVIF) specifications and use this application programming interface (API). The ONVIF protocol was developed by a number of the leading security camera companies. As more and more Internet Protocol (IP) cameras were developed, the various models would have divergent features and interfaces. This was troubling to systems integrators who had to combine the various devices into a functioning security system.

So the purpose of the ONVIF specification was to define an interface that could be used to query the camera and have the camera respond with its specifications. ONVIF uses the Extensible Markup Language (XML) syntax in Simple Object Access Protocol (SOAP) format. This can seem on the surface to be a little intimidating, but in the end I was able to invoke the API from the command line using the CURL program. So, for example, here is the command to get the device profiles by sending the contents of a pre-written file with the SOAP XML as the contents.

$ cat getProfiles.xml <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="" xmlns:trt=""> <soap:Body> <trt:GetProfiles/> </soap:Body> </soap:Envelope> $ curl --data @getProfiles.xml |xmllint --pretty 1 - ... Lots of XML output ...

It looks a little complicated, but it’s not too bad as compared to some things, like say gardening or animal husbandry, for instance.

In the end, what I discovered is that to access the camera, you had to first invoke this GetProfiles function. This returned a profile name.

Then using the profile name, it was possible to use the GetStreamURI and GetSnapshotURI functions to obtain the URLs at which the camera would respond with either a Real Time Streaming Protocol (RTSP) video stream or a JPEG image snapshot. These are as follows:

rtsp:// rtsp://

The other key piece of information was the size of the image. This was found in the profile information and was as follows:

<tt:Bounds height="1920" width="2592" y="0" x="0"/>

This is a BIG image.

Image Quality

As far a image quality goes, it is pretty good. There is a little jitter and noise when streaming h.264 video, but this may just be inherent in the compression process. Due to the large amount of data being sent around for video, it may overwhelm some networks. Ethernet switches and routers will drop packets if overloaded.

The way h264 video works is that it will send a full video frame called the I-Frame. Then, for a period of time, there will only be sent incremental changes. If you drop an I-Frame, this is bad and causes a blank screen for a while until the next I-Frame. Is this the fault of the camera? Not really. It is just the way h264 video works. You just need to be aware of this possibility and make sure that your network design is sufficient for the amount of data. There is also a noticeable lag due to the time requirement associated with video compression.

The JPEG still-frame images are excellent. The quality is about what you would get in a typical photo camera, and it turns out that the recording and motion detection software I use only needs single JPEG frames.

The night vision capability is also quite good. As you transition from day to night, the camera will automatically adjust. Be aware that while the image will be in color during the day, at night there is not enough light. The camera will compensate and only produce a black-and-white image. The built-in LED light sources help. They do produce some heat, and I have noticed little heat vortex distortions when streaming. These give the appearance of little bugs flying around the camera. If night vision is a prime consideration, then it might be good to purchase independent light sources and mount them away from the camera to isolate the heat.

By doing illumination, you are not being stealthy. The cameras themselves have a noticeable, visible to the naked eye, dull red glow from the LEDs. The generated light would certainly be visible to someone with the proper equipment, such as a night vision scope. Since I am in a city/suburban environment, the location of my house is no secret. I just count this effect towards deterrence.

By the way, during this several month educational exercise, I did have to run the manufacturer-supplied Windows program in a Windows 7 environment. It was the only way I could figure out, at the time, to get network settings right and to configure the camera for 5MP. For the longest time, the camera was at the default resolution of 1080p, and I thought it looked great and then noticed that I was an idiot and needed to bump up the resolution to the maximum. It looks even better now.

One reason I still use Windows for configuring the cameras is that after running WireShark and examining the message traffic, I discovered that a separate, undocumented protocol was being used to port 8091 for camera configuration. These messages are XML, and I was able to see what was being done, but by the time I had done this, the cameras were configured, and I went on to the problem of how to do recording. Just do not waste any time in the ONVIF specs studying the ONVIF commands related to configuration. It appears that in this case, these commands are not used. The Windows program issues no ONVIF messages.

Recording Video and Detecting Motion Events

For doing recording and motion detection, I like the Linux package entitled Motion.

I had started out using the ZoneMinder package but found that it did not reliably detect motion events. Lots of people like ZoneMinder. I could never get the settings adjusted right.

With Motion, the initial configuration looks a little more complicated, but, for me, the results were better in the end. Motion just grabs JPEG frames, and you end up with a directory with files. Very simple.

When motion is detected, Motion will create a movie from the video frames. You can choose the movie format. I like mpeg4 (avi).

Here is the Motion config file for one of the cameras with all the junk stripped out.

netcam_url width 2048 height 1536 text_left Backdoor target_dir /ramdisk/motion/garage webcam_port 0 on_picture_save /usr/local/motion-extras/ on_movie_end /usr/local/motion-extras/

Wiring and POE

Anyway, I have Motion running, and I am now working on stringing Ethernet cables through the attic and crawl spaces. The cameras I ordered have the POE feature. This means that you do not have to run two sets of cables for both signal and power. This in my mind is a great convenience. I luckily had a POE switch that would supply the required power.

It is also possible to use power injectors that go in-line on the Ethernet cable. You need to be a little careful using power injectors to not connect power to devices that do not expect it. Smoke may result.

You do know that all electronics run on smoke? If you let the smoke out, they stop working. (Engineer joke. ha ha)

The nice thing about the POE switches is that they implement the full POE protocol, which will ask the device first if it wants power and only turn on the power if the device responds.

So far, no smoke for me.

Network Security

A word or two about network security. It is, in general, a bad idea to have little computers on the inside of your network when you can not be sure of the functioning of these devices.

Cameras are in fact, little computers.

In the process of examining these devices, I noticed that by default, they would send a User Datagram Protocol (UDP) handshake every second or so to an IP address in China.

Whether this was some setting that I did not turn off correctly (there are a lot of features in the configuration) or if perhaps this might be something more sinister, it must be considered that computers with unrestricted access to the outside world are a security risk.

One answer might be to subnet and to isolate the IP cameras with a firewall. The firewall could then block the traffic.

However, in my case, I was able to think of something simpler. My server has two Ethernet ports.

What I am doing is to put the cameras on the second port and then make sure that port forwarding in the server is turned off. In this way, the server can access the cameras and also receive their responses, but the cameras have no path to the outside or even to the other computers on my network.

If the bandwidth of the Ethernet were to become a problem, I could install a multi-port Ethernet card and isolate the cameras, so that there would only be one camera per cable.

Motivations and Benefits

Hopefully, the hints supplied above are enough to get you started. These represent the conclusions I have reached, after making a number of false starts and mistakes. Of course, as I play with these things, I will probably learn additional things. Still, it seemed important to communicate a little of this information right now.

Affordable cameras like this are something new and are kind of a game-changing technology. I have read some recent posts talking about how to stay warm on cold nights in a perimeter listening post. Imagine instead that you install a bunch of cameras and watch the perimeter from the sofa inside the warm house and have a loud alarm go off to wake you up if motion is detected. Ha ha.

Others are worried about the trend in America for more police. The justification for more police is tied to a reaction to fear. Fear comes from a lack of knowledge. Cameras provide a record of past events and, thus, increase knowledge. More knowledge means less fear and less need for police.

If something goes missing, see who took it and solve the problem immediately. In just about all of the cases where I have lost stuff over the years, it has been some drug-using member of the family, extended family, or one of their friends. The problem has always been that you could not exactly say who took the stuff. A camera recording would solve this uncertainty problem.

Another thing that would make sense is for neighbors to pool their cameras. By interconnecting the cameras, you would have a much greater coverage area with more angles of vision.

More importantly, the recording function would be distributed and there would be no single point that an attacker could hit to destroy the evidence.

It would be very hard to collect all of the copies of a recording, and the attacker could never be sure that they had gotten all of them. That little detail would be a powerful deterrence factor.

The idea of a security system is an easy one for people to grasp. It should be relatively easy to sell this idea to friends and neighbors and perhaps get them working together on the common security.


To conclude, here is a funny story about security. Last week, this guy and his girlfriend show up asking to buy an old trailer that was sitting in my yard. He is the derelict uncle of one of my grandsons. He had lost his job and had no where to stay.

Fine. I’m happy to help. Take the trailer, just tell me where you want it moved. A few days go by and I hear nothing from him. Weird.

Then one morning, one of my daughters, who was keeping some stuff in the trailer went out to get something and heard a noise. She screamed, and two heads popped up from under a blanket. It was this guy and his girlfriend camping out in the trailer in my yard.

What? We all know the end is coming, and the homeless will be advancing upon us. I was just surprised to see it start in my yard…last week.

Needless to say, I, the video guy, got some kidding from my family about how great my wonderful electronics were. I got busy and made some improvements. Things are working much better now, but no security system works if you don’t look at it.

Bookmark the permalink.

Leave a Reply

Your email address will not be published.
Anonymous comments are allowed, but will be moderated.
Note: Please read our discussion guidlelines before commenting.