Raspberry Pi Security Camera – A few changes.

FFEZZEMHOHYIK93.LARGEI recently built a rather cool security camera using a Raspberry Pi after finding a very detailed, easy to follow intructable.

After having the unit on test for a few day I reviewed the video created by the camera and noticed they were all very jumpy. Even though I had selected a 3 Frame Per Second (fps) recording rate, the output files were all captured at around 1 fps.

I thought I would improve on this and tried many different parameters until I found what I think is a good compromise between video size and frame rate. My new output may be it a little smaller than I would have liked, but I think the increase in frame rate is worth trading a few pixels for.

GPU changes

The first change I made was to the amount of memory used by the GPU. This was set by default at 128Mb. Using the command sudo raspi-config to change this value to 256Mb, this improved the frame rate a little but the output video was still very choppy.

Video Size Changes

Next I tried editing the motion detection software configuration file using sudo nano /etc/motion.conf and made some changes to the output resolution. I found the best all round results were obtained using a frame that is 512 wide by 288 tall (it is important to note that these figures need to be multiples of 16), and a frame rat of between 4 and 10 fps.

Threshold Changes

While we are in the config file, it is also worth changing the threshold that defines the number of pixels that need to change before recording starts, the default value was 1500, which is around 0.2% of a 1280 X 720 (hd) frame. As my frame size was reduced I decided to keep the same percentage of pixels so used a value of 300. This should keep the sensitivity the same as for a full HD video.

I than saved my changes and used the command sudo service motion reload to apply the changes I had made to the configuration file without the need to restart my Raspberry Pi.

The following video was taken at 512 X 288 @ 4fps…


The following video was taken at 512 X 288 @ 10fps


I think this demonstrates that the Raspberry Pi can be used to make a serviceable surveillance camera, but, I do not think it is capable of recording full HD video, The camera module may be capable of shooting HD, but the Pi is not able to capture the data quick enough leading to slow frame rate video files.

A little about my set up

I am using the Pi NoIr camera with a 12V IR LED ring, both the Pi and the LED ring are powered from a 12V 3A supply. The 5V rail for the Pi is achieved by splicing a 12V car cigarette lighter to USB adaptor into the supply cable and then powering the Pi using a USB to Micro USB Lead. I have had some good results using this method, low  and zero light recordings are very good, unfortunately, I do not have any that are worth sharing at the moment, but once I do I will post them here.


I am really pleased with the “no light” video output from the camera, the short video below shows the cats play fighting in the dark.

The following video was taken in the dark at 512 X 288 @ 10fps

Leave a Reply