Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Subtitle Generator Bot

Python bot that receives Telegram video/audio files and returns .srt subtitles using Google Speech-to-Text.

Features

  • Accepts video, audio, voice, and media document uploads.
  • Validates:
    • max file size: 50 MB
    • max duration: 20 minutes
  • Converts media to mono 16kHz WAV with FFmpeg.
  • Transcribes in chunked mode to stay memory-friendly on low-resource hosts.
  • Generates .srt with 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)

Required Environment Variables

Use .env.example as reference.

  • BOT_TOKEN
  • WEBHOOK_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

Local Run

pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 10000

Render Deploy

  1. Create a new Render Web Service from this repo.
  2. Use Dockerfile (or render.yaml Blueprint).
  3. Add all required env vars.
  4. 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

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages