Spaces:
Runtime error
Runtime error
File size: 4,891 Bytes
598e1f3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
---
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
1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
2. Click "Create new Space"
3. Choose a name (e.g., "my-video-generator")
4. Select **Gradio** as the SDK
5. Choose hardware (CPU is free, GPU recommended)
6. Click "Create Space"
### 2. Add Your Google API Key
1. Go to Space Settings β Repository secrets
2. Click "New secret"
3. Name: `GOOGLE_API_KEY`
4. Value: Your Google API key (get one from [Google AI Studio](https://aistudio.google.com/app/apikey))
5. 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!
1. In your Space, click "Files and versions"
2. Click "Add file" β "Create a new file"
3. Create a folder called `video_clips`
4. 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
1. Create a folder called `background_music`
2. Upload `.mp3` or `.wav` files
3. Music will be automatically added at low volume
## π How to Use
1. **Enter Text**: Type or paste the text you want converted to speech
2. **Choose Voice**: Select from 5 AI voices
3. **OR Upload Audio**: Upload your own voiceover (instead of TTS)
4. **Add Title** (optional): Enter a title to display at the start
5. **Set Duration**: Only used if no audio is provided
6. **Choose Quality**: High (1080p), Standard (720p), or Preview (480p)
7. **Select Transition**: Choose your preferred transition effect
8. **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_clips` folder
**"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:
1. Check the Space logs for error messages
2. Verify all setup steps are completed
3. Ensure video clips are uploaded
4. Check that API key is correctly set
## π Credits
Built with:
- Gradio
- MoviePy
- OpenAI Whisper
- Google Generative AI
- Pillow
---
Made with β€οΈ using Hugging Face Spaces |