Skip to content

HTTP endpoint to create animated GIFs from CCTV IP cameras on demand

License

Notifications You must be signed in to change notification settings

e2m32/cctv-gif-buffer

 
 

Repository files navigation

CCTV GIF Buffer

MIT licensed Build Status Coverage Status Scrutinizer Code Quality Docker build

Polls IP CCTV cameras every X time (configurable), stores the last X frames in an in-memory ring buffer per camera. Provides a simple HTTP endpoint to retrieve a GIF. This service is designed to be easily integrated with home automation systems.

Example uses:

  • Send you a private message containing the last X frames of motion when the door opens
  • Post a GIF to a private slack channel when the door bell is rang

GET http://<ip_address>:8080/gif?camera=<camera_name>&duration=60&interval=0.25

Screenshot

Configuration

Cameras are listed in YAML configuration file. The poll interval is specified per camera, optionally HTTP basic authentication can be used.

cameras:
  frontdoor:
    url: http://192.168.0.9/ISAPI/Streaming/channels/101/picture
    interval: 2
    store: 30
  backdoor:
    url: http://192.168.0.10/jpg/1/image.jpg
    interval: 2
    store: 30
    auth: basic
    username: admin
    password: letmein
server:
  web:
    port: 8080
    listen: 0.0.0.0

Per camera fields:

  • url: URL to retrieve a JPEG from the camera from. (required)
  • interval: Time in seconds between polls (default = 1)
  • store : Number of frames to store in the ring buffer (default = 30)
  • auth: HTTP authentication type, only basic is supported (optional)
  • username: HTTP basic authentication username
  • password: HTTP basic authentication password

Usage

python2.7 buffer.py -c config.yaml

Deployment

Quick and easy - Docker!

docker pull e2m32/cctv-gif-buffer:latest
docker run -d --name cctvgifbuffer --rm -v /etc/cctvgifbuffer:/config -p 8080:8080 -t e2m32/cctv-gif-buffer

Dependencies

libjpeg, install on Mac brew install libjpeg

Installation

[email protected]:e2m32/cctv-gif-buffer.git
cd cctv-gif-buffer
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

License and Copyright

Copyright 2017 Nat Morris [email protected]

Licensed under the MIT License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

TODO

  • service.py should create a session for basic auth connections

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.6%
  • Dockerfile 9.4%