Giter Site home page Giter Site logo

pmcctv's Introduction

pmcctv - poor man's CCTV system in Go

This Go application captures images from a webcam. It supports motion detection, burst mode, and upload to a remote directory.

A Go worker captures frames at regular intervals using ffmpeg. Then ImageMagick's compare tool is used to check if this frame is similar to the previous one. If the frames are different enough, they are kept, otherwise they are deleted. This provide very simple motion detection and avoids filling up the hard drive with duplicate frames.

Optionally, a Go worker can be setup to automatically upload the frames to a remote server. Frames are copied using either scp or rsync, depending on what's available. Finally, another worker runs at regular intervals to clean up both the local and remote directory (by default, frames are kept for up to 7 days).

Normally, the program captures one frame per second. However, when motion is detected, a "burst mode" is activated, in which case frames will be captured as fast as possible for the next 10 seconds, or for as long as motion is being detected.

Installation

OS X

Install Go from https://golang.org/doc/install

brew install ffmpeg
brew install imagemagick
go get -u github.com/laurent22/pmcctv

Linux

Install Go from https://golang.org/doc/install

sudo apt-get install ffmpeg
sudo apt-get install imagemagick
go get -u github.com/laurent22/pmcctv

Note: in many systems avconv (libav) is installed instead of ffmpeg. However since avconv video capture does not work well, only ffmpeg is supported.

Windows

From a command line prompt, run go get -u github.com/laurent22/pmcctv

Usage

Usage:
  pmcctv [OPTIONS]

Application Options:
  -m, --ffmpeg=              Path to ffmpeg.
  -d, --frame-dir=           Path to directory that will contain the captured frames. Default: ~/Pictures/pmcctv
  -r, --remote-dir=          Remote location where frames will be saved to. Must contain a path compatible with scp (eg. user@someip:~/pmcctv).
  -p, --remote-port=         Port of remote location where frames will be saved to. If not set, whatever is the default scp port will be used (should be 22).
  -b, --burst-mode-duration= Duration of burst mode, in seconds. Set to -1 to disable burst mode altogether. Default: 10.
  -t, --time-to-live=        For how long captured frames should be kept, in days. Default: 7.
  -i, --input-device:        Name of capture input device. Default: auto-detect, except on Windows.

Help Options:
  -h, --help                 Show this help message

To stop the script, press Ctrl + C.

TODO

License

MIT

pmcctv's People

Contributors

laurent22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pmcctv's Issues

Installation using go get

First, thanks for the interesting project. :) I noticed a small thing in the Installation section. The command go install github.com/laurent22/pmcctv seems to be unecessary. According to the documentation of the go command, get downloads and installs the package.

To prove my theory I tried downloading your package by using only the go get command. It both downloaded and installed the package on my system. Then I was able to start your program using pmcctv without calling any forther go command. (I tried it on Gentoo Linux, but I am sure that part of the installation is OS-independent.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.