Records a videofile when motion is detected via a camera
Clone or download
Permalink
Failed to load latest commit information.
debian commit message Apr 16, 2018
filter-plugins commit message Apr 16, 2018
man commit message Apr 16, 2018
meta-plugins commit message Apr 16, 2018
motiontrigger-plugins commit message Apr 16, 2018
source-plugins commit message Apr 16, 2018
streamwriter-plugins commit message Apr 16, 2018
.gitignore commit message Apr 16, 2018
CHANGES meta Apr 19, 2018
LICENSE commit message Apr 16, 2018
Makefile delayed-source-source added Nov 9, 2018
README.md fixes for views Apr 25, 2018
README.rest Fixes for id/descr/hex-id/etc mess Apr 18, 2018
cairo.cpp histogram Apr 27, 2018
cairo.h histogram Apr 27, 2018
cfg.cpp Fix for global-http-viewer & variables Apr 24, 2018
cfg.h filters directly in source-module / ico-mime-type Apr 26, 2018
cleaner.cpp correct clean-up at end Apr 24, 2018
cleaner.h More views / restructured urls Apr 23, 2018
config.h More views / restructured urls Apr 23, 2018
constatus.cfg helpful Apr 27, 2018
db.cpp More views / restructured urls Apr 23, 2018
db.h More views / restructured urls Apr 23, 2018
error.cpp More views / restructured urls Apr 23, 2018
error.h More views / restructured urls Apr 23, 2018
exec.cpp More views / restructured urls Apr 23, 2018
exec.h More views / restructured urls Apr 23, 2018
favicon.ico commit message Apr 16, 2018
filter.cpp filter fix Oct 12, 2018
filter.h filters: specific source Apr 24, 2018
filter_add_scaled_text.cpp filters: specific source Apr 24, 2018
filter_add_scaled_text.h filters: specific source Apr 24, 2018
filter_add_text.cpp alt descr Apr 25, 2018
filter_add_text.h filters: specific source Apr 24, 2018
filter_apply_mask.cpp filters: specific source Apr 24, 2018
filter_apply_mask.h filters: specific source Apr 24, 2018
filter_boost_contrast.cpp filters: specific source Apr 24, 2018
filter_boost_contrast.h filters: specific source Apr 24, 2018
filter_grayscale.cpp filters: specific source Apr 24, 2018
filter_grayscale.h filters: specific source Apr 24, 2018
filter_marker_simple.cpp filters: specific source Apr 24, 2018
filter_marker_simple.h filters: specific source Apr 24, 2018
filter_mirror_h.cpp filters: specific source Apr 24, 2018
filter_mirror_h.h filters: specific source Apr 24, 2018
filter_mirror_v.cpp filters: specific source Apr 24, 2018
filter_mirror_v.h filters: specific source Apr 24, 2018
filter_motion_only.cpp filters: specific source Apr 24, 2018
filter_motion_only.h filters: specific source Apr 24, 2018
filter_noise_neighavg.cpp filters: specific source Apr 24, 2018
filter_noise_neighavg.h filters: specific source Apr 24, 2018
filter_overlay.cpp filters: specific source Apr 24, 2018
filter_overlay.h filters: specific source Apr 24, 2018
filter_plugin.cpp filters: specific source Apr 24, 2018
filter_plugin.h filters: specific source Apr 24, 2018
http_client.cpp small leak Apr 24, 2018
http_client.h More views / restructured urls Apr 23, 2018
http_server.cpp filter fix Oct 12, 2018
http_server.h motion-compatibility mode fix Apr 25, 2018
interface.cpp fixes for views Apr 25, 2018
interface.h fixes for views Apr 25, 2018
log.cpp Fix for global-http-viewer & variables Apr 24, 2018
log.h More views / restructured urls Apr 23, 2018
main.cpp delayed-source-source added Nov 9, 2018
meta.cpp More views / restructured urls Apr 23, 2018
meta.h More views / restructured urls Apr 23, 2018
motion-to-constatus.py commit message Apr 16, 2018
motion_trigger.cpp filters: specific source Apr 24, 2018
motion_trigger.h Fix for global-http-viewer & variables Apr 24, 2018
overlay-test.png commit message Apr 16, 2018
picio.cpp More views / restructured urls Apr 23, 2018
picio.h More views / restructured urls Apr 23, 2018
resize.cpp More views / restructured urls Apr 23, 2018
resize.h More views / restructured urls Apr 23, 2018
resize_cairo.cpp More views / restructured urls Apr 23, 2018
resize_cairo.h More views / restructured urls Apr 23, 2018
resize_crop.cpp More views / restructured urls Apr 23, 2018
resize_crop.h More views / restructured urls Apr 23, 2018
selection_mask.cpp More views / restructured urls Apr 23, 2018
selection_mask.h More views / restructured urls Apr 23, 2018
source.cpp clock_gettime Apr 26, 2018
source.h filters directly in source-module / ico-mime-type Apr 26, 2018
source_delay.cpp delayed-source-source added Nov 9, 2018
source_delay.h delayed-source-source added Nov 9, 2018
source_http_jpeg.cpp filters directly in source-module / ico-mime-type Apr 26, 2018
source_http_jpeg.h filters directly in source-module / ico-mime-type Apr 26, 2018
source_http_mjpeg.cpp filters directly in source-module / ico-mime-type Apr 26, 2018
source_http_mjpeg.h filters directly in source-module / ico-mime-type Apr 26, 2018
source_plugin.cpp filters directly in source-module / ico-mime-type Apr 26, 2018
source_plugin.h filters directly in source-module / ico-mime-type Apr 26, 2018
source_stream.cpp filters directly in source-module / ico-mime-type Apr 26, 2018
source_stream.h filters directly in source-module / ico-mime-type Apr 26, 2018
source_v4l.cpp filters directly in source-module / ico-mime-type Apr 26, 2018
source_v4l.h filters directly in source-module / ico-mime-type Apr 26, 2018
stylesheet.css css magic for view-all screen Apr 17, 2018
target.cpp fixes for views Apr 25, 2018
target.h fixes for views Apr 25, 2018
target_avi.cpp fixes for views Apr 25, 2018
target_avi.h fixes for views Apr 25, 2018
target_extpipe.cpp fixes for views Apr 25, 2018
target_extpipe.h fixes for views Apr 25, 2018
target_ffmpeg.cpp get_frame already takes care of the sleep Jul 16, 2018
target_ffmpeg.h fixes for views Apr 25, 2018
target_jpeg.cpp fixes for views Apr 25, 2018
target_jpeg.h fixes for views Apr 25, 2018
target_plugin.cpp fixes for views Apr 25, 2018
target_plugin.h fixes for views Apr 25, 2018
target_vnc.cpp fixes for views Apr 25, 2018
target_vnc.h fixes for views Apr 25, 2018
utils.cpp gettimeofday => clock_gettime Apr 25, 2018
utils.h More views / restructured urls Apr 23, 2018
v4l2_loopback.cpp filters: specific source Apr 24, 2018
v4l2_loopback.h Fix for global-http-viewer & variables Apr 24, 2018
view.cpp All views now can use the filters of the global-http-server Apr 24, 2018
view.h fixes for views Apr 25, 2018
view_all.cpp fixes for views Apr 25, 2018
view_all.h fixes for views Apr 25, 2018
view_html_grid.cpp wrap-around fix (2) Apr 25, 2018
view_html_grid.h fixes for views Apr 25, 2018
view_ss.cpp filters directly in source-module / ico-mime-type Apr 26, 2018
view_ss.h fixes for views Apr 25, 2018

README.md

Records a videofile when motion is detected via a camera. This camera can be locally attached to your Linux system or be accessed via MJPEG.

features

Supports: input:

  • video4linux
  • MJPEG cameras
  • RTSP cameras
  • JPEG cameras
  • plugin interface (included is a VNC client plugin)

output:

  • AVI file(s)
  • individual JPEGs
  • HTTP streaming
  • video4linux loopback device
  • build-in VNC server
  • via plugins

motion detection

  • configurable detector
  • masks
  • also via plugin so that you can easily use one from e.g. OpenCV

filters:

  • add generic text two versions: fast (low CPU) or scaled (text can be any font, size or color)
  • boost contrast
  • convert to grayscale
  • add box around movement
  • show only pixels that have changed
  • mirror vertical and/or horizontal
  • neighbour average noise filter
  • picture overlay (with alpha blending)
  • scaling (resizing)
  • filters plugins (.so-files that can be linked at runtime)

managing:

  • Web interface
  • REST interface

Required:

  • libcurl-dev e.g. libcurl4-openssl-dev
  • libjansson-dev
  • libconfig++-dev
  • libjpeg-dev
  • libpng-dev
  • libgwavi - from https://github.com/Rolinh/libgwavi.git
  • libavformat-dev / libswscale-dev / libavcodec-dev / libavutil-dev / libswresample-dev / libavresample-dev
  • libcairo2-dev
  • libnetpbm10-dev
  • libexiv2-dev
  • libsqlite3-dev

If you don't want to use libexiv2 or ligwavi, then remove them from the Makefile and config.h.

How to use

The program supports cameras that generate YUYV, JPEG, RGB or YUV420 output. If your camera emits something different, e.g. P207 (PAC207) then you can use libv4l (by Hans de Goede). E.g.: LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libv4l/v4l2convert.so ./constatus -c constatus-v4l.cfg (on the raspberry pi) or LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libv4lconvert.so ./constatus -c constatus-v4l.cfg (on x64)

The program is configured via a text-file. It is processed by libconfig and thus uses that format. Take a look at the example: constatus.cfg. Use motion-to-constatus.py to convert a motion configuration file to a constatus configuration file - this requires the libconf package, see https://pypi.python.org/pypi/libconf

Each configuration has 1 or more instances.

Each instance has 1 (video-)source. So if you want to monitor multiple cameras, then you need to start multiple instances of constatus. The idea is that if anything crashes, you won't loose all cameras.

A configuration can have 0 or more motion-triggers (e.g. to have seperate output streams for different parts of the input) and 0 or more stream-to-file backends.

Most outputs (http, files, etc) and the motion-trigger can have 0 or more filters. Filters are executed in the order in which they are found on the configuration-file. You can also have multiple instances of the same filter for an output/motion-trigger.

As said, constatus can have multiple streamers, filters, etc.; the only drawback is that it uses more cpu. Having available multiple cpus/cores/threads is an advantag for constatus.

Each item has an id. You can leave it empty if you like. It is used in the configuration web-interface as a hint to which item you're working on.

If it is unclear what the "selection-bitmap" masks, then try adding it to an "apply-mask" stream-writer or http-server filter. That way you can see which part of the image is masked off.

Please check the file CHANGES to see what you need to know when upgrading from an earlier version. Read README.rest to get to know how the REST interface works.

FAQ

  • If I restart the program then sometimes some cameras show an error

that is a problem of certain cameras that have a limit on the number of viewers it can handle concurrently; apparently the previous session was not terminated fully

  • When I put more than, say, 5 cameras on a web-page (e.g. in an "html-grid"), then things become slow and/or cameras don't show anything.

that is a problem with web-browsers not being able to display so many video-streams concurrently. strangely enough I had best results with the safari browser - or limitting to 4 streams per page.

(C) 2017-2018 by Folkert van Heusden, released under AGPL v3.0 mail@vanheusden.com