An advanced, fully automated tool to generate high-quality vertical video reels. By leveraging AI for scriptwriting, multi-engine text-to-speech, and automated video compilation (complete with subtitles, avatars, and PIP features), this project turns simple topics or YouTube RSS feeds into engaging content. You can interact with it via a local Next.js Web App dashboard or entirely through a secure Telegram Bot.
- AI Script Generation: Automatically drafts contextual dialogue using Gemini AI.
- Multiple TTS Engines Supported:
- ElevenLabs: High-quality, premium cloud voice cloning.
- Gemini TTS: Integrated cloud TTS from Google.
- Kokoro: Local, fast, ONNX-based open-source TTS.
- macOS Native (
say): Built-in, zero-dependency offline TTS for Mac users.
- Rich Video Compilation (MoviePy / FFmpeg):
- Dynamic overlay of animated subtitles with customizable fonts and stroke colors.
- Automated integration of Avatar images (bouncing animation when speaking).
- Picture-in-Picture (PIP) asset overlay support.
- Random stock video background selection and background music integration.
- Telegram Bot Interface: Control the entire pipeline securely from your phone.
- Content Ingestion: Capable of digesting YouTube RSS feeds for trending topics.
graph TD
A[User Input / YouTube RSS Feed] --> B[Gemini AI: Script Generation]
B --> C[TTS: ElevenLabs / Kokoro / Gemini / mac_say]
B --> D[Stock Background Videos / Gameplay]
B --> I[Avatar & PIP Asset Selection]
C --> E[Video Compiler: MoviePy / FFmpeg]
D --> E
I --> E
E --> F[Subtitles / Captions Overlay]
F --> G[Background Music Integration]
G --> H[Final Generated Reel .mp4]
- Python: Version 3.12 or higher.
- Package Manager: uv (Recommended) or
pip. - System Tools:
FFmpeg: Essential for video processing.ImageMagick: Required by MoviePy for text/subtitle generations.
-
Install System Dependencies (using Homebrew):
brew install ffmpeg imagemagick
Note: Ensure the
MAGICK_HOMEenvironment variable is set orconvert/magickis in your PATH. -
Install
uv(Recommended):curl -LsSf https://astral.sh/uv/install.sh | sh
Install Python, FFmpeg, and ImageMagick via your OS package manager (apt, dnf, choco, etc.).
-
Clone the Repository:
git clone <repository_url> cd thriceai
-
Install Python Dependencies:
uv sync # OR: pip install -e . -
Setup Frontend (Optional for Dashboard):
cd web_app bun install -
Prepare Local Assets (Required Directories): Ensure you place your local models and media in the
data/directory:data/assets/bg_videos/: Drop your background MP4s here.data/assets/avatars/: PNG avatars for characters.data/models/kokoro/: (If using Kokoro) Placekokoro-v1.0.onnxandvoices-v1.0.binhere.data/fonts/: Place yourInter_28pt-ExtraBold.ttfor preferred fonts.
Create a .env file in the root directory. Configure only what you need:
# --- LLM API Keys ---
GEMINI_API_KEY=your_gemini_api_key_here
CLAUDE=your_claude_api_key_here
# --- TTS Providers ---
ELEVEN_API=your_elevenlabs_api_key_here
# --- Telegram Bot Configuration ---
TELEGRAM_BOT=your_telegram_bot_token_here
TELEGRAM_CHAT_ID=@your_channel_or_chat_id
# CRITICAL: Comma-separated Telegram User IDs allowed to use bot commands
AUTHORIZED_TELEGRAM_USERS=123456789,987654321The bot provides a secure, remote interface for the generation pipeline:
- Start the backend:
uv run run.py - Message your bot on Telegram:
/help: List all commands./script <topic> <filename>: Generate a script./generate <filename> [audio_mode]: Generate a reel from a script. Supported audio modes:kokoro_mlx,kokoro,mac_say,elevenlabs,gemini./reel <topic>: Full Auto Mode (Script -> Reel -> Caption -> Telegram Upload)./status: Check generation progress.
For local visual management:
- Start the Backend:
uv run run.py(Hosts API on Port 8008) - Start the Frontend:
cd web_app bun run dev - Open
http://localhost:3031(or local IP) in your browser.
Initial view showing feed and batch generation modes.
Input interface for script generation.
The system generating a script based on user input.
Real-time updates during the generation process.
Monitoring individual video generation tasks.
Adding visual components like characters and PIP.
Post-generation insights and analytics.
- ImageMagick Policy Error: If ImageMagick blocks
@symbols (needed for text files), edit/etc/ImageMagick-6/policy.xml(location varies) to allow reading.txtfiles. - Missing Fonts: Ensure the font paths in
backend/config.pycorrectly point to existing.ttffiles in yourdata/fonts/directory.
