🎬 AI-Powered Text-to-Video Generator
Transform a simple text prompt into a captivating video with AI-generated story, images, and audio.
This project automates the creation of engaging videos from text prompts. It uses OpenAI's GPT-3.5 to generate a story, OpenAI's Image API to visualize key moments, and combines these with audio narration into a final video.
text-to-video-generator.mp4
• 📝 Story Generation: OpenAI's GPT-3.5 crafts a narrative from your prompt.
• 🖼️ Image Creation: OpenAI's Image API generates visuals for story segments.
• 🔊 Audio Narration: Text-to-speech conversion (macOS say command).
• 🎥 Video Compilation: MoviePy combines images, captions, and audio.
• 🌐 Web Interface: Streamlit provides an easy-to-use web app.
• Python: Core programming language.
• OpenAI API:
• gpt-3.5-turbo-instruct for story generation.
• Image.create for image generation.
• MoviePy: Video editing library.
• FFmpeg: Audio conversion (AIFF to MP3).
• Pillow (PIL): Image processing.
• NumPy: Array operations for image handling.
• Streamlit: Web app framework.
1.app.py: Streamlit web interface.
•User enters a prompt.
•Calls text_generator.py and video_generator.py.
•Displays generated text and video.
2.text_generator.py: Takes a prompt, generates a story using GPT-3.5.
3.video_generator.py:
• Splits story into max 10 segments.
• For each segment:
• OpenAI Image API creates an image.
• say command narrates text (AIFF).
• FFmpeg converts AIFF to MP3.
• MoviePy assembles images, captions, and audio.
- Clone this repository.
- Install Python dependencies:
pip install -r requirements.txt - Install system dependencies:
macOS: brew install ffmpeg
Ubuntu/Debian: sudo apt-get install ffmpeg
Windows: Download from FFmpeg, add to PATH. - Add your OpenAI API key
- Run the Streamlit app:
streamlit run app.py
- open displayed URL and enter the prompt
Run: python text_generator.py
python video_generator.py
• app.py: Streamlit web interface.
• text_generator.py: Story generation.
• video_generator.py: Image, audio, and video creation.
• .env: Secure OpenAI API key storage.
• Full-stack AI: OpenAI for text and images, system tools for audio.
• Web Dev with AI: Integrating Streamlit for a user-friendly AI interface.
• Security: Using python-dotenv for safe API key management.
• Media Manipulation: Handling text, images, and audio with Python.
Contributions welcome! Fork and submit a PR.