User avatar
Posts: 211
Joined: Thu Nov 15, 2012 11:03 pm
Location: Derbyshire UK.
Contact: Website


Tue May 14, 2013 7:07 am

Does anybody know if a Pi with pi camera will act as a network camera for Zoneminder ?

There aren't many low cost IP-cams out there. This would be quite an interesting option.

For that matter, will Zoneminder run on the Pi ?

Thanks, J/.
Author of oBeMS open source Building energy Management System.
Automatic Meter Reading (AMR), Building Management System (BMS),
Building Energy Management System (BEMS), Infrastructure Control System (ICS).

Posts: 9
Joined: Wed Feb 15, 2012 11:50 am

Re: Zoneminder

Tue May 14, 2013 10:51 am

I don't know about Zoneminder but Motion works just fine on Rpi (using USB-webcam).
I have the impression that the camera module is not quite as simple to use with these programs as USB-cameras are. I.e. camera module cannot be defined in configuration files same way as USB-devices can.
Not sure if it's possible yet to create a stream that can be used as a source for Motion/Zoneminder.

User avatar
Posts: 242
Joined: Mon Nov 07, 2011 8:46 pm

Re: Zoneminder

Wed May 15, 2013 12:17 am

No reason it shouldn't work... I've run Zoneminder on a first gen Plug Computer (Sheevaplug) which wasn't as powerful as the RPi...

Posts: 3
Joined: Thu Feb 21, 2013 4:27 pm

Re: Zoneminder

Fri Jun 21, 2013 1:34 pm

Any othe ranwsers ?
I join to John for asking if the Camera module of Pi is working with motion, not any usb webcam, the camera pi (not connected on USB so)

Posts: 2
Joined: Sun Jun 23, 2013 12:11 am

Re: Zoneminder

Sun Jun 23, 2013 12:29 am

John, I am also interested in using rpi as a camera for zoneminder. I just start looking into that and I am pretty sure it would not be very difficult to get it working. With the software for the camera one always can capture stills and then those just need to be delivered to the zoneminder. Without knowing enough about following I believe that zoneminder will be able to read those pictures over web interface. That should not be difficult to achieve either using something like apache or another lighter web server. In other words we just need to turn the rpi into IP camera. Again very confident it's achievable quite easily. ;)

I will post any success or issues I have working on that. Would also love to hear from others who may be working on similar projects such as turning rpi into IP cam.

User avatar
Posts: 81
Joined: Fri Dec 23, 2011 5:44 am
Location: San Francisco

Re: Zoneminder

Sun Jun 23, 2013 5:44 pm

Everyone please; the "no reason shouldn't work" is the kind of answers that give the tech community bad taste...

Of course at the moment the answer is NO; it WILL NOT work. Let's review the 2 Zone Minder scenarios:

John's original question was whether it would work as network camera for ZM. For any real streaming (not piping via net cat) we need V4L which is currently not in existence. I am too anxiously awaiting for the V4L kernel driver to be released so that I can integrate the camera module with my own ZM install as a network camera; most commonly using mjpg streamer as the "network camera" piece of the puzzle.

Using the camera as a local device to the ZM install; meaning the ZM is running on the Pi which is physically connected to camera module. Still NO go since ZM requires to see the camera as /dev/videoXX and that is too a function of the V4L driver.

Be that as it may; if anyone out there has managed to make the camera module show up as normal /dev/videoXX device TODAY please speak up - that will open the door for everything cool which currently doesn't work with the camera module!

The module has far superior image sensor quality compared to the cheapo USB web cams out there, most of which (the sub-$50) can't come close to the Pi's camera frame rate. The day when this cam shows up as /dev/video0 is the day they should raise the price of the module :)

Posts: 2827
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Zoneminder

Mon Jun 24, 2013 11:07 am

ds18s20 wrote:Everyone please; the "no reason shouldn't work" is the kind of answers that give the tech community bad taste...
We're a "can-do" community round here ;)

NO go since ZM requires to see the camera as /dev/videoXX and that is too a function of the V4L driver.
ZoneMinder can use IP cameras as an input source and its possible to make the RPi cam appear to ZM as an internal IP cam: ... 43&t=43844
if anyone out there has managed to make the camera module show up as normal /dev/videoXX device TODAY please speak up - that will open the door for everything cool which currently doesn't work with the camera module!
It's not a trivial matter of "making it show up" - a V4L driver needs to be written for that, and that's a large amount of coding work.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Posts: 40
Joined: Tue Jun 04, 2013 6:22 am

Re: Zoneminder

Mon Jun 24, 2013 11:39 am

that aside, I believe ZM is more cpu-intensive than motion...
motion already has difficulties to run on a rpi...
I can run motion at higher resolutions (1024x768) only without creating any videos with ffmpeg and only storing jpegs of the motion.
So I guess at moderate resolutions, ZM should work without video encoding (unless it will be hw-accelerated at some point I guess), I know motion does.

It can however definitely be used as a pure network/ip camera with mjpg-streamer

User avatar
Posts: 172
Joined: Sat Aug 04, 2012 6:02 pm

Re: Zoneminder

Mon Jun 24, 2013 1:12 pm

If it is of any interest, I have a working version of motion with source modified to read from the Pi camera - the details are in this thread here: ... 06#p356706

Source is on GitHub:

Slightly old prebuilt binary is on Dropbox: ... mal.tar.gz

Good reply summarising how to get set up: ... 90#p374790

Posts: 2
Joined: Sun Jun 23, 2013 12:11 am

Re: Zoneminder

Tue Jun 25, 2013 2:02 am

Here is some progress I made on using Raspberry Pi camera as an IP camera for Zoneminder. I decided to try mjpg-streamer ( You can also check this blog ... ream-cctv/ on very similar topic but utilizing USB camera, thanks phillips321.

Here are the steps of what I did:

1. Get the source code for the mjpg-streamer and build it. I did that on the rpi itself in the home folder (/home/pi). Feel free to use any place you find appropriate for your experiments

Code: Select all

svn co mjpg-streamer
cd mjpg-streamer/mjpg-streamer
make USE_LIBV4L2=false clean all
sudo make DESTDIR=/usr install
NOTE: the subversion (svn) is not installed by default in raspbian, so if you did not installed it already you will need to do:

Code: Select all

sudo apt-get install subversion
or whatever the name of the package is in debian/raspbian. Alternatively you can fetch the code on your host machine and then scp it to raspberry pi. Honestly this is what I did. If you decide to go that route one more word of caution: make sure the rpi clock is properly ntp synced and there is no difference between the time on the host machine and the rpi. Otherwise the copy may get time in the future related to the rpi clock which will cause issues building the code.

2. It is time to start the raspberry pi camera. I use the following command:

Code: Select all

raspistill -w 640 -h 480 -q 80 -e jpg -n -o /tmp/rpi-img.jpg -tl 500 -t 999999999 &
Which takes still pictures every 500ms (two in a second) and store them in the /tmp folder under the file name rpi-img.jpg. I believe for security monitoring more than VGA resolution would be overkill this is why I use 640x480 capture and 2 frames per second I believe are quite enough to capture any bad happenings. ;) That is my opinion, please feel free to play with that command and adjust it to your liking. Just keep in mind that every still is written to the file system (/tmp folder) which, if I am not wrong, appears on raspbian is configured to be on the sd card. Writing to the flash is not the fastest operation, so it very likely will be the bottle neck and if the resolution is higher that will increase the toll. Also the flash memory has relatively low number of writes limit and regardless the all great effort to improve it and implement sophisticated ware-leveling algorithms, still writing too often large file to the SD card would eventually fry it. You were warned!

NOTE: One improvement on that approach would be to use RAM based filing system as destination for the image file. This will definitely mitigate any flash wearing concerns but also will improve the performance. If somebody knows how to create file system in RAM for that purpose please post instructions. I do not plan to look further on that because have different plans (see bottom of this post).

3. Now let's fire up the mjpg-streamer and see how good we are doing:

Code: Select all

mjpg_streamer -b -i " -f /tmp -n rpi-img.jpg -d 200" -o " -w /usr/www -p 8090"
This will start the streamer instructing it to check every 200ms for new image being written to our image file /tmp/rpi-img.jpg and steam it in mjpeg format on port 8090. Again feel free to experiment with that and tweak it to your liking.

4. Let's test the streaming before going to the Zoneminder:

Code: Select all

Type the above into your favorite browser on the host machine and in few seconds you should see on the browser screen what the rpi camera see.

5. Now is time for the ultimate step: configure the Zoneminder to use our Raspberry Pi camera to make us safer. ;) Assuming you have running and properly configured Zoneminder here is how to add the streaming rpi as a monitor:
  • * From the ZM console click "Add New Monitor"
    * Under the "General" tab name your monitor, set "Source Type" to "Remote", then select the function you like.
    * Under the "Source" tab set:
    • - "Remote Protocol" to "HTTP"
      - "Remote Method" to "Simple"
      - "Remote Host Name" to <RPI_IP_ADDRESS>
      - "Remote Host Port" to "8090" (or whatever you used in mjpg_streamer command)
      - "Remote Host Path" to "?action=stream"
      - "Remote Image Colours" to "24 bit colour"
      - "Capture Width" to "640" (or whatever you set in the raspistill command)
      - "Capture Height" to "480" (or whatever you set in the raspistill command)
Save and ... there you go... Our beloved Raspberry Pi is our safety watch dog.

6. Just in case you like to stop the mjpg_streamer and the raspistill processes, on rpi do:

Code: Select all

sudo killall mjpg_streamer
sudo killall raspistill
The described procedure gives us a solution for using rpi as an IP camera and feeding in Zoneminder but is far from ideal. See above note from point 2 for example. Even though the proposed solution for using RAM filing system would help it is still not ideal.

I have plans for the near future to actually develop new input plugin for mjpg_streamer that will directly integrate it with the raspberry pi camera. I believe this approach would bring us quite close to ideal. Of course when the V4L2 driver is available another box of possibilities and solutions will open but until then we can still use whatever is available on the table now and do our best.

Hope that helps somewhat and please post any suggestions and comments.

User avatar
Posts: 321
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website Facebook Twitter

Re: Zoneminder

Tue Jun 25, 2013 5:46 am

That's awesome. I'm going to blog about this at - hopefully some other people will try it and confirm your method. Great work!
Michael Horne - @recantha
Raspberry Pi blog -

Cambridge Raspberry Jam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

Posts: 9
Joined: Fri Sep 07, 2012 7:10 pm

Re: Zoneminder

Sun Aug 25, 2013 8:08 am



$ raspivid -o - -t 9999999 -w 800 -h 600 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8080/}' :demux=h264

the stream works fine and is visible in vlc.

>> I tried to implement this rtsp in ZM but no picture. Is there a general problem why this does not work?

Posts: 1
Joined: Fri Jan 03, 2014 7:13 pm

Re: Zoneminder

Fri Jan 03, 2014 7:26 pm


Thanks your code works great!

Is there away to make the two lines of code start at boot?



Return to “Camera board”