The program utilizes OpenCV to capture snapshots from the camera feed, which are then analyzed by a pre-trained AI model (YOLOv10n). If the model detects a person in the image, the program automatically sends an alert to a designated Telegram chat.
- Docker
- Telegram
You need to create a config.json
file that contains a list of cameras with their names and RTSP URLs. Below is an example configuration with three cameras:
{
"cameras": [
{
"name": "Driveway",
"url": "rtsp://172.16.0.10/stream"
},
{
"name": "Backyard",
"url": "rtsp://172.16.0.11/stream"
},
{
"name": "Door",
"url": "rtsp://172.16.0.12/stream"
}
]
}
- Create a Bot: Open Telegram and talk to @BotFather. Follow the instructions to create a new bot and get your bot token.
- Get Chat ID:
- Send a message to your newly created bot.
- Open your browser and visit:
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
Replace<YOUR_TOKEN>
with the token you received from @BotFather. - You will receive a JSON response. Look for the following part to find your chat ID:
"chat": { "id": 12345678,
Run the following command to start the container:
docker run -d --name analyzecctv \
-v /path/to/config.json:/app/config.json \
-e TG_TOKEN=YOUR_TOKEN \
-e TG_CHAT_ID=YOUR_CHAT_ID \
--restart always \
aleksandergpl/analyzecctv
Replace /path/to/config.json
with the actual path to your configuration file. Additionally, substitute YOUR_TOKEN
and YOUR_CHAT_ID
with your bot’s token and chat ID.
DELAY
- Delay between checking the camera feedCONF_TRESH
- Confidence treshold for the AI modelTG_TOKEN
- Telegram bot tokenTG_CHAT_ID
- Telegram chat id