free-short-video 5.1.7 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -481
- package/core/api/agnes_chat.py +2 -3
- package/core/api/agnes_image.py +5 -6
- package/core/api/agnes_models.py +3 -6
- package/core/api/agnes_video.py +7 -9
- package/core/compositor/concatenator.py +1 -1
- package/core/config.py +47 -0
- package/core/pipelines/__init__.py +3 -3
- package/core/pipelines/creative_video.py +13 -13
- package/core/task_manager.py +2 -2
- package/package.json +1 -1
- package/server.py +25 -1
- package/static/index.html +326 -1
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ free-short-video
|
|
|
20
20
|
[](https://github.com/lcy362/agnes-video-generator/blob/main/LICENSE)
|
|
21
21
|
[](https://www.python.org/)
|
|
22
22
|
[](https://video.lichuanyang.top)
|
|
23
|
+
[](https://hub.docker.com/r/lcy362/free-short-video)
|
|
24
|
+
[](https://www.npmjs.com/package/free-short-video)
|
|
23
25
|
|
|
24
26
|
> **Completely free AI video generator** — Built on Agnes AI's free models, no subscription, no high-end GPU, no usage limits. Type in a text idea and automatically generate multi-scene AI videos with narration and subtitles. Supports text-to-video, image-to-video, keyframes animation, digital anchor, and more. All AI compute runs in the cloud — a regular laptop is all you need. **[Try it online →](https://video.lichuanyang.top)**
|
|
25
27
|
|
|
@@ -31,6 +33,13 @@ free-short-video
|
|
|
31
33
|
|
|
32
34
|
> **🖥️ Try it now — no install needed:** Visit [video.lichuanyang.top](https://video.lichuanyang.top) and experience **Simple Video** mode directly in your browser. Just enter a prompt and generate a free AI video instantly.
|
|
33
35
|
|
|
36
|
+
## 🚀 Two Ways to Use — Both Completely Free
|
|
37
|
+
|
|
38
|
+
| Project | Run Where | Features | Link |
|
|
39
|
+
|---------|-----------|----------|------|
|
|
40
|
+
| **[Agnes Video Generator](https://github.com/lcy362/agnes-video-generator)** (this project) | **Download & run locally** | **More powerful** — TTS narration, auto subtitles, digital anchor, image-to-video, keyframes animation, manuscript-to-video, checkpoint resume & more | [GitHub](https://github.com/lcy362/agnes-video-generator) |
|
|
41
|
+
| **[FreeShortVideoStudio](https://github.com/lcy362/free-short-video-studio)** | **Fully online, in the browser** | Lightweight, zero install — no setup at all, **features under active construction** | [video.lichuanyang.top/studio](https://video.lichuanyang.top/studio) · [GitHub](https://github.com/lcy362/free-short-video-studio) |
|
|
42
|
+
|
|
34
43
|
## ⭐ Support & Contribute
|
|
35
44
|
|
|
36
45
|
If you find this project useful, please **star the [GitHub repository](https://github.com/lcy362/agnes-video-generator)** ⭐ — your support helps more people discover this free and open-source AI video generator.
|
|
@@ -96,487 +105,14 @@ To be honest, Agnes's video model isn't perfect yet. The generated frames are so
|
|
|
96
105
|
| **Watermark** | No watermark | Built-in watermark | Built-in watermark | C2PA metadata | Built-in watermark |
|
|
97
106
|
| **Usage Limit** | No limit (16 req/min rate limit) | Billed by compute | Billed by generation | Billed by generation | Billed by generation |
|
|
98
107
|
|
|
99
|
-
##
|
|
100
|
-
|
|
101
|
-
### 🎬 Multiple Creation Modes
|
|
102
|
-
|
|
103
|
-
| Mode | Description | Best For |
|
|
104
|
-
|------|-------------|----------|
|
|
105
|
-
| **Simple Video** | Single prompt → single AI video. Full control over all parameters (generation mode, duration, resolution, seed, negative prompt). Also supports image-to-video and keyframes mode. | Quick single-clip AI video |
|
|
106
|
-
| **Creative Video** | Full AI pipeline: idea → story → script → character reference → multi-scene video → narration → subtitles → final output. 10-step pipeline, fully automated. | Storytelling, creative videos |
|
|
107
|
-
| **Manuscript Video** | Paste a long article or script → auto-split by reading duration → per-segment AI video → unified TTS narration + subtitle overlay → final output. 5-step pipeline. | Explainers, course content, vlogs |
|
|
108
|
-
| **Digital Anchor** | AI-generated digital anchor (or upload custom image) → dynamic anchor clip → TTS narration → subtitle positioning → looped concatenation. Optional reference image for appearance consistency. | Virtual anchors, product presentations, news broadcasts |
|
|
109
|
-
|
|
110
|
-
### 🆓 Completely Free AI Model Chain
|
|
111
|
-
|
|
112
|
-
All core AI capabilities are **completely free** — no trial period, no watermarks, no token limits:
|
|
113
|
-
|
|
114
|
-
| Capability | Model | Cost |
|
|
115
|
-
|-----------|-------|------|
|
|
116
|
-
| Text / Script Generation | `agnes-2.0-flash` | Free |
|
|
117
|
-
| Image Generation | `agnes-image-2.1-flash` | Free |
|
|
118
|
-
| Video Generation | `agnes-video-v2.0` | Free |
|
|
119
|
-
| Text-to-Speech Narration | Edge TTS (Microsoft) | Free, no extra API key needed |
|
|
120
|
-
|
|
121
|
-
All AI API calls share a global token bucket rate limiter (16 requests/min), with automatic retries and exponential backoff to ensure stable operation.
|
|
122
|
-
|
|
123
|
-
### 🎙️ AI Narration & Smart Subtitles
|
|
124
|
-
|
|
125
|
-
Both Creative Video and Manuscript Video support:
|
|
126
|
-
|
|
127
|
-
- **Free TTS narration**: Based on Microsoft Edge TTS, offering 4 Chinese voice roles (gentle female, steady male, lively female, young male) with adjustable speech rate (-30% to +30%)
|
|
128
|
-
- **Word-level fine-grained subtitles**: SRT subtitles generated from TTS word-level timestamps, one entry every 2-3 seconds, with precise audio-video sync
|
|
129
|
-
- **Multi-line auto-wrapping**: Long subtitle text is intelligently split into two lines, preferring punctuation break points to prevent screen overflow
|
|
130
|
-
- **Fully configurable subtitle style**: Font, color, size, position (top/bottom), stroke, and semi-transparent background
|
|
131
|
-
- **Audio-video sync strategy**: All video clips are concatenated first, then audio and subtitles are overlaid as a whole, avoiding cumulative errors from per-segment overlay. TTS output is automatically amplified 2.5× to compensate for Edge TTS's low default volume
|
|
132
|
-
|
|
133
|
-
### 🎨 Flexible Creative Controls
|
|
134
|
-
|
|
135
|
-
- **Custom reference images** — Upload character or scene reference images to maintain visual consistency across scenes
|
|
136
|
-
- **Custom end frames** — Specify end frame images per scene for precise visual transition control
|
|
137
|
-
- **Image-to-image end frames** — Auto-generate scene end frames via img2img from your reference image
|
|
138
|
-
- **Three video chaining modes** — `keyframes` (first+last frame interpolation, recommended) / `ti2vid` (inter-scene transition frames) / `none` (independent scenes)
|
|
139
|
-
- **Multiple resolutions** — Portrait 9:16 (768×1152), Landscape 16:9 (1152×768), Square 1:1 (1024×1024)
|
|
140
|
-
- **Flexible duration** — Custom scene duration
|
|
141
|
-
- **Smart manuscript splitting** — Splits by period/question mark/exclamation mark, greedily merges into 5-12 second segments based on reading speed (~4 chars/sec), preserves long sentences, auto-merges short sentences forward
|
|
142
|
-
|
|
143
|
-
### 🔧 Production-Grade Reliability
|
|
144
|
-
|
|
145
|
-
- **Checkpoint resume** — Automatically resumes from the last checkpoint after interruption; state is persisted after each step, no duplicate API calls
|
|
146
|
-
- **Task management** — Create, view, resume, and stop tasks from the Web UI
|
|
147
|
-
- **Real-time progress** — WebSocket pushes per-step generation progress (step name, status, percentage, current/total)
|
|
148
|
-
- **Built-in CJK fonts** — Project ships with Chinese fonts, no garbled characters in subtitle rendering
|
|
149
|
-
|
|
150
|
-
### 🤖 AI Agent Friendly
|
|
151
|
-
|
|
152
|
-
Designed specifically for AI coding assistants (Claude, Cursor, QoderWork, etc.), with a complete `AGENTS.md` deployment guide. AI Agents can automatically:
|
|
153
|
-
|
|
154
|
-
- Check environment (Python 3.10+, ffmpeg)
|
|
155
|
-
- Install dependencies and start the server
|
|
156
|
-
- Configure API key
|
|
157
|
-
- Run 4-layer deployment verification (connectivity → static analysis → endpoint testing → subtitle feature)
|
|
158
|
-
- Execute 10-scenario regression test suite
|
|
159
|
-
|
|
160
|
-
### 🌐 Multilingual Web UI
|
|
161
|
-
|
|
162
|
-
One-click launch, operate entirely in the browser. Interface available in **13 languages**: 中文, English, Deutsch, Français, Nederlands, Español, Português, Italiano, Русский, 日本語, 한국어, Bahasa Melayu, Bahasa Indonesia.
|
|
163
|
-
|
|
164
|
-
## 🚀 Quick Start
|
|
165
|
-
|
|
166
|
-
### Prerequisites
|
|
167
|
-
|
|
168
|
-
- Python 3.10+
|
|
169
|
-
- ffmpeg — required only for **manual setup** (Option A); the Docker (Option B) and npm (Option C) options bundle ffmpeg automatically, so no system ffmpeg install is needed there.
|
|
170
|
-
|
|
171
|
-
That's it. No GPU, no large RAM, a regular laptop is all you need.
|
|
172
|
-
|
|
173
|
-
### Option A: Manual Setup
|
|
174
|
-
|
|
175
|
-
**Step 1 — Clone & Launch**
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
git clone https://github.com/lcy362/agnes-video-generator.git
|
|
179
|
-
cd agnes-video-generator
|
|
180
|
-
./start.sh
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
The script automatically creates a virtual environment, installs dependencies, and opens `http://localhost:8765` in your browser. You can also start manually:
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
python3 -m venv .venv
|
|
187
|
-
.venv/bin/pip install -r requirements.txt
|
|
188
|
-
.venv/bin/python server.py
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
**Step 2 — Configure API Key**
|
|
192
|
-
|
|
193
|
-
Get a free API key from [Agnes AI](https://platform.agnes-ai.com), then choose one of two ways:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
# Way 1: Environment variable
|
|
197
|
-
export AGNES_API_KEY="your-api-key"
|
|
198
|
-
|
|
199
|
-
# Way 2: Via API (same as entering it in the Web UI)
|
|
200
|
-
curl -X POST http://localhost:8765/api/config \
|
|
201
|
-
-H "Content-Type: application/json" \
|
|
202
|
-
-d '{"api_key": "your-api-key"}'
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**Step 3 — Create Your First Video**
|
|
206
|
-
|
|
207
|
-
Open `http://localhost:8765`, choose a video mode (Simple / Creative / Manuscript / Anchor), enter your idea, and click "Start Generating".
|
|
208
|
-
|
|
209
|
-
### Option B: Docker (No Python/FFmpeg Required)
|
|
210
|
-
|
|
211
|
-
Pre-built multi-arch images (`linux/amd64`, `linux/arm64`) are published to both **GitHub Container Registry (GHCR)** and **Docker Hub** on every release.
|
|
212
|
-
|
|
213
|
-
**Pull & Run**
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
# GHCR
|
|
217
|
-
docker run -d -p 8765:8765 \
|
|
218
|
-
-e AGNES_API_KEY=<your-key> \
|
|
219
|
-
-v ~/agnes-data/working:/app/.working_dir \
|
|
220
|
-
-v ~/agnes-data/config:/app/.agnes_config \
|
|
221
|
-
ghcr.io/lcy362/free-short-video:latest
|
|
222
|
-
|
|
223
|
-
# Docker Hub
|
|
224
|
-
docker run -d -p 8765:8765 \
|
|
225
|
-
-e AGNES_API_KEY=<your-key> \
|
|
226
|
-
-v ~/agnes-data/working:/app/.working_dir \
|
|
227
|
-
-v ~/agnes-data/config:/app/.agnes_config \
|
|
228
|
-
lcy362/free-short-video:latest
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
Then open `http://localhost:8765`.
|
|
232
|
-
|
|
233
|
-
**Data Persistence:** The app writes videos, uploads, and settings inside the container (`/app/.working_dir`, `/app/.agnes_config`). Mount them to your host so outputs survive container recreation and are accessible from your local filesystem. Your generated videos will be at `~/agnes-data/working/` on your machine.
|
|
234
|
-
|
|
235
|
-
Or use `docker compose` with the included `docker-compose.yml`:
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
git clone https://github.com/lcy362/agnes-video-generator.git
|
|
239
|
-
cd agnes-video-generator
|
|
240
|
-
AGNES_API_KEY=<your-key> docker compose up -d
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### Option C: npm (One Command)
|
|
244
|
-
|
|
245
|
-
If you have **Node.js 18+** and **Python 3.10+** installed, the whole service ships as an npm package — no cloning, no manual venv:
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
# Run directly without installing
|
|
249
|
-
npx free-short-video
|
|
250
|
-
|
|
251
|
-
# Or install globally, then run
|
|
252
|
-
npm install -g free-short-video
|
|
253
|
-
free-short-video # short alias: fsv
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
On first run the launcher automatically creates a local virtual environment, installs Python dependencies, wires up a bundled `ffmpeg` (via `imageio-ffmpeg`, so no system ffmpeg needed), starts the server on `http://localhost:8765`, and opens your browser. Pass your key through the environment or set it later in the Web UI:
|
|
257
|
-
|
|
258
|
-
```bash
|
|
259
|
-
AGNES_API_KEY=<your-key> npx free-short-video
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
Options: `--port <n>`, `--host <h>` (use `0.0.0.0` for LAN access), `--no-open`.
|
|
263
|
-
|
|
264
|
-
#### ffmpeg: bundled by default, or install your own
|
|
265
|
-
|
|
266
|
-
With the npm package you normally **don't need to install ffmpeg yourself** — the launcher (`bin/cli.js`) automatically installs `imageio-ffmpeg` (a static ffmpeg binary, now an explicit dependency in `requirements.txt`) into the local venv and prepends its directory to `PATH`, so every `ffmpeg` call inside the Python service resolves to the bundled binary. This works out of the box on macOS, Linux, and Windows.
|
|
267
|
-
|
|
268
|
-
**If you prefer to install ffmpeg on your system** (recommended for production / maximum stability — your system ffmpeg takes precedence over the bundled one because it appears earlier on `PATH`):
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
# macOS
|
|
272
|
-
brew install ffmpeg
|
|
273
|
-
|
|
274
|
-
# Ubuntu / Debian
|
|
275
|
-
sudo apt update && sudo apt install ffmpeg
|
|
276
|
-
|
|
277
|
-
# CentOS / RHEL (requires RPM Fusion)
|
|
278
|
-
sudo dnf install ffmpeg
|
|
279
|
-
|
|
280
|
-
# Windows (Chocolatey)
|
|
281
|
-
choco install ffmpeg
|
|
282
|
-
|
|
283
|
-
# Windows (Scoop)
|
|
284
|
-
scoop install ffmpeg
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
Or download a build from <https://ffmpeg.org/download.html> and add it to your `PATH`. Verify with:
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
ffmpeg -version
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
**Risks if you do NOT install a system ffmpeg (i.e. rely solely on the bundled `imageio-ffmpeg`):**
|
|
294
|
-
|
|
295
|
-
- **Platform / architecture support** — `imageio-ffmpeg` ships pre-built binaries only for common platforms (macOS x86_64/arm64, Linux x86_64/arm64, Windows x64). On niche or very old architectures a matching wheel may not exist, and the bundled binary would be missing.
|
|
296
|
-
- **Single source of truth** — all ffmpeg capability comes from that one static binary. If its install/extract fails (disk permissions, corruption), the failure only surfaces **when you generate a video**, not at server startup — the error is a low-level `FileNotFoundError: 'ffmpeg'`, which is harder to diagnose than a startup check.
|
|
297
|
-
- **Pinned version** — the bundled ffmpeg is locked to whatever version `imageio-ffmpeg` ships (e.g. ffmpeg 7.1); you can't easily upgrade it on your own.
|
|
298
|
-
- **Mitigation** — for production or stability-critical use, install a system ffmpeg as shown above; the bundled one then acts only as a fallback.
|
|
299
|
-
|
|
300
|
-
### Option D: AI Agent Assisted Setup
|
|
301
|
-
|
|
302
|
-
This project is designed for AI coding assistants. First, download the code and prepare your API key:
|
|
303
|
-
|
|
304
|
-
```bash
|
|
305
|
-
git clone https://github.com/lcy362/agnes-video-generator.git
|
|
306
|
-
cd agnes-video-generator
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
Then tell your agent:
|
|
310
|
-
|
|
311
|
-
> "Read the AGENTS.md in this project, install dependencies, configure the API key `<your-key>`, and start the server."
|
|
312
|
-
|
|
313
|
-
The agent will read `AGENTS.md` (a comprehensive deployment guide) and handle: environment checks (Python 3.10+, ffmpeg), `pip install`, server launch, and API key configuration. After startup, you can also ask the agent to verify the deployment:
|
|
314
|
-
|
|
315
|
-
> "Run the deployment verification checks."
|
|
316
|
-
|
|
317
|
-
The agent will execute the 4-layer checklist from `AGENTS.md` (connectivity → static analysis → endpoint testing → subtitle feature) and report results.
|
|
318
|
-
|
|
319
|
-
## 📖 Usage
|
|
320
|
-
|
|
321
|
-
### 1. Configure API Key
|
|
322
|
-
|
|
323
|
-
Enter your free [Agnes AI](https://platform.agnes-ai.com) API key at the top of the page and save it. Or set it via environment variable:
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
export AGNES_API_KEY="your-api-key"
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### 2. Choose a Video Mode
|
|
330
|
-
|
|
331
|
-
#### Simple Video
|
|
332
|
-
|
|
333
|
-
Quick single-clip generation with full parameter control:
|
|
334
|
-
|
|
335
|
-
| Field | Description |
|
|
336
|
-
|-------|-------------|
|
|
337
|
-
| Prompt | Describe the AI video scene in natural language |
|
|
338
|
-
| Generation Mode | Text-to-Video / Image-to-Video / Text+Image / Keyframes |
|
|
339
|
-
| Resolution | Portrait 9:16 / Landscape 16:9 / Square 1:1 |
|
|
340
|
-
| Duration | 5s / 10s / 15s / 18s / 20s |
|
|
341
|
-
| Reference Image | Optional upload for image-to-video modes |
|
|
342
|
-
| End Frame Image | Optional end frame for keyframes mode |
|
|
343
|
-
|
|
344
|
-
#### Creative Video
|
|
345
|
-
|
|
346
|
-
AI-driven multi-scene storytelling:
|
|
347
|
-
|
|
348
|
-
| Field | Description | Required |
|
|
349
|
-
|-------|-------------|----------|
|
|
350
|
-
| Idea | Describe your AI video concept | Yes |
|
|
351
|
-
| User Requirements | Scene count, duration, and other constraints | - |
|
|
352
|
-
| Visual Style | Cinematic realism, anime, cyberpunk, etc. | - |
|
|
353
|
-
| Chaining Mode | keyframes (recommended) / ti2vid / none | - |
|
|
354
|
-
| Narration | Enable/disable TTS narration, choose voice and speed | - |
|
|
355
|
-
| Subtitle Style | Font, color, size, position, stroke, background | - |
|
|
356
|
-
| Reference Image | Optional character reference for visual consistency | - |
|
|
357
|
-
| End Frames | Custom or auto-generated per-scene end frames | - |
|
|
358
|
-
|
|
359
|
-
#### Manuscript Video
|
|
360
|
-
|
|
361
|
-
Long-form text to narrated video:
|
|
362
|
-
|
|
363
|
-
| Field | Description | Required |
|
|
364
|
-
|-------|-------------|----------|
|
|
365
|
-
| Manuscript Text | Paste your full article, script, or narration | Yes |
|
|
366
|
-
| Resolution | Portrait / Landscape / Square | - |
|
|
367
|
-
| Narration | Voice role and speech rate | - |
|
|
368
|
-
| Subtitle Style | Full subtitle customization | - |
|
|
369
|
-
|
|
370
|
-
> **Note**: Segment duration is auto-calculated based on text length (~4 chars/sec, 5–12s per segment) — no manual setting needed.
|
|
371
|
-
|
|
372
|
-
#### Digital Anchor
|
|
373
|
-
|
|
374
|
-
| Field | Description | Required |
|
|
375
|
-
|-------|-------------|----------|
|
|
376
|
-
| Anchor Script | Enter the text the anchor will say | Yes |
|
|
377
|
-
| Anchor Image | AI-generated or upload custom reference image | - |
|
|
378
|
-
| Resolution | Portrait / Landscape / Square | - |
|
|
379
|
-
| Narration | Voice role and speech rate | - |
|
|
380
|
-
| Subtitle Style | Full subtitle customization | - |
|
|
381
|
-
|
|
382
|
-
### 3. Click "Start Generating"
|
|
383
|
-
|
|
384
|
-
The progress panel shows real-time generation status for each step. For Creative Video: Init → Image Analysis → Story → Character Reference → Script → Narration → End Frame Prompts → End Frame Generation → Video Generation → Audio & Subtitles → Concatenation.
|
|
385
|
-
|
|
386
|
-
### 4. Checkpoint Resume & Task Management
|
|
387
|
-
|
|
388
|
-
If the server is interrupted, restart it and find the incomplete task in the "Task List" tab. Click "Resume" to continue from the last checkpoint. Running tasks can also be stopped and resumed later.
|
|
389
|
-
|
|
390
|
-
## 🏗️ Project Structure
|
|
391
|
-
|
|
392
|
-
```
|
|
393
|
-
agnes-video-generator/
|
|
394
|
-
├── start.sh # One-click launch script
|
|
395
|
-
├── requirements.txt # Python dependencies
|
|
396
|
-
├── Dockerfile # Multi-arch Docker image (Python 3.11 + ffmpeg via imageio)
|
|
397
|
-
├── docker-compose.yml # Docker Compose with persisted volumes
|
|
398
|
-
├── docker-run.sh # One-command Docker launch (wrapper with bind mounts)
|
|
399
|
-
├── server.py # FastAPI server (REST + WebSocket)
|
|
400
|
-
├── static/
|
|
401
|
-
│ └── index.html # Frontend SPA — 5 task tabs, 13 languages (Tailwind CSS)
|
|
402
|
-
├── core/
|
|
403
|
-
│ ├── config.py # API key, font resolution, default configs
|
|
404
|
-
│ ├── screenwriter.py # Screenwriter Agent (LLM-powered story/script/narration)
|
|
405
|
-
│ ├── task_manager.py # Task state persistence & checkpoint resume
|
|
406
|
-
│ ├── api/
|
|
407
|
-
│ │ ├── agnes_chat.py # LLM Chat API (agnes-2.0-flash)
|
|
408
|
-
│ │ ├── agnes_image.py # Image generation API (agnes-image-2.1-flash / 2.0-flash)
|
|
409
|
-
│ │ ├── agnes_video.py # Video generation API (agnes-video-v2.0)
|
|
410
|
-
│ │ └── rate_limiter.py # Global token bucket rate limiter (16 requests/min)
|
|
411
|
-
│ ├── audio/
|
|
412
|
-
│ │ ├── tts.py # Edge TTS engine + silent fallback engine
|
|
413
|
-
│ │ └── subtitle.py # SRT generation (fine-grained word-level) + overlay
|
|
414
|
-
│ ├── compositor/
|
|
415
|
-
│ │ ├── concatenator.py # Video concatenation + audio/subtitle overlay
|
|
416
|
-
│ │ └── processor.py # Video resize, frame extraction, freeze, silence gen
|
|
417
|
-
│ └── pipelines/
|
|
418
|
-
│ ├── simple_video.py # Pipeline: Simple Video
|
|
419
|
-
│ ├── creative_video.py # Pipeline: Creative Video (10-step)
|
|
420
|
-
│ ├── manuscript_video.py # Pipeline: Manuscript Video (5-step)
|
|
421
|
-
│ └── anchor_video.py # Pipeline: Digital Anchor
|
|
422
|
-
├── models/
|
|
423
|
-
│ └── task.py # Data models (5 task types, configs, requests)
|
|
424
|
-
├── resource/
|
|
425
|
-
│ └── fonts/ # Built-in CJK fonts for subtitle rendering
|
|
426
|
-
├── utils/
|
|
427
|
-
│ ├── image.py # Image download / base64 conversion
|
|
428
|
-
│ └── video.py # Video download
|
|
429
|
-
├── scripts/
|
|
430
|
-
│ └── regression_runner.py # 10-scenario regression test suite
|
|
431
|
-
└── docs/
|
|
432
|
-
├── regression_test_plan.md # Regression test plan
|
|
433
|
-
├── plans-v1.0/ # v1.0 design & planning docs
|
|
434
|
-
├── plans-v2.0/ # v2.0 review & optimization docs
|
|
435
|
-
└── plans-v3.0/ # v3.0 feature planning docs
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
## 🔧 Tech Stack
|
|
439
|
-
|
|
440
|
-
| Layer | Choice | Notes |
|
|
441
|
-
|-------|--------|-------|
|
|
442
|
-
| Backend | Python FastAPI | Async + WebSocket |
|
|
443
|
-
| Frontend | HTML/CSS/JS + Tailwind CSS CDN | Zero build steps, single-file SPA |
|
|
444
|
-
| LLM | Agnes Chat (`agnes-2.0-flash`) | Free — story, script, narration generation |
|
|
445
|
-
| Image AI | `agnes-image-2.1-flash` (t2i) / `agnes-image-2.0-flash` (i2i) | Free — reference images, end frames, standalone image generation |
|
|
446
|
-
| Video AI | `agnes-video-v2.0` | Free — text-to-video, image-to-video, keyframes |
|
|
447
|
-
| TTS | Edge TTS (Microsoft) | Free — 4 Chinese voices, no extra API key needed |
|
|
448
|
-
| Subtitles | moviepy + srt | Fine-grained word-level SRT, multi-line wrapping |
|
|
449
|
-
| Video Processing | moviepy + ffmpeg | Concatenation, subtitle overlay, audio mixing |
|
|
450
|
-
|
|
451
|
-
## 🎬 Three AI Video Chaining Modes
|
|
452
|
-
|
|
453
|
-
| Mode | How It Works | Best For |
|
|
454
|
-
|------|-------------|----------|
|
|
455
|
-
| **keyframes** | Specify first + last frame per scene; server auto-interpolates transitions | Smooth transitions (recommended) |
|
|
456
|
-
| **ti2vid** | Last frame of previous scene → img2img transition → first frame of next scene | Visual continuity between scenes |
|
|
457
|
-
| **none** | All scenes share the same reference image, independent of each other | Fast output, independent scenes |
|
|
458
|
-
|
|
459
|
-
## 📋 API Endpoints
|
|
460
|
-
|
|
461
|
-
| Method | Path | Description |
|
|
462
|
-
|--------|------|-------------|
|
|
463
|
-
| GET | `/` | Serve Web UI |
|
|
464
|
-
| GET | `/api/config` | Get API key (masked) |
|
|
465
|
-
| POST | `/api/config` | Save API key |
|
|
466
|
-
| DELETE | `/api/config` | Delete API key |
|
|
467
|
-
| GET | `/api/voices` | List available TTS voices |
|
|
468
|
-
| POST | `/api/image/generate` | Image generation |
|
|
469
|
-
| GET | `/api/image/{task_id}` | Query image task status |
|
|
470
|
-
| POST | `/api/tasks/simple` | Create simple video task |
|
|
471
|
-
| POST | `/api/tasks/creative` | Create creative video task |
|
|
472
|
-
| POST | `/api/tasks/manuscript` | Create manuscript video task |
|
|
473
|
-
| POST | `/api/tasks/anchor` | Create digital anchor task |
|
|
474
|
-
| POST | `/api/tasks` | Generic task creation (backward-compatible) |
|
|
475
|
-
| GET | `/api/tasks` | List all tasks (with type badges) |
|
|
476
|
-
| GET | `/api/tasks/{id}` | Get task details |
|
|
477
|
-
| POST | `/api/tasks/{id}/resume` | Resume an interrupted task |
|
|
478
|
-
| POST | `/api/tasks/{id}/stop` | Stop a running task |
|
|
479
|
-
| GET | `/api/video/{id}` | Download/stream final video |
|
|
480
|
-
| WS | `/ws/{id}` | WebSocket real-time progress |
|
|
481
|
-
|
|
482
|
-
## ⚠️ Important Notes
|
|
483
|
-
|
|
484
|
-
This project is in early stage — corner cases may not be fully handled. Recommended workflow:
|
|
485
|
-
|
|
486
|
-
1. Fill in your idea on the page and submit an AI video task
|
|
487
|
-
2. Watch the **console logs** (the terminal running `server.py`) and be patient
|
|
488
|
-
3. All key operations are logged for easy debugging
|
|
489
|
-
|
|
490
|
-
### Log Reference
|
|
491
|
-
|
|
492
|
-
All important operations are logged to the server console:
|
|
493
|
-
|
|
494
|
-
| Prefix | Module |
|
|
495
|
-
|--------|--------|
|
|
496
|
-
| `[Startup]` | Server startup, stale task reset |
|
|
497
|
-
| `[WS]` | WebSocket connect/disconnect |
|
|
498
|
-
| `[Resume]` / `[Stop]` | Task resume/stop |
|
|
499
|
-
| `[Pipeline]` / `[Simple]` / `[Manuscript]` | Pipeline step execution |
|
|
500
|
-
| `[TTS]` / `[Subtitle]` | Audio and subtitle generation |
|
|
501
|
-
| `[Compositor]` | Video concatenation and processing |
|
|
502
|
-
| `[AgnesImage]` / `[AgnesVideo]` / `[AgnesChat]` | AI API calls |
|
|
503
|
-
| `[RateLimiter]` | Global rate limiter |
|
|
504
|
-
| `[TaskManager]` | Task state persistence |
|
|
505
|
-
| `[Screenwriter]` | Screenwriter Agent |
|
|
506
|
-
|
|
507
|
-
### Output Directory
|
|
508
|
-
|
|
509
|
-
All AI video task artifacts are stored under `.working_dir/{timestamp}_{task_id}/`:
|
|
510
|
-
|
|
511
|
-
```
|
|
512
|
-
.working_dir/{timestamp}_{task_id}/
|
|
513
|
-
├── task_state.json # Task state (required for checkpoint resume)
|
|
514
|
-
├── final_video.mp4 # Final video with narration + subtitles
|
|
515
|
-
├── story.txt # AI-generated story (creative mode)
|
|
516
|
-
├── script.json # Scene script (JSON format)
|
|
517
|
-
├── narration.mp3 # Combined TTS narration audio
|
|
518
|
-
├── narration.srt # Combined subtitle file
|
|
519
|
-
├── scene_0/
|
|
520
|
-
│ ├── video.mp4 # Scene 0 AI video
|
|
521
|
-
│ ├── end_frame.png # Scene 0 end frame
|
|
522
|
-
│ └── task.json # Video generation task ID
|
|
523
|
-
├── scene_1/
|
|
524
|
-
│ └── ...
|
|
525
|
-
└── scene_2/
|
|
526
|
-
└── ...
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
## 🙏 Acknowledgments
|
|
530
|
-
|
|
531
|
-
This project is built upon the following open-source projects:
|
|
532
|
-
|
|
533
|
-
- [ViMax](https://github.com/HKUDS/ViMax) — AI video generation framework by HKU Data Science Lab
|
|
534
|
-
- [vimax-agnes](https://github.com/easyeye163/vimax-agnes) — Agnes AI adaptation based on ViMax
|
|
535
|
-
|
|
536
|
-
Special thanks to [Agnes AI](https://platform.agnes-ai.com) for providing **completely free**, high-quality AI model APIs (text, image, and video generation) — this project runs at absolute zero cost thanks to their generosity.
|
|
537
|
-
|
|
538
|
-
## 📄 License
|
|
539
|
-
|
|
540
|
-
MIT
|
|
541
|
-
|
|
542
|
-
---
|
|
543
|
-
|
|
544
|
-
## ❓ FAQ
|
|
545
|
-
|
|
546
|
-
### Is Agnes Video Generator really free? Are there any hidden costs?
|
|
547
|
-
|
|
548
|
-
Yes, it is **completely free**. All AI model calls (Agnes Chat, Agnes Image, Agnes Video) are free of charge with no trial period, no watermarks, and no usage limits. The only TTS integration (Microsoft Edge TTS) is also free and requires no extra API key. You only need a free API key from [Agnes AI](https://platform.agnes-ai.com) to get started.
|
|
549
|
-
|
|
550
|
-
### Do I need a GPU to run this AI video generator?
|
|
551
|
-
|
|
552
|
-
No. All AI compute runs in the cloud via Agnes AI's free API. You just need a regular laptop or desktop computer that can run Python 3.10+ and ffmpeg. No GPU, no high RAM, no special hardware required.
|
|
553
|
-
|
|
554
|
-
### How is this different from Runway, Pika, or Sora?
|
|
555
|
-
|
|
556
|
-
Unlike commercial AI video tools that charge $10–$95/month, Agnes Video Generator is completely free and open-source (MIT). It offers built-in multi-scene pipelines, AI narration, auto subtitles, and digital anchor — features that require third-party tools or manual editing elsewhere. See the [comparison table](#comparison-agnes-vs-commercial-ai-video-tools) above for details.
|
|
557
|
-
|
|
558
|
-
### What video generation modes are supported?
|
|
559
|
-
|
|
560
|
-
Four modes: **Simple Video** (single prompt, full parameter control), **Creative Video** (AI story → multi-scene video with narration), **Manuscript Video** (long text → auto-split → narrated video), and **Digital Anchor** (AI anchor with TTS). Additional options include text-to-video, image-to-video, keyframes animation, and image-to-image end frame generation.
|
|
561
|
-
|
|
562
|
-
### Can I use my own images as references?
|
|
563
|
-
|
|
564
|
-
Yes. You can upload reference images for character or scene consistency across scenes, use custom end frames for precise visual transitions, or choose img2img to auto-generate end frames from your reference. Reference images are supported in both Creative Video and Digital Anchor modes.
|
|
565
|
-
|
|
566
|
-
### What languages does the UI support?
|
|
567
|
-
|
|
568
|
-
The Web UI supports 13 languages: 中文, English, Deutsch, Français, Nederlands, Español, Português, Italiano, Русский, 日本語, 한국어, Bahasa Melayu, and Bahasa Indonesia. Subtitles are generated in the source text language with CJK font support built-in.
|
|
569
|
-
|
|
570
|
-
### Can I run this with Docker?
|
|
571
|
-
|
|
572
|
-
Yes. Pre-built images are published to both [GHCR](https://github.com/lcy362/agnes-video-generator/pkgs/container/free-short-video) and [Docker Hub](https://hub.docker.com/r/lcy362/free-short-video). Just pull the `latest` tag and run — no Python or ffmpeg installation needed. See **[Option B: Docker](#option-b-docker-no-pythonffmpeg-required)** in Quick Start for the full command and volume mount instructions.
|
|
573
|
-
|
|
574
|
-
### Can I host this on my own server?
|
|
575
|
-
|
|
576
|
-
Absolutely. The project is designed for self-hosting. Just clone the repo, run `./start.sh`, and the server starts on `http://localhost:8765`. No external dependencies, no cloud lock-in. See the [Quick Start](#🚀-quick-start) section above.
|
|
577
|
-
|
|
578
|
-
### How do I get help or report issues?
|
|
108
|
+
## 📚 Documentation
|
|
579
109
|
|
|
580
|
-
|
|
110
|
+
- **[Features](docs/features.md)** — Creation modes, the completely free AI model chain, AI narration & smart subtitles, flexible creative controls, production-grade reliability, and the multilingual Web UI.
|
|
111
|
+
- **[Getting Started](docs/getting-started.md)** — Install and deploy in 4 ways: Manual (`start.sh`), Docker, npm (`npx free-short-video`), or AI-Agent assisted.
|
|
112
|
+
- **[Usage Guide](docs/usage.md)** — Configure your API key, pick a video mode, resume from checkpoints, the three chaining modes, and logs & output layout.
|
|
113
|
+
- **[Architecture](docs/architecture.md)** — Project structure and tech stack.
|
|
114
|
+
- **[API Reference](docs/api.md)** — Full REST + WebSocket endpoint list.
|
|
115
|
+
- **[FAQ](docs/faq.md)** — Frequently asked questions.
|
|
116
|
+
- **[About & License](docs/about.md)** — Acknowledgments and the MIT license.
|
|
581
117
|
|
|
582
118
|
**Keywords**: free AI video generator, AI video generation tool, text to video AI, free AI video maker, AI video creator, open source video generator, Agnes AI, text-to-video, image-to-video, keyframes video, AI narration, auto subtitles, multi-scene video, zero cost AI video, no subscription AI video tool, digital anchor, self-hosted AI video generator, open source alternative to Runway
|
package/core/api/agnes_chat.py
CHANGED
|
@@ -17,11 +17,10 @@ import requests
|
|
|
17
17
|
|
|
18
18
|
from core.api.error_collector import collect_error, collect_error_from_exception
|
|
19
19
|
from core.api.rate_limiter import get_rate_limiter
|
|
20
|
+
from core.config import get_agnes_base_url
|
|
20
21
|
|
|
21
22
|
logger = logging.getLogger(__name__)
|
|
22
23
|
|
|
23
|
-
BASE_URL = "https://apihub.agnes-ai.com/v1"
|
|
24
|
-
|
|
25
24
|
# 重试配置
|
|
26
25
|
_MAX_RETRIES = 3
|
|
27
26
|
_RETRY_BASE_DELAY = 15 # 秒,指数退避基数
|
|
@@ -111,7 +110,7 @@ class AgnesChatAPI:
|
|
|
111
110
|
try:
|
|
112
111
|
get_rate_limiter().acquire()
|
|
113
112
|
resp = requests.post(
|
|
114
|
-
f"{
|
|
113
|
+
f"{get_agnes_base_url()}/chat/completions",
|
|
115
114
|
headers=self.headers,
|
|
116
115
|
json=payload,
|
|
117
116
|
timeout=timeout,
|
package/core/api/agnes_image.py
CHANGED
|
@@ -12,12 +12,11 @@ import requests
|
|
|
12
12
|
|
|
13
13
|
from core.api.error_collector import collect_error, collect_error_from_exception
|
|
14
14
|
from core.api.rate_limiter import get_rate_limiter
|
|
15
|
+
from core.config import get_agnes_base_url
|
|
15
16
|
from utils.image import download_image
|
|
16
17
|
|
|
17
18
|
logger = logging.getLogger(__name__)
|
|
18
19
|
|
|
19
|
-
BASE_URL = "https://apihub.agnes-ai.com/v1"
|
|
20
|
-
|
|
21
20
|
|
|
22
21
|
class ImageOutput:
|
|
23
22
|
def __init__(self, fmt: str, ext: str, data: str):
|
|
@@ -83,7 +82,7 @@ class AgnesImageAPI:
|
|
|
83
82
|
prompt: str,
|
|
84
83
|
reference_image_paths: List[str] = [],
|
|
85
84
|
size: Optional[str] = None,
|
|
86
|
-
max_retries: int =
|
|
85
|
+
max_retries: int = 4,
|
|
87
86
|
retry_base_delay: float = 20.0,
|
|
88
87
|
**kwargs,
|
|
89
88
|
) -> ImageOutput:
|
|
@@ -115,11 +114,11 @@ class AgnesImageAPI:
|
|
|
115
114
|
try:
|
|
116
115
|
# 全局限速:在发起 HTTP 请求前获取令牌
|
|
117
116
|
await asyncio.to_thread(get_rate_limiter().acquire)
|
|
118
|
-
# 动态超时:第一次
|
|
119
|
-
read_timeout =
|
|
117
|
+
# 动态超时:第一次 120s,后续逐步增加(图像生成较慢,放宽读超时)
|
|
118
|
+
read_timeout = 120 * (attempt + 1)
|
|
120
119
|
resp = await asyncio.to_thread(
|
|
121
120
|
requests.post,
|
|
122
|
-
f"{
|
|
121
|
+
f"{get_agnes_base_url()}/images/generations",
|
|
123
122
|
headers=self.headers,
|
|
124
123
|
json=payload,
|
|
125
124
|
timeout=(30, read_timeout),
|
package/core/api/agnes_models.py
CHANGED
|
@@ -8,19 +8,15 @@ import logging
|
|
|
8
8
|
|
|
9
9
|
import requests
|
|
10
10
|
|
|
11
|
-
from core.api.agnes_chat import BASE_URL
|
|
12
11
|
from core.config import (
|
|
13
12
|
DEFAULT_TEXT_MODEL,
|
|
14
13
|
DEFAULT_IMAGE_MODEL,
|
|
15
14
|
DEFAULT_VIDEO_MODEL,
|
|
15
|
+
get_agnes_base_url,
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
logger = logging.getLogger(__name__)
|
|
19
19
|
|
|
20
|
-
# 带 beta 开关的模型列表端点:裸 /v1/models 会被网关过滤掉内测模型,
|
|
21
|
-
# 加 ?all=true(等价 X-Beta-Access: true / ?include_beta=true)才会返回全量(含 2.5-flash)。
|
|
22
|
-
MODELS_ENDPOINT = f"{BASE_URL}/models?all=true"
|
|
23
|
-
|
|
24
20
|
REQUEST_TIMEOUT = 20
|
|
25
21
|
|
|
26
22
|
# 分组失败时的兜底列表
|
|
@@ -56,8 +52,9 @@ def fetch_available_models(api_key: str) -> dict:
|
|
|
56
52
|
接口失败(网络/鉴权/非 200)时返回硬编码兜底列表。
|
|
57
53
|
"""
|
|
58
54
|
try:
|
|
55
|
+
endpoint = f"{get_agnes_base_url()}/models?all=true"
|
|
59
56
|
resp = requests.get(
|
|
60
|
-
|
|
57
|
+
endpoint,
|
|
61
58
|
headers={"Authorization": f"Bearer {api_key}"},
|
|
62
59
|
timeout=REQUEST_TIMEOUT,
|
|
63
60
|
)
|