Watch your UniFi Video directory for new videos, convert to gif and notify over MQTT.
Read my blog article for a tutorial on how to get started.
Needs a simple JSON based config file passed in on the command line.
For example:
{
"mqtt_server": "192.168.1.2",
"mqtt_port": 1883,
"mqtt_base_topic": "cameras/gifs",
"gif_output_dir": "/gifs",
"unifi_video_watch_dir": "/unifi-video"
}
mqtt_server
: MQTT server to publish notifications tomqtt_port
: Port of MQTT servermqtt_base_topic
: MQTT topic to publish new GIFs to. Camera name will be appended to the end of this base topic.gif_output_dir
: Directory to put the created GIFsunifi_video_watch_dir
: Directory to watch for new UniFi Video Recordings
There is a docker image if you prefer to run using docker. For example:
docker run -v $(pwd)/config:/config \
-v /srv/storage/Videos/Surveillance:/unifi-video \
-v /tmp/gifs:gifs \
zlalanne/unifi-video-gif-mqtt:latest
or via docker compose.
services:
unifi-video-gif-mqtt:
image: zlalanne/unifi-video-gif-mqtt:latest
volumes:
- ./config/unifi-video-gif-mqtt:/config
- /srv/storage/Videos/Surveillance:/unifi-video
- /tmp/gifs:/gifs
restart: unless-stopped
If you'd prefer to install dependencies yourself, you'll need:
- ffmpeg 4.0 (other versions probably work, but that's what I tested with)
- Python 3
- python libraries listed in
requirements.txt
(install viapip install -r requirements.txt
)