Spaces:
Runtime error
Runtime error
A newer version of the Gradio SDK is available:
6.3.0
metadata
title: AI Video Generator
emoji: π¬
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.0.0
app_file: app.py
pinned: false
π¬ AI Video Generator
An AI-powered video generator that creates engaging videos with text-to-speech voiceovers, animated subtitles, and professional transitions.
β¨ Features
- Text-to-Speech: Convert text to natural-sounding speech using Google's Gemini TTS
- Multiple Voices: Choose from 5 different AI voices
- Audio Upload: Upload your own voiceover audio
- Automatic Subtitles: Word-by-word highlighted subtitles generated automatically
- Video Transitions: Multiple transition effects (Smooth Blend, Ken Burns Zoom, Whip Pan, etc.)
- Background Music: Add background music to your videos
- Custom Titles: Add animated title overlays
π Setup Instructions
1. Initial Setup on Hugging Face
- Go to Hugging Face Spaces
- Click "Create new Space"
- Choose a name (e.g., "my-video-generator")
- Select Gradio as the SDK
- Choose hardware (CPU is free, GPU recommended)
- Click "Create Space"
2. Add Your Google API Key
- Go to Space Settings β Repository secrets
- Click "New secret"
- Name:
GOOGLE_API_KEY - Value: Your Google API key (get one from Google AI Studio)
- Click "Add"
3. Upload Required Files
Upload these files to your Space:
app.py(main application)requirements.txt(Python dependencies)packages.txt(system dependencies)README.md(this file)
4. Add Video Clips
IMPORTANT: You need to add video clips for the generator to work!
- In your Space, click "Files and versions"
- Click "Add file" β "Create a new file"
- Create a folder called
video_clips - Upload at least 5-10 video clips (
.mp4,.avi,.mkv, or.mov)
Tips for video clips:
- Use clips that are 5-30 seconds long
- HD quality (1080p or 720p) works best
- Nature, city, abstract, or stock footage works great
- More clips = more variety in your videos
5. Optional: Add Background Music
- Create a folder called
background_music - Upload
.mp3or.wavfiles - Music will be automatically added at low volume
π How to Use
- Enter Text: Type or paste the text you want converted to speech
- Choose Voice: Select from 5 AI voices
- OR Upload Audio: Upload your own voiceover (instead of TTS)
- Add Title (optional): Enter a title to display at the start
- Set Duration: Only used if no audio is provided
- Choose Quality: High (1080p), Standard (720p), or Preview (480p)
- Select Transition: Choose your preferred transition effect
- Click Generate: Wait for your video to be created!
π₯ Output
The generated video will include:
- Your selected video clips with transitions
- Voiceover audio (TTS or uploaded)
- Animated word-by-word subtitles
- Optional title overlay
- Optional background music
π§ Troubleshooting
"Video clips folder not found"
- Make sure you've uploaded videos to the
video_clipsfolder
"TTS failed"
- Check that your Google API key is correctly set in Space settings
- Verify the API key has the Gemini API enabled
Slow generation
- Consider upgrading to GPU hardware in Space settings
- Reduce video quality to "Preview" for faster processing
Out of memory
- Use fewer/shorter video clips
- Reduce video quality setting
- Upgrade to larger hardware
π File Structure
your-space/
βββ app.py # Main application
βββ requirements.txt # Python dependencies
βββ packages.txt # System dependencies
βββ README.md # This file
βββ video_clips/ # Your video files (REQUIRED)
β βββ clip1.mp4
β βββ clip2.mp4
β βββ ...
βββ background_music/ # Optional music files
β βββ music.mp3
βββ voice_over/ # Generated voiceovers (auto-created)
βββ exports/ # Generated videos (auto-created)
π¨ Customization
You can customize the app by editing app.py:
- Change subtitle styling
- Modify transition effects
- Adjust video processing settings
- Add new features
π License
This project uses various open-source libraries. Please ensure compliance with their licenses.
π Support
If you encounter issues:
- Check the Space logs for error messages
- Verify all setup steps are completed
- Ensure video clips are uploaded
- Check that API key is correctly set
π Credits
Built with:
- Gradio
- MoviePy
- OpenAI Whisper
- Google Generative AI
- Pillow
Made with β€οΈ using Hugging Face Spaces