Posts tagged WVC54GCA

Zoneminder MJPEG and Shared Memory Settings

If you’ve read my big post on the Zoneminder configuration I have at home, you’ll notice that I favored capture of JPEG stills over using MJPEG during initial configuration.

At the time, the reason was simple; I couldn’t make MJPEG work. I’ve now succeed in doing so, and understand why it didn’t work the first time.

Memory Settings

I remembered reading something in the Zoneminder documentation about a shared memory setting resulting in capture at higher resolutions failing. Originally, when I first encountered the problem I decided that it was simply me getting something wrong with the path to the .mjpeg streams on the cameras, since I was more familiar with capture of jpeg stills from prior scripting.

However, I stumbled across some documentation here from another tinkerer, which also pointed to the memory sharing issue.

The problem is that the buffer of frames (usually between 50 and 100 for the camera) must be contained in memory for processing. If the size of the image:

buffer\, size\times image\, width\times image\, height\times3_{for\,24\, bits}+overhead

Exceeds this shared memory maximum, you’ll run into errors or see the camera status go to yellow/orange instead of green. (It can get pretty confusing trying to troubleshoot based on those status colors unless you’re checking the logs… /doh)

In fact, the problem I was seeing was likely directly as a result of the large capture image size of my Axis 207mW, as they cite it directly:

Note that with Megapixel cameras like the Axis 207mw becoming cheaper and more attractive, the above memory settings are not adequate. To get Zoneminder working with a full 1280×1024 resolution camera in full colour, increase 134217728 to, for example, 268424446

/facepalm. I really wish I had come across this the first time around. Either way, you’re going to ultimately run into this problem with either higher framerate connections, color, or higher resolutions.

I followed the tips, here, but doubled them since the machine I’m running ZM has a pretty good chunk of memory available.

The process is simple. You’re going to have to edit /etc/sysctl.conf to include the following somewhere:

# Memory modifications for ZoneMinder (kernel.shmall = 32 MB, kernel.shmmax = 512 MB)
kernel.shmall = 33554432
kernel.shmmax = 536870912

Now, apply the settings with

sysctl -p

Which forces a reload of that file. Next, you can check that the memory parameters have been changed:

brian@brian-desktop:~$ cat /proc/sys/kernel/shmall
33554432
brian@brian-desktop:~$ cat /proc/sys/kernel/shmmax
536870912

Which is successful. You can also check it with ipcs -l. Now, reboot ZoneMinder and you shouldn’t have any problems.

Motion JPEG Time!

Having made these changes, I was ready to finally explore whether MJPEG works! I went ahead and decided to use the MJPEG streams from my two respective types of cameras in place of the static video links. These are:

Linksys WVC54GCA: http://YOURIPADDY/img/video.mjpeg

Axis 207mW: http://YOURIPADDY/axis-cgi/mjpg/video.cgi?resolution=640×480&clock=0&date=0&text=0

I also discovered (by reading the manual) that there’s a handy utility on the Axis config page (under Live Video Config -> HTML Examples -> Motion JPEG) which generates the proper URL based on a handy configuration tool where you can select size, compression, and other options:

Handy config page

The idle load on the system has increased, as expected, but that’s partly from me raising the FPS limit to 10 which seems reasonable, and enabling continual recording with motion detection (mocord).

Nice, 10 FPS! (still a gaping hole though...)

I’m making a lot of tweaks as I get ready to transition everything onto a VM on a faster computer with much more disk space (on the order of 8 TB). If you’re interested in reading more about the Linux kernel shared memory settings, I found some good documentation:

  • IBM/RedHat settings: here
  • Configuring shared memory: here

WVC54GCA Firmware v1.1

Fix Some, Break Others

I noticed a strange but rather interesting problem the other night while working on one of my WVC54GCA cameras which was accidentally reset to defaults. But before I explain, I should back up a bit.

I mentioned in my previous post about ZoneMinder that I had not completely finished reviewing or evaluating the new V1.1 firmware that Linksys made available just recently. I now can, with a bit more certainty.

In the Linksys Release Notes, it states:

Version v1.1.00 build 02, Jun 15, 2008

- Support of Setup Wizard is temporarily disabled to address security issue

- Fix security issues

- Fix Camera stability issues

- Fix VLC multicast playback issues

- Update TZO DDNS client

- Change Firmware version format

- Enable HNAP protocol support

- Fix OCX stability issues

- Update valid value range of RTP Data Port. New range is even value of 1024~65514.

Version v1.00R24, Jan 7, 2008

- Updated TZO DDNS client code to resolve an issue with incorrect TZO server address being used to resolve the customers FQDN.

Now, this all sounds fine and dandy, but I think Linksys has fixed some issues and broken some others at the same time.

Concerned about the security issues (which are supposedly fixed in 1.1), I upgraded both cameras from my previous trusty (but somewhat unstable) V1.0 R24 build. At the time, everything worked. The cameras continued functioning over WiFi, all of my previous settings were preserved, everything seemed fine. However, I noticed that the wireless configuration page shows something a bit odd: “undefined.” Take a look:

Undefined? Nice.

Well, that’s odd. But WiFi worked. For the record, I’m using a Linksys WRT54G-TM running Tomato 1.27 with WPA/WPA2 AES and an alphanumeric key over 20 digits long.

The other night, my roommate inadvertently reset one of the cameras to default running the new V1.1 firmware. When I brought it back over ethernet and configured it to connect to WiFi, I noticed the configuration screen had changed, subtly:

1.00 build 24

1.1.00 build 02

The fields had changed. In addition to making the password field now the proper type (showing only bullets or whatever character your browser uses), there are two drop downs for which WPA version you’re using, as opposed to one. That seems fine, until after about a half hour of trying, I couldn’t make the 1.1 camera connect to my wireless. Arrgh.

Much tinkering, taking the thing apart, making sure the wireless card was seated, e.t.c. later, I tried something else. I remembered how much of a hassle the previous release was and how flashing to some strange German version of the firmware and then back made wireless magically work.

Amazingly, Linksys doesn’t keep a nice repo around (or, at least I couldn’t find one, perhaps there’s an FTP dump somewhere). I found the old 1.00 R24 build here, and for backup’s sake, here‘s a version I’ll host and keep around forever.

I flashed back to 1.00 R24, and immediately was able to connect. In addition, flashing back up to V1.1 after configuring wifi on 1.00 R24 makes everything work just fine. It’s a mess, but that’s the only way I can make it work.

I have a feeling that Linksys hasn’t completely nailed down the configuration settings/supplicant for that Ralink card they have in there, or that the open source drivers just aren’t that great. I strongly suspect this is partly the reason for the introduction of the WVC80N, although reviews do look promising. I’d like to get my hands on one of those!