Motion

is a software package able to use cameras to detect motion.

It supports different camera types:
 * Network cameras via RTSP, RTMP and HTTP
 * V4L2 webcams
 * Video capture cards
 * Existing movie files

Once detects motion it can write picture files and/or movie files to a storage location.

Kernel
The linux kernel needs to be configured for V4L in case such cameras are being used.

Emerge
is in portage, emerge it as per normal:

Configuration
After emerging sample configuration files are placed in :

These configuration files are well documented, and can be used for creating the actual configuration files. The actual configuration files do not have "-dist" in their name. Note that simple renaming the files will not yield a working configuration. It may be better to create the configuration files from scratch, taking note of the individual settings needed for camera(s), and desired output options.

The structure of the configuration files is as follows:
 * motion.conf: contains the general and daemon settings
 * camera#.conf contains the settings per camera. Note that if only one camera is used then the camera settings could be added to motion.conf

looks for the configuration files in the following order:
 * in the current directory
 * in
 * in

An example working set of configuration file for two cameras, one laptop webcam and one IP-camera is as follows. General settings:

First camera, a webcam using V4L:

Second camera, an IP camera:

Make sure to any credentials and IP addresses. Please refer to 's documentation for further details for the configuration.

Commandline
can be simply run from the commandline for testing purposes:

Once runs, it provides a webpage at. The webpage will show the live stream of the cameras, and allows for some basic control.

System service
can also run as a system daemon, once satisfied with the configuration: