Package Exports
- mathvideo
- mathvideo/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mathvideo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
MathVideo
🎬 Convert strings to videos using Groq API and Manim
MathVideo is an npm package that takes a string input and converts it into an animated video using the Groq API (with Llama 2 70B model) and the Manim animation library.
Features
- 🤖 AI-powered video generation using Groq API
- 🎥 Beautiful animations created with Manim
- 🔐 Secure API key management
- 📁 Automatic output organization with timestamps
- 🖥️ Cross-platform compatibility
Prerequisites
Before using MathVideo, you need to have the following installed:
- Node.js (v14 or higher)
- Python (v3.7 or higher)
- Manim library
Installing Manim
pip install manimInstallation
Global Installation (Recommended)
npm install -g mathvideoLocal Installation
npm install mathvideoUsage
First Time Setup
When you run MathVideo for the first time, it will guide you through setting up your Groq API key:
If you don't have a Groq API key:
- The tool will guide you to https://console.groq.com/
- Create a new account or log in
- Navigate to the API Keys section
- Create a new API key
- Copy and paste the API key when prompted
If you already have a Groq API key:
- Simply paste your existing API key when prompted
Your API key will be securely stored for future use.
Creating Videos
mathvideo "Your string here"Examples
# Create a video about mathematics
mathvideo "The beauty of calculus and derivatives"
# Create a video about physics
mathvideo "Einstein's theory of relativity explained"
# Create a video about programming
mathvideo "How to build a web application with React"Output
Videos are automatically saved in the output folder with timestamps:
output/
├── 2024-01-15T14-30-25.mp4
├── 2024-01-15T14-35-12.mp4
└── ...How It Works
- Input Processing: Your string is sent to the Groq API
- AI Generation: The Llama 2 70B model generates Manim Python code
- Video Creation: The generated code is executed to create the video
- Output: The final video is saved with a timestamp
Configuration
Your Groq API key is stored in:
- Windows:
%USERPROFILE%\.mathvideo\config.json - macOS/Linux:
~/.mathvideo/config.json
Troubleshooting
Common Issues
"Python is not installed"
- Install Python from https://python.org
- Make sure Python is in your system PATH
"Manim is not installed"
- Run:
pip install manim
- Run:
"Invalid Groq API key"
- Check your API key at https://console.groq.com/
- Make sure you have sufficient credits
"Rate limit exceeded"
- Wait a few minutes and try again
- Check your Groq API usage limits
Getting Help
If you encounter issues:
- Check that Python and Manim are properly installed
- Verify your Groq API key is valid
- Ensure you have sufficient Groq API credits
- Check the console output for detailed error messages
API Key Management
To change your Groq API key:
- Delete the config file:
~/.mathvideo/config.json - Run MathVideo again to set up a new API key
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For support, please open an issue on the GitHub repository.