Python bot that receives Telegram video/audio files and returns .srt subtitles using Google Speech-to-Text.
- Accepts
video,audio,voice, and mediadocumentuploads. - Validates:
- max file size:
50 MB - max duration:
20 minutes
- max file size:
- Converts media to mono 16kHz WAV with FFmpeg.
- Transcribes in chunked mode to stay memory-friendly on low-resource hosts.
- Generates
.srtwith timestamps. - Enforces single active heavy job.
- Aggressive cleanup:
- source file deleted after extraction
- temp folders cleaned at job end
- stale temp folders auto-purged by TTL sweeper (default 120s)
Use .env.example as reference.
BOT_TOKENWEBHOOK_URL(for Render deployment)WEBHOOK_SECRET_TOKEN(recommended)
Note: Google Speech-to-Text still requires valid Google Cloud authentication at runtime (for example via platform-provided default credentials).
Built-in defaults (no env needed):
- webhook path:
/webhook - language:
en-US - max file size:
50MB - max duration:
20 minutes - temp TTL cleanup:
120s
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 10000- Create a new Render Web Service from this repo.
- Use
Dockerfile(orrender.yamlBlueprint). - Add all required env vars.
- Set bot webhook URL env to your service URL:
WEBHOOK_URL=https://<your-render-service>.onrender.com
Webhook endpoint:
POST /webhook
Health endpoint:
GET /health