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
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, onlybasic
is supported (optional)username
: HTTP basic authentication usernamepassword
: HTTP basic authentication password
python2.7 buffer.py -c config.yaml
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
libjpeg, install on Mac brew install libjpeg
[email protected]:e2m32/cctv-gif-buffer.git
cd cctv-gif-buffer
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
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.
- service.py should create a session for basic auth connections