Blog Just another tech site


ZoneMinder + Foscam FI8918W. WAR Corrupt JPEG data: extraneous bytes before marker 0xd9

Foscam Extranenous bytes before marker error.

From my experiences the Foscam FI8918W does seem like a very solid, capable remote PTZ IP camera. The issues with it arose once it was linked in to a ZoneMinder system. It seemed for every frame that ZoneMinder received / analysed from the Foscam camera, it would produce an error message in the system log, quickly giving me thousands of entries all repeating the same exact warning.

zmc_m1[14935]: WAR [Corrupt JPEG data: 1 extraneous bytes before marker 0xd9]

After a quick search online I have found that it is a commonly occuring issue with many users online, all with ZoneMinder and the Foscam cameras. It seems that 'libjpeg' that is utilized for processing by ZoneMinder believes that the frames received are errorness / the structure is wrong and warns about it. It is only a warning and should not affect the actual workings of ZoneMinder. A thread about it on the Foscam forum can be found for information:

It seems the way most people have dealth with the issue is to totally block ZoneMinder logs, or to custom script to remove the mountainous error messages. Dennis Matveyev suggested a different method, where by modifying libjpeg to stop creating the warning messages in the source code and recompiling, effectively stopping the warning from ever being produced. His information is linked below, but is not ZoneMinder specific.

I thought I would give this method a go, as I did not simply want to block ZoneMinder from generating log messages, as this would be detrimental for debugging at later times. Stopping this warning message should be fine, as this computer is only used for ZoneMinder and as it states, its only a warning, it should not stop any functions. I first removed the associated libjpeg installations through apt-get, as a warning this will also remove ZoneMinder as it is dependent. This will delete all your monitors and settings! A work around would be to just force the removal of the one package. The following command should remove the package although depending on the revision it may have a different name:

sudo apt-get remove libjpeg8

It is then time to download the source for libjpeg, which can be found below:

Extract the files after the download. Before configuring or making the installation, the line which is creating the errornous warning needs to be commented out (or removed if you are a person who likes to live of the edge). The file for modification is jdmarker.c which needs the following line commented out:

WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);


Once that line is commented out, the usual ./configure / make / make install can be processed to install the library again. The next obvious step would be to install ZoneMinder again, unfortunately I found when the command apt-get install Zoneminder is processed, it wants to install libjpeg again, even though we just installed it, I still don't know many things about linux so I am not sure why. Luckily there is an easy way around this, forcing apt-get to download Zoneminder and then force the installation without worrying about the dependency with the following two commands:

apt-get download zoneminder
dpkg --force-all -i /var/cache/apt/archives/zoneminder_1.25.0-1_i386.deb  (Depending on where apt-get downloads the file).

If all has gone to plan, you should now have a warning free ZoneMinder log when using Foscam cameras. It seems to have been working hassel free for a while now for myself.

Filed under: ZoneMinder 8 Comments

ZoneMinder: Can’t symlink to Monitor- : Permission Denied.

ZoneMinder Permission Error

Can't symlink '1' to 'Monitor-1': Permission denied has been one of the easiest errors fix while setting up several ZoneMinder installations I have found. It seems ZoneMinders' user that it is running under has the incorrect permissions to the event / image folders. A simple chown will easily fix this issue.

The event images and diagnostic files are usually stored under /usr/share/zoneminder/events which is symbolic link to /var/cache/zoneminder/events. Use the following command to change the owner:

chown -R www-data:www-data /var/cache/zoneminder/events

chown -R www-data:www-data/var/cache/zoneminder/images

ZoneMinder under a standard install will run under the same user as apache, which is www-data, setting the owner of the ZoneMinder folders will give full permission to the correct user.

Filed under: ZoneMinder 9 Comments

ZoneMinder does not start automatically.

ZoneMinder on some computers will have an issue where it does not seem to start automatically, this is usually due to ZoneMinder starting before MySQL which it uses as a store, therefore will fail to start without it. This is mentioned in the ZoneMinder FAQ

A simple fix is the sleep the start up of ZoneMinder for a couple of seconds to allow MySQL enough time to boot first. In /etc/init.d/zoneminder add sleep 15 before zmfix -a will fix the issue. An example screenshot is below.

ZoneMinder init.d file

Filed under: ZoneMinder 2 Comments

Links to Foscam IP Camera Firmware Updates


I have noticed that Foscam seems to force registrations to gain access to the firmware upgrades. This link is to bypass the forced registration.

In the menu bar the latest software, manuals and setup guides can also be accessed. These firmware upgrades can also be used on unbranded Foscam cameras.


ZoneMinder: Shared data size conflict in shared_data for monitor

ZoneMinder shared data size conflict error

I am currently setting up a new ZoneMinder and came across this strange error showing in the syslog and therefore ZoneMinder log on the web interface:

Shared data size conflict in shared_data for monitor Monitor-1, expected 328, got 316.

I traced this error back to /usr/share/perl5/ZoneMinder/ with the cause sourcing at line 130 in the perl script.

To hopefully fix this issue, change the line at 130 from

our $arch = int(3.2*length(~0));

To the following (It's advisable to comment out the old line and leave it there).

our $arch = 32;

ZoneMinder Share Memory Fix

I am not sure if this is the best fix, but it does seem to cease the error in ZoneMinder. I believe is due to the script incorrectly identifying the computers architecture between 32 and 64-bit.

Filed under: ZoneMinder 20 Comments

localhost/zm can not be found. Error 404.


After a fresh install of ZoneMinder on a clean Ubuntu 12.04 server install the zoneminder web interface was not found.

The requested URL /zm/ was not found on this server. Error 404.

After a tiny bit of poking around it was a simple case of the ZoneMinder configuration file not being linked / included in the Apache configuration.

The following two steps fix the issue:

  1. sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
  2. sudo /etc/init.d/apache2 force-reload
Filed under: ZoneMinder 12 Comments

ZoneMinder – First Configuration

Recently I got motivated to investigate security systems, more importantly video security. I had always planned since moving in to a new house to use a webcam at the front door, connected to a htpc in the living room.

The old setup:

  • A basic webcam
  • A basic HTPC
  • Software: Yawcam

My old set-up would be a good start for most individuals wanting to have a play around with motion detection and video surveillance. I had a few issues with this setup, the webcam is hard to mount in above doors, as typically they have no mounting points. Yawcam also seemed to have a high CPU load when in motion detection, basically using about half of the CPU on a basic htpc which made multitasking too much for the low powered computer. My last issue with this which is not technical, was that I barely used my media room, so it was a waste of power just to have it running 24/7 for motion detection, so the computer was powered off most of the time and in fact haven't had it turned on in over several month now.

The new setup:

  • HP Compaq dc7800 Small Form Factor Link
  • Linksys / Cisco WVC54GCA IP Camera Link
  • Panasonic KX-HCM10 Controllable IP Camera Link
  •  2 x Logitech C510 HD Webcam Link

HP Compaq DC7800

This is a little old office workhorse that I picked up for free, which is still going strong after over 4 years. I have made a few hardware changes since I received the unit. Firstly I boosted the RAM with two new sticks from 2Gig to 4 Gig (The unit probably could have been optioned up when originally ordered from HP), I thought since I had the sticks laying around it could only help the old computer perform a slight bit better. I also threw a 30 Gig Kingston SSD in as the system drive and a 2tb Western Digital Green in as the data drive. This computer now stays on 24/7 acting as the surveillance system and a server for many different services. It is running Ubuntu Desktop 12.04 LTS, which seems to suit this not so modern hardware quite well.

Linksys WVC54GCA IP Camera


Linksys Interface

I have had this camera for a long while now and have been fairly pleased with it as a basic IP camera. It provides enough functions to keep me happy for using it as a basic monitoring camera. I have had many issues with its usability over wireless. I found it to have a very weak signal strength over 802.11b/g which caused it to constantly disconnect and usually become totally unresponsive after 6-32 hours, a problem with the software I believe. There is a new 802.11n model available, but I will be sticking with a wired connection for now as I find it much more reliable.

There is an on board function to reboot the camera periodically to keep it working more reliably over wireless. This can be set up as a cron job and I found running it every 6 hours or so seemed to work well.

0 */6 * * * wget -o - 'http://<USER>:<PASS>@<ADDRESS>/adm/reboot.cgi'

I have found one option to be missing in the settings pages, I can't see any way to flip the image upside down for viewing directly from the camera, but this is not a big issue, as ZoneMinder handles this very well when the camera is in a upside down position. The Linksys does have options for mobile streaming and audio, although these are functions I don't have a use for. There is also on board motion detection included on the on board software, which I have used in the past, but found to be very unreliable giving off false positives constantly, luckily I found ZoneMinder to handle this.

There are two undocumented ways to get streams from the Linksys camera as followed, personally I use the MJPEG stream. RSTP streams for mobile streams are also available, but I have never used this function as mobile streaming is handled through ZoneMinder now.

MJPEG - http://<USER>:<PASS>@<ADDRESS>/img/mjpeg.jpg

JPEG - http://<USER>:<PASS>@<ADDRESS>/img/snapshot.cgi?size=3  (3 - The higest resolution - 640×480)

This IP Camera is my favoured camera that I have at the moment for ZoneMinder, I have found it has average quality in daylight and low light areas and also the default motion detection in ZoneMinder works wonders with it.

Basic Configuration

Image Settings

Admin Settings

User Settings


Motion Detection Settings

Camera Status

Panasonic KX-HCM10

Panasonic Remote Control IP Camera

This is a very recent addition to my collection and I pleased with it so far. Having the ability to rotate the camera does seem wonderful, but I have not actually used this much. Unlike the Linksys IP Camera it is strictly wired and has never shown any unreliable traits. Being a fairly old camera, it does provide just the basic functions, but luckily for my use I only really require a usable output for ZoneMinder.

An interesting function is the pre-set view angles, which can be changed via a cron job.

0 5 * * * wget '' | /dev/null

I use this to change the view according to the time of day, as shadows and sunlight in some areas can affect the motion detection. This could be used to focus on a certain area during business hours and a different area during other hours.

Panasonic IP Camera Console

ZoneMinders' wiki has a great page outlining how to establish a connection to the Panasonic range of cameras.

One thing I have noted from that page is to limit the framerate from the camera itself instead of ZoneMinder, I have found this very useful as it keeps the processer load minimal. Changing the framerate can be limited in the url connection string "&Framerate=10". The presets for Panasonic cameras within ZoneMinder is the best and easiest configuration method for the Panasonic Cameras.

 Logitech C510 HD Webcams

These are inexpensive basic webcams available at any computer store, although I do believe there is a newer version available now. I use two of these in my setup connected directly in to the HP computer. Unfortunately the HD resolution does not seem supported by the generic driver available on Ubuntu and instead push out a max resolution of 640 x 480 which works fine and helps keep the load of the process down on the server. The location of this machine is inconvenient for local USB webcams, therefore I use a Aten USB 2.0 Extender Cable to extend the reach, which seems to work very well and does not affect the webcam signal at all.


ZoneMinder is basically an all in one monitoring system, which can handle many input types and create an easy to use (not easy to setup though!) monitoring system. I've found on my old Dual Core HP it can easily handle 4 input sources, running at 10 fps while only using around 50% cpu, which is very good for a motion detection system on an old pc.

From the ZoneMinder website:

ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child, family member or home monitoring and other domestic care scenarios such as nanny cam installations. It supports capture, analysis, recording, and monitoring of video data coming from one or more video or network cameras attached to a Linux system. ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom cameras using a variety of protocols. It is suitable for use as a DIY home video security system and for commercial or professional video security and surveillance. It can also be integrated into a home automation system via X.10 or other protocols. If you're looking for a low cost CCTV system or a more flexible alternative to cheap DVR systems then why not give ZoneMinder a try?

Traditionally ZoneMinder has been hassle to install and setup. Luckily this has been improved and was a breeze setting up on Ubuntu, just using apt-get to install and retrieve all dependencies automatically. Configuration can still be challenging, in my experience ZoneMinder documentation can be very hard to follow and the software itself can throw off undocumented errors.

Once ZoneMinder is installed it can be accessed through a web browser, personally I have found Chrome and Internet explorer throw off errors and can't handle the pages well. Firefox is my go to browser for ZoneMinder as it displays everything correctly. ZoneMinder can be found at:


ZoneMinder Console

I won't run through all of the basic steps to add monitors, but I will mention a few important things. Modect is the motion detection mode, which all my cameras are running on and the default motion settings in the zone settings can be brilliant with some cameras and fickle with others. Most of my cameras run on "Best - High", which seems to work ok, but I still have to fine tune this, as sunlight and shadows are still causing issues, I will probably post an update once I have all of them fine tuned.

FTP upload is great feature, which allows my motion captured frames to be uploaded to a remote location, in case something happens the the computer running zone minder. In the general settings uploads from filters needs to be allowed. Filters can be run in the background and I have set every event with the cause is 'motion' to trigger an upload. Filters can also be handy to automatically delete 'signal' events caused by IP cameras becoming unreachable, which was common when my Linksys was operating on wireless.

The Panasonic camera mentioned above can be controlled within Zoneminder which really does make it the only interface I ever need to access. Controlling needs to be enabled globally within ZoneMinder and if the Panasonic preset is used when setting up the monitor, it should allow control, all that is needed is the IP/Hostname of the camera within the control tab. It is all working wonders now.


I have been using ZoneMinder for probably a month now and it is very stable, I have had no reliability issues. Detected motion events can be viewed through the events list or through the timeline, all pretty straightforward and easy to use.

Event Viewer

Timeline View

A montage of all of the cameras is very handy, to quickly see what the current situation is. It seems to work quite well with different sized resolution cameras and gives brief details such as frame-rate and alarm status. Below is a screenshot at night time, which is why not much can be seen at all, as none of the cameras are IR.

Montage + Control

Conclusions (For now)

So far it seems that ZoneMinder is a complete and bullet proof system, with many great features, in a fairly easy to use and maintain system. The motion detection settings can be annoying to fine tune, but seems to work quite well with minimal load on the computer. I will finish fine tuning my settings and hopefully give an update and also update with the new cameras I will be receiving shortly.

Filed under: ZoneMinder 2 Comments