Raspberry ft and CCTV with Motion !

Want to keep an eye on your pasta cooking ? Monitor your cat where even your girlfriend ? Then I have the solution for you : Motion !

At the outset, after plugging in your webcam usb to your Zhao, Please check if it is well recognized, with the command “lsusb”, must get one of these lines :

Bus 001 Device 004: ID 046d:0825 Logitech, Inc. Webcam C270

It then installs motion :

sudo apt-get install motion

It goes straight in the motion configuration file, where everything goes :

sudo nano /etc/motion/motion.conf

Here are the most important configuration lines :

ATTENTION : In this tuto, I took the liberty to distinguish the side recording (index [SAVE]) images on the pi raspberry and the side STREAMING (index [STREAM]) images on the mini web server provides with motion. So be attentive when the details of a configuration related images is indicated.

  • off daemon

We pass this line to “on” If you want to be able to initiate motion as a daemon, and thus be able to release a terminal. In my case I passed to “off” because like that I can see what is happening live in my terminal.

  • v4l2_palette 6

Is used to configure the type of range you want to use. Each webcam uses a specific palette, Therefore, choosing the right palette in the configuration file. The palette used by default will be the 8 (YU12).

  • width 640height 480

Indicates the height and width of the images recorded and streamed.

  • framerate 50 [SAVE]

This figure shows the number of frames recorded per second. High figure = consumed RAM.

  • threshold 1500 [SAVE]

Number that indicates the number of detected pixels which change to start recording images and/or video.

  • off output_normal

Default line “on”. Just pass it to “off” If we do not wish to use the recording but only the web streaming.

  • quality 75 [SAVE]

Percentage of quality of recorded images.

  • ffmpeg_cap_new off [SAVE]

Default line “on”. Just pass it off if it does not want motion create a video file with all recorded images.

  • ffmpeg_video_codec mpeg4 [SAVE]

Default on line “SWF”. Is used to specify the output video codec for the video file creation. I personally put on mpeg4 in order to obtain a .avi when I activate the registration.

  • target_dir /media/SAVE/Autre/CAM [SAVE]

Specifies the path for recording images and videos. In my case for example, the files are sent on my external hard drive, which allows to record lots of data.

  • webcam_port 8081

The default port for the web server mini.

  • webcam_quality 50 [STREAM]

Percentage of quality streamed images.

  • webcam_maxrate 5 [STREAM]

This figure shows the number of images streamed per second. High figure = consumed RAM.

  • off webcam_localhost

If the parameter is passed to “on”, It allows only local access to the server's stream.

Voilà, Once done, There is more to launch motion :

sudo motion

Don't forget the “sudo”, otherwise motion will launch the default changes to the motion.conf, and so all of your changes will not be taken into account !

Where the palette 8 is not compatible, It shows you a list of compatible palette, you just go change the configuration of the palette in your motion.conf.

If everything is ok, you get something similar to this :

We will therefore on our browser, from an another computer (to take advantage of the off-raspberry fluidity), tape on 192.168.X.X:8081 (the local address of your rasperry) and we are witnessing the magic :

In my case, I have disabled the capture and recording of image files and videos on my hard drive. But if you have enabled, There is more to pass in front of your webcam to see the display of many lines of recordings of images and videos !

Voilà, While motion turns, you find that the resources used by your Raspberry are up, It is for this reason, I advise you to focus on total usage of a raspberry for motion, If like me you are using you to many other services !

You may also like...