Hybrid Telegram encoding bot combining features from Nubuki-all/Enc and Zylern/TGVid-Comp. Encodes video to AV1 / HEVC x265 / HEVC x264 (10-bit, dual audio) via FFmpeg.
- AV1 (libsvtav1), HEVC x265, HEVC x264 β all 10-bit
- Configurable CRF, preset, bit depth (8/10) per user
- Dual audio: keep 2 audio tracks (e.g. JPN + ENG), AAC 192k
- Subtitle passthrough
- Custom ffmpeg override via FFMPEG env vars
- Encoding queue with configurable max size
- Auto-prefix / auto-suffix on output filenames
- Regex autorename rule (pattern|replacement)
- Custom releaser tag (e.g. [GroupName])
- Codec tag appended automatically
- Safe filename sanitization
- Custom per-user thumbnail (set by replying to photo)
- Auto-extract from video if no custom thumb set
- View / delete thumbnail
- Decorator emoji/prefix (CAP_DECO)
- Caption includes codec, audio mode, file size
- Custom rename rules applied to captions too
/sampleβ cut N-second sample clip (configurable start/duration)/screenshotsβ capture N evenly-spaced screenshots as media group
- Upload as video (with streaming) or document
- Spoiler mode toggle
- Dump to separate channel/group (DUMP_CHANNEL)
- Forward channel support (FCHANNEL)
- Telegram file download with progress bar
- Speed, ETA, percentage shown in live-updating message
/lock//unlockβ freeze encoding/clearqueueβ flush all queued jobs/broadcastβ message all users/statsβ CPU / RAM / disk / queue
- Per-user settings stored in MongoDB
/mysettingsβ view all active settings/resetβ reset settings to defaults- Auto-deploy latest on startup (ALWAYS_DEPLOY_LATEST)
- LOGS_IN_CHANNEL β auto-dump errors to log channel
- Clone the repo and navigate into the directory:
git clone https://github.com/YOUR_USERNAME/EncHybridBot cd EncHybridBot - Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate - Install the required dependencies:
pip install -r requirements.txt
- Copy
.env.sampleto.envand fill in your variables (APP_ID,API_HASH,BOT_TOKEN,OWNER,DATABASE_URL). - Ensure
ffmpegis installed on your system (sudo apt install ffmpegon Ubuntu/Debian). - Start the bot:
python3 -m bot
- Clone the repo and copy
.env.sampleβ.env - Fill in your variables:
APP_ID,API_HASH,BOT_TOKEN,OWNER,DATABASE_URL - Build & run:
docker build -t enchybrid .
docker run --env-file .env enchybridGo to your copy on GitHub: https://github.com/YOUR_USERNAME/EncHybridBot
- Go to https://dashboard.heroku.com/new-app
- Enter app name β Create app
- In your Heroku app β Deploy tab
- Deployment method β GitHub
- Search for your fork β Connect
-
Go to Settings tab β Stack section
-
Change stack to container (Heroku Dashboard β Settings β scroll to "Stack" β click "Change Stack" β select
container)Alternatively, set
heroku.ymlin root (already included in this repo).
- Heroku app β Settings β Config Vars β Reveal Config Vars
- Add each variable from
.env.sample:
| Key | Value |
|---|---|
| APP_ID | your telegram app id |
| API_HASH | your telegram api hash |
| BOT_TOKEN | your bot token from @BotFather |
| OWNER | your telegram user id |
| DATABASE_URL | mongodb+srv://... |
| DEFAULT_CODEC | hevc265 |
| DUAL_AUDIO | True |
| ... | (see .env.sample for full list) |
- Deploy tab β Manual deploy β select
mainbranch β Deploy Branch - Watch build logs. When done, go to Resources tab.
- Resources tab β find
workerdyno β toggle it ON - Bot is now running π
Use MongoDB Atlas:
- Create free M0 cluster
- Add database user + allow all IPs (0.0.0.0/0)
- Get connection string β paste as
DATABASE_URLin Heroku config vars
| Variable | Required | Default | Description |
|---|---|---|---|
| APP_ID | β | β | Telegram API ID |
| API_HASH | β | β | Telegram API Hash |
| BOT_TOKEN | β | β | Bot token |
| OWNER | β | β | Owner user ID |
| DATABASE_URL | β | β | MongoDB URI |
| DEFAULT_CODEC | hevc265 | av1/hevc265/hevc264 | |
| DEFAULT_CRF | 24 | CRF value | |
| DEFAULT_PRESET | slow | Encode preset | |
| DUAL_AUDIO | True | Keep 2 audio tracks | |
| AUDIO_LANG_1 | jpn | Primary audio lang | |
| AUDIO_LANG_2 | eng | Secondary audio lang | |
| UPLOAD_AS_VIDEO | True | Upload as video vs doc | |
| AUTO_PREFIX | β | Global filename prefix | |
| AUTO_SUFFIX | β | Global filename suffix | |
| CAP_DECO | β | Caption emoji/prefix | |
| RELEASER | β | Release group tag | |
| LOG_CHANNEL | β | Log channel ID | |
| DUMP_CHANNEL | β | Dump encoded files here | |
| SAMPLE_DURATION | 60 | Sample clip length (s) | |
| SCREENSHOT_COUNT | 10 | Number of screenshots | |
| MAX_QUEUE | 10 | Max queued jobs | |
| WORKERS | 4 | Pyrogram workers | |
| LOCK_ON_STARTUP | False | Lock encoding at start | |
| ALWAYS_DEPLOY_LATEST | False | git pull on startup |
| Command | Description |
|---|---|
| /start | Start bot |
| /help | Full help |
| /encode | Encode replied video |
| /sample | Generate sample clip |
| /screenshots | Generate screenshots |
| /setcodec | Choose codec (inline buttons) |
| /setcrf [n] | Set CRF |
| /setpreset | Choose preset (inline buttons) |
| /setbitdepth [8|10] | Set bit depth |
| /dualaudio [on|off] | Toggle dual audio |
| /setprefix [text] | Set filename prefix |
| /setsuffix [text] | Set filename suffix |
| /setrename [pat|rep] | Set regex rename rule |
| /clearrename | Clear rename rule |
| /setthumb | Set custom thumbnail |
| /delthumb | Delete custom thumbnail |
| /viewthumb | Preview thumbnail |
| /mysettings | View all settings |
| /reset | Reset settings |
| /queue | Queue status |
| /lock | Lock encoding (owner) |
| /unlock | Unlock encoding (owner) |
| /clearqueue | Clear queue (owner) |
| /stats | Bot stats |
| /broadcast [msg] | Broadcast (owner) |