Hi guys
I am using motion software on the pi to monitor video in a room.
I am having some problems. whenever the raspberry pi camera board detects motion, the red light on the camera board flashes, and the video feed on the browser tries to refresh, but it says cant load page. The again, i have to refresh the page to get it going again. Then, again if the camera senses motion (for ex, a person moves near to it) the browser loses connection. I have to refresh again.
The following is the configuration settings I changed for motion from the default settings.
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




