A secure, production-safe programmatic video generator that uses AI to create animations from natural language descriptions. Simply describe what you want to see, and AnveshAI generates an MP4 video automatically.
✨ AI-Powered Video Generation
- Generate animations from simple English descriptions
- Support for multiple AI models (Groq Llama, OpenAI GPT-4o, or fallback template)
- All videos automatically stored with full metadata
🎨 Web Interface
- Interactive UI for generating videos with instant preview
- Video gallery showing all generated animations
- Download and delete functionality for stored videos
⚡ Fast & Secure
- No Python code execution—safe DSL (Domain-Specific Language) only
- Strict resource limits prevent abuse
- Encrypted API key management
📊 RESTful API
- Full API for programmatic video generation
- JSON responses with base64-encoded videos
- Video management endpoints
- Open the Generator: Navigate to
/in your browser - Write a Prompt: Describe what animation you want (e.g., "a red ball bouncing across a dark screen")
- Generate: Click the generate button and wait for your video
- View Gallery: Check out all your videos at
/gallery
Generate a video from a prompt:
curl -X POST http://localhost:5000/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "a bouncing red ball",
"duration": 3,
"fps": 24,
"model": "auto"
}'List all generated videos:
curl http://localhost:5000/api/videosDownload a specific video:
curl http://localhost:5000/api/videos/1/download > my_video.mp4Delete a video:
curl -X DELETE http://localhost:5000/api/videos/1auto- Automatically selects the best available modelgroq- Llama 4 Maverick (fastest, requiresGROQ_API_KEY)openai- GPT-4o (requiresOPENAI_API_KEY)fallback- Template-based generation (no API key needed)
For advanced users, you can write animations in AnveshAI's simple language:
BACKGROUND #1a1a2e
FPS 24
DURATION 3
SHAPE CIRCLE ID ball AT 50,180 RADIUS 30 COLOR #FF4444 MOVE TO 550,180 DUR 3 EASE linear
TEXT "Hello" AT 280,50 SIZE 36 COLOR #FFFFFF
Commands:
BACKGROUND #RRGGBB- Set background colorFPS number- Set frames per second (1-24)DURATION seconds- Total animation length (0.5-6 seconds)TEXT "content" AT x,y SIZE pixels COLOR #RRGGBB [MOVE TO x,y DUR seconds]- Add textSHAPE CIRCLE/RECT ID name AT x,y ...- Add shapes with optional movementMOVE object_id TO x,y DUR seconds EASE linear- Move objects
- Python 3.8+
- FastAPI and dependencies (already installed)
Set these secrets in your Replit project:
GROQ_API_KEY- Your Groq API key (for Llama model)OPENAI_API_KEY- Your OpenAI API key (for GPT-4o model)
Both are optional. If neither is set, the system uses template-based generation.
The server starts automatically in the development environment. It listens on port 5000.
For manual startup:
python main.py| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Web UI for video generation |
POST |
/generate |
Generate video from prompt |
POST |
/generate-dsl |
Generate video from DSL code |
GET |
/gallery |
Video gallery page |
GET |
/models |
List available AI models |
GET |
/api/videos |
List all stored videos (JSON) |
GET |
/api/videos/{id}/download |
Download specific video |
DELETE |
/api/videos/{id} |
Delete video from database |
GET |
/health |
Health check |
GET |
/dsl-help |
DSL documentation |
To maintain security and performance:
- Max Resolution: 1280×720
- Max Duration: 6 seconds
- Max FPS: 24
- Max Objects: 50
- Render Timeout: 30 seconds
- Supported Colors: Hex format only (#RRGGBB)
The system follows a security-first pipeline:
Prompt → LLM Translator → DSL Parser → Renderer → Database
OR
DSL → DSL Parser → Renderer → Database
Key Design Principles:
- No Python Execution - LLM outputs DSL, never code
- Strict Validation - All DSL parsed and validated before rendering
- Resource Bounded - Every limit enforced before frame generation
- Persistent Storage - All videos saved in SQLite with metadata
- main.py - FastAPI web server and API endpoints
- video_engine/dsl_parser.py - DSL tokenizer, parser, and validator
- video_engine/renderer.py - PIL-based frame rendering
- video_engine/llm_translator.py - Multi-model LLM integration
- video_engine/database.py - SQLite database operations
- video_engine/pipeline.py - Orchestrates the generation process
- templates/ - Web UI HTML templates
- static/ - CSS and JavaScript for the web interface
✅ Fully Functional
- Web UI with real-time generation
- Multiple AI model support
- Video gallery with management features
- SQLite database persistence
- Both prompt-based and DSL-based generation
Prompt: "A red ball bouncing left to right"
Generated DSL:
BACKGROUND #1a1a2e
FPS 24
DURATION 3
SHAPE CIRCLE ID ball AT 50,180 RADIUS 30 COLOR #FF4444 MOVE TO 550,180 DUR 3 EASE linear
Prompt: "Welcome text appearing in the center"
Generated DSL:
BACKGROUND #ffffff
FPS 24
DURATION 2
TEXT "Welcome" AT 320,180 SIZE 48 COLOR #000000
No models available?
- Ensure API keys are set in secrets (GROQ_API_KEY or OPENAI_API_KEY)
- The fallback model always works without keys
Video not generating?
- Check that the prompt or DSL is valid
- Verify resource limits aren't exceeded
- Check console logs for error messages
Gallery not showing videos?
- Make sure videos were successfully generated
- Check that the SQLite database (videos.db) exists
- Refresh the page
- ✅ All generated videos are stored in a local SQLite database
- ✅ API keys are stored as encrypted secrets (never exposed)
- ✅ No arbitrary code execution—only DSL interpretation
- ✅ All inputs validated and sanitized
- ✅ Resource limits prevent denial-of-service
This project is licensed under the MIT License - see the LICENSE file for details.
For issues, feature requests, or questions, please check the logs or refer to the architecture documentation at /architecture.