How to configure motionEye to only capture video if there are movements in particular sections of the surveillance area

Undeniably, Calin Crisan had created one of the best way for us to build a Raspberry Pi security camera. In addition to the ease of setup via motionEyeOS, the motionEye web-based frontend is also easy to use.

Since a Raspberry Pi security camera is used for surveillance, we will want it to record videos of things that happened when we were not looking.

However, recording footages of the surveillance area when there were no motion being detected is wasteful. Moreover, it is hard to get to the video recording of a stranger moving your flower pot when there are too many redundant video clips in your Raspberry Pi security camera.

Even if we switched on motion detection for the entire video frame, there could be motion detected outside of the area of interest. For example, we may be interested in birds resting on our plant rather than birds flying in the sky.

So how do we configure motionEye to only capture video if there are movements in a particular section of the surveillance area?

This post will show you how to do so.

Setting up a Raspberry Pi security camera

In case you are looking for some references on setting up a Raspberry Pi security camera, you can refer to one of the following guides:

Unless you want to run some other applications on your Raspberry Pi, it is recommended to setup your security camera with motionEyeOS.

Steps to create mask on motionEye to ignore motion detection on certain parts of the camera view

The following is a view from my Raspberry Pi Zero W security camera equipped with a Fisheye lens:

motionEye 0.39.2 sample camera footage

This view was shown after I had logged in as the admin user.

In the top area of the footage, there is a road that is relatively busy. In this situation, I would not want my Raspberry Pi Zero W security camera to record a video every time a vehicle passes my building. In addition, I do not want video footages of my window grill shaking while I am cleaning it.

Therefore, I applied a mask over the top and bottom areas of the camera view.

Firstly, I clicked on the icon at the top left corner.

After the settings panel appears, I scrolled to the Motion Detection section, clicked on the arrow to show the Motion Detection settings.

Next, I turned on Mask and choose Editable as the Masking Type.

motionEye 0.39.2 with Motion Detection settings collapsed

After that, I clicked on Edit Mask and grids appeared on the camera view.

motionEye 0.39.2 view after clicking the Edit Mask button

I then hid the settings panel by clicking on the top left icon again so that I could display the camera view in its entirety.

I then clicked on all the grids that I wanted to have motion detection disabled. Alternatively, I can also hold the left-click button of my mouse while dragging the pointer over the areas that I want to mask.

motionEye 0.39.2 view after selecting the areas to mask

After I was satisfied with the mask that I had selected, I clicked on the icon on the top left corner. Once the settings panel appeared, I scrolled back to the Motion Detection section and clicked Save Mask and then Apply.

motionEye 0.39.2 view after saving mask and applying changes

With the mask, my Raspberry Pi Zero W security camera only record videos of people walking past my unit.

About Clivant

Clivant a.k.a Chai Heng enjoys composing software and building systems to serve people. He owns and hopes that whatever he had written and built so far had benefited people. All views expressed belongs to him and are not representative of the company that he works/worked for.