Skip to content

About

An all-in-one advanced Telegram video processing bot for fast FFmpeg encoding, file renaming, custom metadata injection, and thumbnail embedding.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

VideoEncoder Engine Banner

⚡ VideoEncoder Pro

Next-Gen Unified Media Processing & Transcoding Engine

An enterprise-grade, asynchronous video transformation suite engineered for Telegram.
Fuses transcode filters, dynamic track routing, metadata injection, and cover embedding into a single deterministic FFmpeg pass.

Python FFmpeg MongoDB Docker

Channel Developer Repository


📊 Pipeline Architecture

All multi-stage encoding tasks are merged into a synchronized, non-blocking single execution pass:

flowchart LR
    subgraph Ingest ["📥 INGESTION"]
        A["Telegram Media / URL"] --> B["Async Task Buffer"]
    end

    subgraph CoreEngine ["⚡ SINGLE-PASS PIPELINE"]
        B --> C{"Pre-Flight Setup"}
        C --> D["Monolithic FFmpeg Engine"]
        D --> E["Transcode x264/x265 & Scaling"]
        D --> F["Audio Matrix & Resampling"]
        D --> G["Header Metadata Stripping"]
        D --> H["Cover Frame Embedding"]
    end

    subgraph Output ["🚀 DELIVERY"]
        E & F & G & H --> I["Streamed Final File"]
        I --> J[("MongoDB Motor State")]
        I --> K["Telegram Fast Dispatch"]
    end
Loading

⚡ Performance Paradigm

Operational Parameter Standard Transcode Bots ⚡ VideoEncoder Pro
FFmpeg Passes 3 to 4 sequential passes Single Deterministic Pass
Disk I/O Overhead High (Writes redundant temp files) Near Zero (Direct pipe streaming)
CPU Frame Re-indexing Redundant muxing stages Strictly Optimized execution
Stream Management Hardcoded static selectors Dynamic Audio & Subtitle Track Router
Processing Speed Standard baseline Up to 60% Faster Delivery

🌟 Core Feature Matrix

🎛️ Interactive Pipeline Terminal

  • Pre-Flight Configuration: Adjust CRF, target resolutions, audio codecs, and stream mappings before starting execution.
  • Stream Matrix Control: Strip unwanted tracks or re-order preferred audio/subtitle streams via inline buttons.
  • Real-time Concurrency: Fully asynchronous state dispatch powered by Pyrofork and Asyncio.

🎞️ Precision Transcoding

  • Modern Codecs: Full support for industry-standard H.264 (AVC) and bandwidth-efficient H.265 (HEVC).
  • Granular Quality Dial: Comprehensive CRF control (14 – 32) coupled with tuning presets (ultrafast to slow).
  • Adaptive Scaling Profiles: Scale down smoothly to 1080p, 720p, 576p, 480p, or retain original source scale.

✏️ Dynamic Tokenized Renamer

  • Tag Interpolation Engine: Format automated output naming schemes via flexible placeholders:
    {filename} · {resolution} · {codec} · {quality} · {ext}
    
  • Filesystem Normalization: Built-in sanitization blocks illegal characters across POSIX, NTFS, and APFS filesystems.

🎨 Metadata & Artwork Engine

  • Source Sanitization: Strip original telemetry and unwanted metadata tags using -map_metadata -1.
  • Container Tag Stamping: Inject custom Title, Author, Year, and Copyright tags directly into stream headers.
  • Visual Attachment Modes: Switch between persistent MongoDB-stored covers, extracted source frames, or zero artwork.

🕹️ Command Reference

Command Arguments Operational Scope
/start — Check bot online heartbeat
/help — Open interactive user manual
/dl (Reply / File) Queue Telegram media into pipeline
/ddl [Direct URL] Ingest remote HTTP(S) video stream
/settings — Configure persistent user preferences
/status — Inspect host metrics, RAM load & queue state
/setthumb (Reply / Photo) Save persistent custom thumbnail
/viewthumb — View active thumbnail profile (/thumb)
/delthumb — Delete thumbnail record from database

⚙️ Environment Variables

Set these in your host environment or define them inside .env:

# ── Core Telegram Settings ──────────────────────────────────
API_ID=12345678                          # Obtained via my.telegram.org
API_HASH=your_api_hash_here              # Obtained via my.telegram.org
BOT_TOKEN=123456789:ABCdefGHIjklMNOpqr   # Obtained via @BotFather

# ── Permissions & Logging ───────────────────────────────────
OWNER_ID=123456789                       # Master Administrator ID
SUDO_USERS=987654321 1122334455          # Space-separated Administrator IDs
LOG_CHANNEL=-1007273593616               # File storage/log channel ID (change here when updating the channel)

# ── Storage & Directories ───────────────────────────────────
MONGO_URI=mongodb://localhost:27017/VideoEncoder
DOWNLOAD_DIR=downloads
ENCODE_DIR=encode

🐳 Docker Deployment (Recommended)

Production-ready orchestration for 24/7 uptime:

# 1. Clone repository
git clone https://github.com/Unrated-Coder/Encoding-Bot.git
cd Encoding-Bot

# 2. Configure environment
cp .env.example .env
nano .env

# 3. Spin up daemonized services
docker compose up -d --build

# 4. Stream real-time logs
docker compose logs -f bot

💻 Bare-Metal Setup

Ensure Python 3.10+ and a recent release of FFmpeg are installed on your host system.

# Package execution
python3 -m VideoEncoder

# Direct script entry point
python3 main.py

Crafted with engineering discipline by Luffytaro · Channel: Unrated Coder


Footnote: Origin & Architectural Lineage

Engineering Notice: During the earliest design phases of this project, overcoming high-throughput asynchronous process I/O bottlenecks was a significant hurdle for our team. To bootstrap our development, we initially relied on structural inspiration from abhinai2244's base repository.

About

An all-in-one advanced Telegram video processing bot for fast FFmpeg encoding, file renaming, custom metadata injection, and thumbnail embedding.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages