marshalexander99
Posts: 8
Joined: Tue Nov 04, 2014 3:37 pm

Motion too sensitive

Tue Nov 04, 2014 3:42 pm

Hi

I've configured my Pi with raspbian and motion with the camera module to act as a security camera. The only problem I'm having currently is that it is a bit too sensitive and the slightest change in light or movement causes the camera to start recording. The threshold is set to 1500 with a 1280 * 720 image size. I had tried changing the threshold to 92160 (10% of the number of pixels in the image) however this results in hardly any detection at all.

Is there a guide or recommendations on the thresholds for image sizes?

Thanks

hydra3333
Posts: 107
Joined: Thu Jan 10, 2013 11:48 pm

Re: Motion too sensitive

Sun Nov 30, 2014 6:05 am

any news ?
Also, is there a guide to "configured my Pi with raspbian and motion with the camera module to act as a security camera" ?
Thanks

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

Re: Motion too sensitive

Mon Dec 01, 2014 1:32 pm

There are a fair few out on the web. If you want to use the MMAL version of motion that I put out there, try typing this into Google:

Code: Select all

raspberry pi mmal motion tutorial
If you want to use the Video4Linux approach, substitute 'V4L' for 'mmal' in your search terms.

And regarding thresholding - it really depends on your situation; you'll have to experiment. So much comes down to environmental factors, inevitably.

It is worth reading the official Motion Wiki for information on the various settings (http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome). If you use my MMAL motion, make sure you check the settings in the configuration file, as they may differ slightly from those on the official motion Wiki (because of the point in time I forked their source).

Stuff you might want to try could include using a mask image to isolate motion detection to just important parts of the picture; you might also want to set some of the raspicam command line options to influence how the camera adjusts its exposure.

hydra3333
Posts: 107
Joined: Thu Jan 10, 2013 11:48 pm

Re: Motion too sensitive

Tue Dec 02, 2014 12:03 pm

so many help sites, so many without publication dates, so many with different download links ;)
As far as I can tell, as at 2014.12.02 the concensus is along these lines
sudo apt-get install rpi-update
sudo rpi-update
sudo apt-get update
sudo apt-get upgrade
sudo raspi-config
enable the camera
set gpu memory to at least 64Mb
sudo apt-get install motion
cd /tmp
sudo apt-get install -y libjpeg62 libjpeg62-dev libavformat53 libavformat-dev libavcodec53 libavcodec-dev libavutil51 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev
#wget https://www.dropbox.com/s/jw5r1wss32tdi ... opt.tar.gz
wget https://www.dropbox.com/s/xdfcxm5hu71s9 ... mal.tar.gz
tar zxvf motion-mmal.tar.gz
sudo mv motion /usr/bin/motion
sudo mv motion-mmalcam.conf /etc/motion.conf
sudo nano /etc/default/motion
and change the line to:
start_motion_daemon=yes
sudo nano /etc/motion.conf

Note: in the standard motion installation, the motion.conf is in /etc/motion/,
but in the special motion-mmal build from dropbox-url (see above) it's in /etc/.

sudo chmod 664 /etc/motion.conf
sudo chmod 755 /usr/bin/motion
sudo touch /tmp/motion.log
sudo chmod 775 /tmp/motion.log

sudo nano /etc/motion.conf
Make sure that motion is always running as a daemon in the background:
daemon on
We want to store the logfile in /tmp instead
(otherwise autostart user won't be able to acces it in /home/pi/ folder):
logfile /tmp/motion.log
As we want to use a high quality surveillance video, we've set the resolution to 1280x720:
width 1280
height 720
We don't need real-time video, 2 pictures per second are totally ok for our needs:
framerate 2
This is a very handy feature of the motion software:
record some (2 in our configuration) frames before and after the motion in the image was detected:
pre_capture 2
post_capture 2
We don't want endless movies.
Instead, we want to have max. 10 minutes slices of the motion videos.
This config option was renamed from max_movie_time to max_mpeg_time in motion.
If you use the motion-mmal build, this one will work.
If you get an error 'Unknown config option "max_mpeg_time"' either
change this one to max_movie_time
or make sure to really use the motion-mmal build as shown above.
max_mpeg_time 600
As some media players like VLC are unable to play the recorded movies,
we've changed the codec to msmpeg4.
Then, the movies play correctly in all players:
ffmpeg_video_codec msmpeg4
Enable access to the live stream from anywhere.
Otherwise only localhost (= the Raspberry device) would be allowed to access the live stream:
stream_localhost off
If you want to protect the live stream with a username and password, you should enable this:
stream_auth_method 2
stream_authentication SOMEUSERNAME:SOMEPASSWORD
other settings= see : http://www.raspberrypi.org/forums/viewt ... 0&p=546758
Is that right ?
Last edited by hydra3333 on Tue Dec 09, 2014 11:48 am, edited 2 times in total.

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

Re: Motion too sensitive

Thu Dec 04, 2014 1:50 pm

Generally that's right - if what that sets up matches your requirements in terms of image size, frame rate, length of movie, etc. Or if you just want to give motion a go on your Pi.

Best way is to dive in and try stuff, dig around on the web for info when you want to change it or something doesn't work and you want to understand why. As mentioned before, the motion Wiki is a good source of reference.

hydra3333
Posts: 107
Joined: Thu Jan 10, 2013 11:48 pm

Re: Motion too sensitive

Sat Dec 06, 2014 11:39 am

Just a final query
is this

Code: Select all

#https://www.dropbox.com/s/jw5r1wss32tdibb/motion-mmal-opt.tar.gz
https://www.dropbox.com/s/xdfcxm5hu71s97d/motion-mmal.tar.gz
the latest build ?

Edit:
thanks dozencrows. just to have a record of the source in the same post, https://github.com/dozencrows/motion/tree/mmal-test
Last edited by hydra3333 on Tue Dec 09, 2014 11:49 am, edited 3 times in total.

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

Re: Motion too sensitive

Sat Dec 06, 2014 2:53 pm

Yes,

hydra3333
Posts: 107
Joined: Thu Jan 10, 2013 11:48 pm

Re: Motion too sensitive

Wed Dec 31, 2014 4:43 am

update: the GIT now points to a newer build.

Return to “Camera board”