Skip to content

amnindersingh12/EncHybridBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EncHybrid Bot 🎬

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.


Features

Encoding

  • 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

File Management

  • 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

Thumbnail

  • Custom per-user thumbnail (set by replying to photo)
  • Auto-extract from video if no custom thumb set
  • View / delete thumbnail

Caption

  • Decorator emoji/prefix (CAP_DECO)
  • Caption includes codec, audio mode, file size
  • Custom rename rules applied to captions too

Sample & Screenshots

  • /sample β€” cut N-second sample clip (configurable start/duration)
  • /screenshots β€” capture N evenly-spaced screenshots as media group

Upload

  • Upload as video (with streaming) or document
  • Spoiler mode toggle
  • Dump to separate channel/group (DUMP_CHANNEL)
  • Forward channel support (FCHANNEL)

Download

  • Telegram file download with progress bar
  • Speed, ETA, percentage shown in live-updating message

Admin

  • /lock / /unlock β€” freeze encoding
  • /clearqueue β€” flush all queued jobs
  • /broadcast β€” message all users
  • /stats β€” CPU / RAM / disk / queue

Misc

  • 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

Setup

Local Setup (Virtual Environment)

  1. Clone the repo and navigate into the directory:
    git clone https://github.com/YOUR_USERNAME/EncHybridBot
    cd EncHybridBot
  2. Create and activate a virtual environment:
    python3 -m venv venv
    source venv/bin/activate
  3. Install the required dependencies:
    pip install -r requirements.txt
  4. Copy .env.sample to .env and fill in your variables (APP_ID, API_HASH, BOT_TOKEN, OWNER, DATABASE_URL).
  5. Ensure ffmpeg is installed on your system (sudo apt install ffmpeg on Ubuntu/Debian).
  6. Start the bot:
    python3 -m bot

Docker Setup

  1. Clone the repo and copy .env.sample β†’ .env
  2. Fill in your variables: APP_ID, API_HASH, BOT_TOKEN, OWNER, DATABASE_URL
  3. Build & run:
docker build -t enchybrid .
docker run --env-file .env enchybrid

Deploy on Heroku (NO CLI required)

Step 1 β€” Fork this repo

Go to your copy on GitHub: https://github.com/YOUR_USERNAME/EncHybridBot

Step 2 β€” Create Heroku app

  1. Go to https://dashboard.heroku.com/new-app
  2. Enter app name β†’ Create app

Step 3 β€” Connect GitHub

  1. In your Heroku app β†’ Deploy tab
  2. Deployment method β†’ GitHub
  3. Search for your fork β†’ Connect

Step 4 β€” Set stack to container

  1. Go to Settings tab β†’ Stack section

  2. Change stack to container (Heroku Dashboard β†’ Settings β†’ scroll to "Stack" β†’ click "Change Stack" β†’ select container)

    Alternatively, set heroku.yml in root (already included in this repo).

Step 5 β€” Set Config Vars (env variables)

  1. Heroku app β†’ Settings β†’ Config Vars β†’ Reveal Config Vars
  2. 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)

Step 6 β€” Deploy

  1. Deploy tab β†’ Manual deploy β†’ select main branch β†’ Deploy Branch
  2. Watch build logs. When done, go to Resources tab.

Step 7 β€” Enable worker dyno

  1. Resources tab β†’ find worker dyno β†’ toggle it ON
  2. Bot is now running πŸŽ‰

Step 8 β€” MongoDB (free)

Use MongoDB Atlas:

  1. Create free M0 cluster
  2. Add database user + allow all IPs (0.0.0.0/0)
  3. Get connection string β†’ paste as DATABASE_URL in Heroku config vars

Environment Variables Reference

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

Commands

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)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages