File size: 3,653 Bytes
44cb2cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---

title: AI Video Editor V2
emoji: πŸ€–
colorFrom: purple
colorTo: blue
sdk: docker
pinned: false
license: mit
---


# πŸ€– AI Video Editor V2

Transform any reference reel into your personalized video using AI-powered code generation.

## 🎬 How It Works

1. **Upload** your reference video and photos
2. **AI Analysis** - Gemini analyzes video structure, transitions, and timing
3. **Generate** - Review each 3-second segment with human-in-the-loop
4. **Download** - Get your final professional video

## πŸ”‘ Getting Started

### 1. Get Your Free Gemini API Key

Visit: [https://aistudio.google.com/apikey](https://aistudio.google.com/apikey)

**Free Tier Limits:**
- βœ… 10 requests/minute
- βœ… 250 requests/day
- βœ… 250K tokens/minute
- βœ… Completely FREE - No credit card required

### 2. Use the App

1. Enter your API key in the sidebar
2. Upload a reference video (10-60 seconds)
3. Upload 5-20 photos
4. Let AI analyze and generate segments
5. Approve or regenerate each segment
6. Download your final video

## ✨ Features

- πŸŽ₯ **Video Analysis**: AI understands transitions, effects, timing
- πŸ€– **Code Generation**: Gemini writes MoviePy code for each segment
- πŸ‘€ **Human-in-the-Loop**: Review and approve each 3-second segment
- πŸ”„ **Iterative Refinement**: Provide feedback to regenerate
- πŸ“Ή **Professional Output**: 1080x1920 (9:16) portrait videos

## πŸ› οΈ Tech Stack

- **Frontend**: Streamlit
- **AI Model**: Google Gemini 2.5 Flash
- **Video Processing**: MoviePy
- **Image Processing**: Pillow, OpenCV

## πŸ“Š API Usage

With 250 requests/day on free tier:
- Video analysis: ~5-10 requests
- Segment generation: ~20-30 segments
- Regenerations: ~10-15 retries
- **Total: ~50-70 requests per video**
- **Can create 3-4 complete videos per day**

## πŸ’‘ Tips

- Use high-quality photos (1080x1920 ideal)
- Keep reference videos under 60 seconds
- Provide specific feedback for better regenerations
- Approve segments progressively to save API calls

## πŸ”’ Privacy

- Your API key is never stored
- All processing happens in your session
- Files are temporary and auto-deleted

## πŸ“ License

MIT License - Free to use and modify!

## 🀝 Support

Having issues? Check that:
- Your API key is valid
- Reference video is under 100MB
- Photos are in JPG/PNG format
- You're within the free tier limits

## πŸ“¦ File Structure

```

velocity-video-editor-v2/

β”œβ”€β”€ app.py                    # Main Streamlit application

β”œβ”€β”€ ai_video_analyzer.py      # Video analysis with Gemini

β”œβ”€β”€ code_generator.py         # AI code generation

β”œβ”€β”€ video_executor.py         # Safe code execution

β”œβ”€β”€ requirements.txt          # Python dependencies

β”œβ”€β”€ Dockerfile               # Container configuration

β”œβ”€β”€ README.md                # This file

└── .streamlit/

    └── config.toml          # Streamlit configuration

```

## πŸš€ Local Development

```bash

# Install dependencies

pip install -r requirements.txt



# Run the app

streamlit run app.py



# Open browser at http://localhost:8501

```

## 🐳 Docker Deployment

```bash

# Build Docker image

docker build -t ai-video-editor .



# Run container

docker run -p 7860:7860 ai-video-editor

```

## 🌐 Hugging Face Spaces Deployment

1. Create new Space with Docker SDK
2. Upload all files
3. HF automatically builds and deploys
4. Share with users!

---

Made with ❀️ using Gemini 2.5 Flash

**Creator**: PPV Productions  
**Version**: 2.0  
**Last Updated**: February 2026