https://github.com/gabrielrf/video2telegram
Watches a folder. If new file, sends gif using Telegram Messenger.
https://github.com/gabrielrf/video2telegram
docker docker-compose synology synology-surveillance-station telegram telegram-bot-api
Last synced: 6 months ago
JSON representation
Watches a folder. If new file, sends gif using Telegram Messenger.
- Host: GitHub
- URL: https://github.com/gabrielrf/video2telegram
- Owner: GabrielRF
- License: gpl-3.0
- Created: 2018-09-17T17:15:19.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-26T15:33:16.000Z (over 3 years ago)
- Last Synced: 2024-12-31T11:23:52.856Z (6 months ago)
- Topics: docker, docker-compose, synology, synology-surveillance-station, telegram, telegram-bot-api
- Language: Python
- Homepage: https://hub.docker.com/r/gabrielrf/video2telegram/
- Size: 356 KB
- Stars: 31
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://hub.docker.com/r/gabrielrf/video2telegram/builds/)
# Video to Telegram

* [About](#about)
* [Setup](#setup)
* [Docker Compose](#docker-compose)
* [Python](#python)
* [Synology Docker](#synology-docker)
* [Example](#example)
* [Contribute](#contribute)
* [Contact](#contact-me)## About
This docker container checks if a new file is created on a folder and sends it to a person/group/channel using [Telegram Messenger](https://telegram.org).
The idea behind this project is to send me a gif everytime my camera detects movement. The camera is pointed to my door, this way I can see on real time who is entering or leaving my place. Also, another unexpected benefit of using this project is to have a cloud backup of my camera for free.
## Setup
### Docker Compose
```
file2gif:
image: gabrielrf/video2telegram
environment:
- BOT_TOKEN=
- FOLDER=/
- EXTENSION=mp4
- DESTINATION=
restart: always
volumes:
- host_folder:container_folder
````BOT_TOKEN`: Token given by [@BotFather](https://t.me/BotFather) on Telegram.
`FOLDER`: Folder that will be monitored by the script. In case of a folder tree, set the top-level folder.
`EXTENSION`: The extension of the file that should be sent. Usually `mp4` is the case.
`DESTINATION`: To whom the message will be sent.
`volumes`: The same folder used on `FOLDER`:Some folder that exists on the container. Suggested: `/mnt`
### Python
First, run
```
pip install inotify
pip install pytelegrambotapi
pip install ffmpy
```to install the libraries needed. Then, open `file2gif.py` and make the necessary adjustments on `BOT_TOKEN`, `FOLDER`, `EXTENSION` and `DESTINATION` as listed above.
Run the Python Script.
```
python file2gif.py
```### Synology Docker
Open the Docker App on your Synology Device. On `Registry`, look for `video2telegram` and double click the result to download the image.

On the `Image` tab, check if the download is completed. Once completed, double click the image and set it as follows.

`Container Name` is optional. `Enable auto-restart` is recommended.
Click on `Advanced Settings` and go to tab `Volume`. Click on `Add Folder` and find your camera folder.
Click on `Select`. Go to tab `Environment` and add the variables. Check [Docker Compose](#docker-compose) topic for details. Don't create or change other variables.
Your settings should look similar to this image:

Click on `Apply` and it should be ready and running.
## Example
This is a YouTube video with the expected result
[](https://www.youtube.com/watch?v=f4AZRUY2RME)
## Contribute
Pull requests and issues are welcome!
## Contact me
[GabRF.com](https://gabrf.com)
[@GabrielRF](https://t.me/gabrielrf) on Telegram.