Repo2Reel - GitHub Repository to Video Generator
Transforms a GitHub repository URL into an AI-generated video overview using Flask, LLM services, and ffmpeg.
What this file does
Transforms a GitHub repository URL into an AI-generated video overview using Flask, LLM services, and ffmpeg.
When to use it
- You want to auto-generate video summaries of open-source repos
- You need a modular pipeline for repo analysis, script writing, and video assembly
- You are building a demo or MVP that converts codebases into narrated walkthroughs
- You want to experiment with multiple LLM providers in a single app
Assumes this stack
Repo2Reel - GitHub Repository to Video Generator
Overview
Repo2Reel is a Flask-based web application that transforms GitHub repositories into AI-generated video overviews. The application analyzes repository content, generates scripts using LLM services, creates visual content, and produces final videos with optional audio narration.
User Preferences
Preferred communication style: Simple, everyday language.
System Architecture
Frontend Architecture
- Framework: HTML templates with Bootstrap 5 dark theme
- Styling: Custom CSS with gradient backgrounds and card-based layout
- JavaScript: Vanilla JS for form validation, real-time URL validation, and UI enhancements
- Responsive Design: Mobile-first approach using Bootstrap grid system
Backend Architecture
- Framework: Flask with ProxyFix middleware for reverse proxy support
- Session Management: Flask sessions with configurable secret key
- File Handling: Temporary file management with automatic cleanup
- Error Handling: Comprehensive logging and graceful error recovery
- Processing Pipeline: Modular design with separate processors for each stage
Key Components
Core Processing Modules
-
GraphRAGProcessor (
graph_rag.py)- Analyzes GitHub repositories using gitingest
- Downloads and processes repository content
- Extracts structured information about technologies, features, and codebase
-
LLMProcessor (
llm_utils.py)- Handles text generation using multiple LLM providers
- Supports Groq, OpenAI, Anthropic, Together, and HuggingFace APIs
- Fallback system with priority ordering (Groq preferred for free/fast generation)
-
PromptGenerator (
prompt_generator.py)- Creates optimized prompts for video script generation
- Structures prompts with timing sections and content requirements
- Formats repository analysis data for LLM consumption
-
VideoGenerator (
generate_video.py)- Creates video content using CPU-optimized processing
- Generates visual scenes based on script and repository analysis
- Uses PIL for image generation and ffmpeg for video compilation
-
AudioGenerator (
generate_audio.py)- Converts text to speech using platform-specific TTS engines
- Supports Windows SAPI, macOS say, Linux espeak/festival
- CPU-optimized audio generation
-
AudioVideoMerger (
merge_av.py)- Combines audio and video using ffmpeg
- Includes fallback mechanisms for failed merges
- Validates output file integrity
Web Application Structure
- Main Application (
app.py): Flask app with route handlers and status management - Entry Point (
main.py): Application startup with debug configuration - Static Assets: CSS styling and JavaScript for frontend functionality
- Templates: HTML templates for index, processing status, and results pages
Data Flow
- User Input: GitHub repository URL submitted through web form
- Repository Analysis: GraphRAGProcessor downloads and analyzes repository content
- Script Generation: LLMProcessor creates video script using repository analysis
- Content Creation:
- VideoGenerator creates visual content
- AudioGenerator creates narration (optional)
- Final Assembly: AudioVideoMerger combines audio and video
- Delivery: User downloads final MP4 file
External Dependencies
Required Services
- LLM Providers: Groq (preferred), OpenAI, Anthropic, Together, HuggingFace
- System Dependencies: ffmpeg for video processing, platform-specific TTS engines
Optional Integrations
- GitHub API: For enhanced repository metadata (not currently implemented)
- Cloud Storage: For persistent file storage (currently uses temporary files)
Environment Variables
SESSION_SECRET: Flask session encryption keyOPENAI_API_KEY: OpenAI API accessGROQ_API_KEY: Groq API access (preferred)ANTHROPIC_API_KEY: Anthropic API accessTOGETHER_API_KEY: Together API accessHUGGINGFACE_API_KEY: HuggingFace API access
Deployment Strategy
Current Configuration
- Local Development: Flask development server on port 5000
- Production Ready: ProxyFix middleware for reverse proxy deployment
- File Management: Automatic cleanup of temporary files older than 1-24 hours
- Session Handling: Unique session IDs for concurrent processing
Scalability Considerations
- CPU-optimized processing for cost-effective deployment
- Modular design allows for easy service separation
- Temporary file cleanup prevents storage bloat
- Multiple LLM provider support for reliability and cost optimization
Security Features
- Input validation for GitHub URLs
- Secure session management
- Environment-based configuration
- Graceful error handling without information disclosure
What's inside
6 core processors, 4 web pages, 2 entry points, 7 environment variables, 1 data flow diagram
Change this for your project
- Replace
Sweatha1052004/repo2reelwith your own GitHub repository name - Replace
SESSION_SECRETwith your own secret key - Replace each
*_API_KEYenvironment variable with your own API keys
Where it goes
Save in docs/ or the repository root. Gives agents and new contributors a map of the codebase.
Worth borrowing
- Fallback chain across multiple LLM providers so the app works even if one API is down
- CPU-optimized video generation using PIL and ffmpeg avoids GPU dependency
- Automatic cleanup of temporary files older than 1-24 hours prevents disk bloat
Related Documents
Design Document: BharatSeva AI
Describes a 10-agent AWS system that helps India's informal workers access government schemes via voice-first, serverless architecture.
OpenClaw Enterprise Transformation Plan
Transforms a single-user AI agent into a dual-mode platform supporting both viral open-source and Fortune 500 enterprise deployments through phased security, IAM, audit, multi-tenancy, and Kubernetes features.
Qwen Image and Edit: Open-sourcing and Local GGUF Generations with Lightning
Documents the Qwen-Image and Qwen-Image-Edit models, covering architecture, training, benchmarks, ComfyUI setup, and prompting techniques for local GGUF deployment.
University of Guelph Rocketry Club - Complete Tech Stack
Documents the full tech stack of a university rocketry club website with AI chatbot, member management, and project showcases.