Skip to content

fsdevcom2000/ipcamera-snapshot-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

IP Camera Snapshot Bot for n8n

This workflow allows you to receive a snapshot from an IP camera using the RTSP protocol via Telegram.

When a Telegram user sends an RTSP URL to your bot, n8n uses FFmpeg to connect to the IP camera, takes a single frame, and sends it back as a photo message.


Features

  • Accepts RTSP URLs from Telegram messages
  • Captures one snapshot from the video stream using FFmpeg
  • Sends the captured image back to the same chat
  • Validates input to avoid incorrect URLs
  • Handles timeouts and errors gracefully

Requirements

Before using this workflow, make sure your system meets the following requirements:

1. Install FFmpeg

On Ubuntu / Debian:

sudo apt update
sudo apt install ffmpeg

2. Have an n8n instance running

You can use:

  • n8n Cloud, or

  • a self-hosted version (npm, Docker, or Desktop)

3. Create Telegram Bot credentials

  1. Talk to @BotFather in Telegram.

  2. Create a new bot and get your Bot Token.

  3. In n8n, go to Credentials → Telegram API, and add your token there.

  4. Assign this credential to all Telegram nodes in this workflow after importing.


How to Use

  1. Import the JSON workflow into n8n:

    • Click “+ New workflow” → “Import from file”

    • Select IP Camera Snapshot Bot.json

  2. Open the Telegram nodes and select your created Telegram API credentials.

  3. Activate the workflow.

  4. In Telegram, send a message with a valid RTSP URL, e.g.:

    rtsp://username:password@192.168.1.10:554/stream

  5. The bot will take a snapshot and reply with the image.


How It Works

Node Description
Telegram Trigger Waits for messages from your bot.
Edit Fields Extracts the text (RTSP URL) from the Telegram message.
Check URL Validates that the message starts with rtsp://.
Get Snapshot (ffmpeg) Executes FFmpeg to capture one frame from the stream.
Open Image Reads the generated file /tmp/frame.jpg.
Send Photo Sends the image back to the Telegram chat.
Error Nodes Send messages if the URL is invalid or snapshot fails.

Notes

  • This workflow saves snapshots temporarily in /tmp/frame.jpg.

  • If you need persistent storage, change the path to your preferred directory.

  • Ensure that the n8n host has access to the RTSP source and that ports are open.

About

This workflow allows you to receive a snapshot from an IP camera using the RTSP protocol via Telegram.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published