free-short-video 5.1.2

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.
Files changed (48) hide show
  1. package/.dockerignore +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +531 -0
  4. package/bin/cli.js +191 -0
  5. package/core/__init__.py +35 -0
  6. package/core/api/__init__.py +7 -0
  7. package/core/api/agnes_chat.py +294 -0
  8. package/core/api/agnes_image.py +256 -0
  9. package/core/api/agnes_models.py +84 -0
  10. package/core/api/agnes_video.py +535 -0
  11. package/core/api/error_collector.py +215 -0
  12. package/core/api/rate_limiter.py +142 -0
  13. package/core/artifacts.py +574 -0
  14. package/core/audio/__init__.py +9 -0
  15. package/core/audio/subtitle.py +1103 -0
  16. package/core/audio/tts.py +194 -0
  17. package/core/audio/voices.py +330 -0
  18. package/core/compositor/__init__.py +6 -0
  19. package/core/compositor/concatenator.py +653 -0
  20. package/core/compositor/processor.py +124 -0
  21. package/core/compositor/watermark.py +221 -0
  22. package/core/config.py +474 -0
  23. package/core/image_generator.py +8 -0
  24. package/core/path_security.py +58 -0
  25. package/core/pipeline.py +8 -0
  26. package/core/pipelines/__init__.py +466 -0
  27. package/core/pipelines/anchor_video.py +406 -0
  28. package/core/pipelines/creative_video.py +1968 -0
  29. package/core/pipelines/manuscript_video.py +540 -0
  30. package/core/pipelines/multi_scene.py +380 -0
  31. package/core/pipelines/poetry_video.py +504 -0
  32. package/core/pipelines/simple_video.py +143 -0
  33. package/core/screenwriter.py +1860 -0
  34. package/core/task_manager.py +211 -0
  35. package/core/video_generator.py +8 -0
  36. package/models/__init__.py +75 -0
  37. package/models/task.py +548 -0
  38. package/package.json +36 -0
  39. package/requirements.txt +13 -0
  40. package/resource/fonts/MicrosoftYaHeiNormal.ttc +0 -0
  41. package/resource/fonts/STHeitiMedium.ttc +0 -0
  42. package/server.py +2026 -0
  43. package/static/favicon.ico +0 -0
  44. package/static/icon.png +0 -0
  45. package/static/index.html +5277 -0
  46. package/utils/__init__.py +0 -0
  47. package/utils/image.py +36 -0
  48. package/utils/video.py +28 -0
package/.dockerignore ADDED
@@ -0,0 +1,32 @@
1
+ # 版本控制与本地环境(不进镜像)
2
+ .git/
3
+ .gitignore
4
+ .venv/
5
+ .workbuddy/
6
+ .agnes_config/
7
+ .writing/
8
+
9
+ # Python 缓存/构建产物
10
+ __pycache__/
11
+ *.pyc
12
+ *.pyo
13
+ *.egg-info/
14
+ build/
15
+ dist/
16
+
17
+ # 运行时产物与媒体(体积大,不进镜像)
18
+ .working_dir/
19
+ static/generated/
20
+ error_logs/
21
+ tests/mock_regression/
22
+
23
+ # 测试与文档(非运行必需,减小镜像)
24
+ tests/
25
+ docs/
26
+
27
+ # 临时/系统文件
28
+ .DS_Store
29
+ error_logs/
30
+ test_end.png
31
+ test_ref.png
32
+ *.log
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 lcy362
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,531 @@
1
+ # 🎬 Agnes Video Generator — Completely Free AI Video Generator
2
+
3
+ [![中文](https://img.shields.io/badge/CN-中文-red)](/README_ZH.md)
4
+ [![GitHub Stars](https://img.shields.io/github/stars/lcy362/agnes-video-generator?style=social)](https://github.com/lcy362/agnes-video-generator)
5
+ [![License](https://img.shields.io/github/license/lcy362/agnes-video-generator)](https://github.com/lcy362/agnes-video-generator/blob/main/LICENSE)
6
+ [![Python](https://img.shields.io/badge/python-3.10+-blue)](https://www.python.org/)
7
+ [![Website](https://img.shields.io/badge/website-video.lichuanyang.top-8A2BE2)](https://video.lichuanyang.top)
8
+
9
+ > **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)**
10
+
11
+ > "The solution is not to suppress AI, but to make it a more equitable capability, so that everyone knows how to create more with AI. This is a very important vision for our company — to make world-class AI belong to everyone. What we can do may be insignificant, but this vision is very long-term and enduring."
12
+ >
13
+ > — Bruce Yang, Founder of Agnes AI
14
+
15
+ **[🌐 Official Website](https://video.lichuanyang.top)** | **[📝 Blog (中文)](https://lichuanyang.top/posts/22470/)** | **[📝 Blog (English)](https://lichuanyang.top/en/posts/22470/)**
16
+
17
+ > **🖥️ 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.
18
+
19
+ ## ⭐ Support & Contribute
20
+
21
+ 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.
22
+
23
+ Bug reports and feature suggestions are welcome via [GitHub Issues](https://github.com/lcy362/agnes-video-generator/issues).
24
+
25
+ ### 💝 Support the Developer
26
+
27
+ Agnes Video Generator is and will always remain completely free and open-source. There will be **no paid plans, no premium features, and no subscription services** — now or in the future.
28
+
29
+ If you find this project helpful, here are a few ways to support its continued development:
30
+
31
+ - **⭐ Star on GitHub** — Star the [repository](https://github.com/lcy362/agnes-video-generator) to help others discover this project.
32
+ - **🌐 Whitelist the official website** — Turn off your ad blocker on [video.lichuanyang.top](https://video.lichuanyang.top) and click on an ad if something catches your eye. A small gesture that makes a real difference.
33
+ - **📢 Share your creations** — Post videos made with Agnes Video Generator on social media (Douyin, YouTube, Xiaohongshu, etc.) and tag the project. More exposure means more users, more feedback, and a better tool for everyone.
34
+
35
+ ## 🎥 Demo
36
+
37
+ ### 1. Creative Video — No Narration
38
+
39
+ > A dark-twist fairytale — *The Frog Prince*, 5 scenes, keyframes chaining, fully auto-generated.
40
+
41
+ [![The Frog Prince — Demo Video](https://img.shields.io/badge/▶%20Watch%20Demo-FF0050?style=for-the-badge&logo=tiktok&logoColor=white)](https://v.douyin.com/L4F6KdGnD6U/)
42
+
43
+ ### 2. Creative Video — With TTS Narration
44
+
45
+ > Same *Frog Prince* story, now with AI-generated TTS narration and auto subtitles.
46
+
47
+ [![The Frog Prince with Narration — Demo](https://img.shields.io/badge/▶%20Watch%20Demo-FF0050?style=for-the-badge&logo=tiktok&logoColor=white)](https://v.douyin.com/l2FlbF1Jdz0/)
48
+
49
+ ### 3. Manuscript Video — Text-to-Video
50
+
51
+ > Paste a long article or script → auto-split into segments → AI video per segment → unified TTS narration + subtitles → final video.
52
+
53
+ [![Manuscript Video Demo](https://img.shields.io/badge/▶%20Watch%20Demo-FF0050?style=for-the-badge&logo=tiktok&logoColor=white)](https://v.douyin.com/eSGE9KENWVU/)
54
+
55
+ <sub>Click to watch on Douyin</sub>
56
+
57
+ ## Why Agnes Video Generator?
58
+
59
+ Making AI videos today has an absurdly high barrier. Overseas services like Runway and Pika charge monthly subscriptions of tens of dollars. Domestic platforms like Jimeng and Keling charge by the second once their free quotas run out. Want to run open-source models locally? A GPU capable of video generation easily costs over ten thousand RMB. For most people who want to try AI video creation, the door is essentially closed.
60
+
61
+ We believe what Bruce Yang said — AI should be a more equitable capability. World-class AI should belong to everyone, not just those who can afford the bill.
62
+
63
+ To be honest, Agnes's video model isn't perfect yet. The generated frames are sometimes unstable, and complex actions occasionally deform. But it is **completely free with no usage limits**, and it iterates fast. We choose to grow with it rather than wait for a "perfect" commercial solution. If you share this mindset, then this project is for you — all you need is a free [Agnes AI](https://platform.agnes-ai.com) API key and an ordinary computer that can run Python to start creating AI videos at zero cost.
64
+
65
+ ### Comparison: Agnes vs. Commercial AI Video Tools
66
+
67
+ | Feature | Agnes Video Generator | Runway Gen-3 | Pika 2.0 | OpenAI Sora | Kling 1.6 |
68
+ |---------|:---:|:---:|:---:|:---:|:---:|
69
+ | **Price** | Free | $15–$95/month | $10–$95/month | $20+/month (limited) | Free quota, then pay-per-second |
70
+ | **Open Source** | ✅ Yes (MIT) | ❌ No | ❌ No | ❌ No | ❌ No |
71
+ | **Self-Hosted** | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |
72
+ | **Max Video Length** | 20s per clip, unlimited scenes | 10s per clip | 10s per clip | 20s per clip | 10s per clip |
73
+ | **Multi-Scene Pipeline** | ✅ Built-in (Creative/Manuscript) | ❌ Manual editing | ❌ Manual editing | ❌ Manual editing | ❌ Manual editing |
74
+ | **AI Narration (TTS)** | ✅ Free, built-in | ❌ Third-party | ❌ Third-party | ❌ Not available | ❌ Not available |
75
+ | **Auto Subtitles** | ✅ Word-level SRT | ❌ Not available | ❌ Not available | ❌ Not available | ❌ Not available |
76
+ | **Digital Anchor** | ✅ Built-in | ❌ No | ❌ No | ❌ No | ❌ No |
77
+ | **Resolution Options** | 9:16 / 16:9 / 1:1 | Multiple | Multiple | Multiple | Multiple |
78
+ | **Image-to-Video** | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Image inputs | ✅ Yes |
79
+ | **Keyframes Animation** | ✅ Yes | ✅ Yes | ✅ Yes | ❌ Not available | ❌ Not available |
80
+ | **Local GPU Required** | ❌ No (cloud API) | ❌ No (cloud) | ❌ No (cloud) | ❌ No (cloud) | ❌ No (cloud) |
81
+ | **Watermark** | No watermark | Built-in watermark | Built-in watermark | C2PA metadata | Built-in watermark |
82
+ | **Usage Limit** | No limit (16 req/min rate limit) | Billed by compute | Billed by generation | Billed by generation | Billed by generation |
83
+
84
+ ## ✨ Core Features
85
+
86
+ ### 🎬 Multiple Creation Modes
87
+
88
+ | Mode | Description | Best For |
89
+ |------|-------------|----------|
90
+ | **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 |
91
+ | **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 |
92
+ | **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 |
93
+ | **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 |
94
+
95
+ ### 🆓 Completely Free AI Model Chain
96
+
97
+ All core AI capabilities are **completely free** — no trial period, no watermarks, no token limits:
98
+
99
+ | Capability | Model | Cost |
100
+ |-----------|-------|------|
101
+ | Text / Script Generation | `agnes-2.0-flash` | Free |
102
+ | Image Generation | `agnes-image-2.1-flash` | Free |
103
+ | Video Generation | `agnes-video-v2.0` | Free |
104
+ | Text-to-Speech Narration | Edge TTS (Microsoft) | Free, no extra API key needed |
105
+
106
+ All AI API calls share a global token bucket rate limiter (16 requests/min), with automatic retries and exponential backoff to ensure stable operation.
107
+
108
+ ### 🎙️ AI Narration & Smart Subtitles
109
+
110
+ Both Creative Video and Manuscript Video support:
111
+
112
+ - **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%)
113
+ - **Word-level fine-grained subtitles**: SRT subtitles generated from TTS word-level timestamps, one entry every 2-3 seconds, with precise audio-video sync
114
+ - **Multi-line auto-wrapping**: Long subtitle text is intelligently split into two lines, preferring punctuation break points to prevent screen overflow
115
+ - **Fully configurable subtitle style**: Font, color, size, position (top/bottom), stroke, and semi-transparent background
116
+ - **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
117
+
118
+ ### 🎨 Flexible Creative Controls
119
+
120
+ - **Custom reference images** — Upload character or scene reference images to maintain visual consistency across scenes
121
+ - **Custom end frames** — Specify end frame images per scene for precise visual transition control
122
+ - **Image-to-image end frames** — Auto-generate scene end frames via img2img from your reference image
123
+ - **Three video chaining modes** — `keyframes` (first+last frame interpolation, recommended) / `ti2vid` (inter-scene transition frames) / `none` (independent scenes)
124
+ - **Multiple resolutions** — Portrait 9:16 (768×1152), Landscape 16:9 (1152×768), Square 1:1 (1024×1024)
125
+ - **Flexible duration** — Custom scene duration
126
+ - **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
127
+
128
+ ### 🔧 Production-Grade Reliability
129
+
130
+ - **Checkpoint resume** — Automatically resumes from the last checkpoint after interruption; state is persisted after each step, no duplicate API calls
131
+ - **Task management** — Create, view, resume, and stop tasks from the Web UI
132
+ - **Real-time progress** — WebSocket pushes per-step generation progress (step name, status, percentage, current/total)
133
+ - **Built-in CJK fonts** — Project ships with Chinese fonts, no garbled characters in subtitle rendering
134
+
135
+ ### 🤖 AI Agent Friendly
136
+
137
+ Designed specifically for AI coding assistants (Claude, Cursor, QoderWork, etc.), with a complete `AGENTS.md` deployment guide. AI Agents can automatically:
138
+
139
+ - Check environment (Python 3.10+, ffmpeg)
140
+ - Install dependencies and start the server
141
+ - Configure API key
142
+ - Run 4-layer deployment verification (connectivity → static analysis → endpoint testing → subtitle feature)
143
+ - Execute 10-scenario regression test suite
144
+
145
+ ### 🌐 Multilingual Web UI
146
+
147
+ 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.
148
+
149
+ ## 🚀 Quick Start
150
+
151
+ ### Prerequisites
152
+
153
+ - Python 3.10+
154
+ - 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.
155
+
156
+ That's it. No GPU, no large RAM, a regular laptop is all you need.
157
+
158
+ ### Option A: Manual Setup
159
+
160
+ **Step 1 — Clone & Launch**
161
+
162
+ ```bash
163
+ git clone https://github.com/lcy362/agnes-video-generator.git
164
+ cd agnes-video-generator
165
+ ./start.sh
166
+ ```
167
+
168
+ The script automatically creates a virtual environment, installs dependencies, and opens `http://localhost:8765` in your browser. You can also start manually:
169
+
170
+ ```bash
171
+ python3 -m venv .venv
172
+ .venv/bin/pip install -r requirements.txt
173
+ .venv/bin/python server.py
174
+ ```
175
+
176
+ **Step 2 — Configure API Key**
177
+
178
+ Get a free API key from [Agnes AI](https://platform.agnes-ai.com), then choose one of two ways:
179
+
180
+ ```bash
181
+ # Way 1: Environment variable
182
+ export AGNES_API_KEY="your-api-key"
183
+
184
+ # Way 2: Via API (same as entering it in the Web UI)
185
+ curl -X POST http://localhost:8765/api/config \
186
+ -H "Content-Type: application/json" \
187
+ -d '{"api_key": "your-api-key"}'
188
+ ```
189
+
190
+ **Step 3 — Create Your First Video**
191
+
192
+ Open `http://localhost:8765`, choose a video mode (Simple / Creative / Manuscript / Anchor), enter your idea, and click "Start Generating".
193
+
194
+ ### Option B: Docker (No Python/FFmpeg Required)
195
+
196
+ Pre-built multi-arch images (`linux/amd64`, `linux/arm64`) are published to both **GitHub Container Registry (GHCR)** and **Docker Hub** on every release.
197
+
198
+ **Pull & Run**
199
+
200
+ ```bash
201
+ # GHCR
202
+ docker run -d -p 8765:8765 \
203
+ -e AGNES_API_KEY=<your-key> \
204
+ -v ~/agnes-data/working:/app/.working_dir \
205
+ -v ~/agnes-data/config:/app/.agnes_config \
206
+ ghcr.io/lcy362/free-short-video:latest
207
+
208
+ # Docker Hub
209
+ docker run -d -p 8765:8765 \
210
+ -e AGNES_API_KEY=<your-key> \
211
+ -v ~/agnes-data/working:/app/.working_dir \
212
+ -v ~/agnes-data/config:/app/.agnes_config \
213
+ lcy362/free-short-video:latest
214
+ ```
215
+
216
+ Then open `http://localhost:8765`.
217
+
218
+ **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.
219
+
220
+ Or use `docker compose` with the included `docker-compose.yml`:
221
+
222
+ ```bash
223
+ git clone https://github.com/lcy362/agnes-video-generator.git
224
+ cd agnes-video-generator
225
+ AGNES_API_KEY=<your-key> docker compose up -d
226
+ ```
227
+
228
+ ### Option C: npm (One Command)
229
+
230
+ If you have **Node.js 18+** and **Python 3.10+** installed, the whole service ships as an npm package — no cloning, no manual venv:
231
+
232
+ ```bash
233
+ # Run directly without installing
234
+ npx free-short-video
235
+
236
+ # Or install globally, then run
237
+ npm install -g free-short-video
238
+ free-short-video # short alias: fsv
239
+ ```
240
+
241
+ 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:
242
+
243
+ ```bash
244
+ AGNES_API_KEY=<your-key> npx free-short-video
245
+ ```
246
+
247
+ Options: `--port <n>`, `--host <h>` (use `0.0.0.0` for LAN access), `--no-open`.
248
+
249
+ ### Option D: AI Agent Assisted Setup
250
+
251
+ This project is designed for AI coding assistants. First, download the code and prepare your API key:
252
+
253
+ ```bash
254
+ git clone https://github.com/lcy362/agnes-video-generator.git
255
+ cd agnes-video-generator
256
+ ```
257
+
258
+ Then tell your agent:
259
+
260
+ > "Read the AGENTS.md in this project, install dependencies, configure the API key `<your-key>`, and start the server."
261
+
262
+ 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:
263
+
264
+ > "Run the deployment verification checks."
265
+
266
+ The agent will execute the 4-layer checklist from `AGENTS.md` (connectivity → static analysis → endpoint testing → subtitle feature) and report results.
267
+
268
+ ## 📖 Usage
269
+
270
+ ### 1. Configure API Key
271
+
272
+ 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:
273
+
274
+ ```bash
275
+ export AGNES_API_KEY="your-api-key"
276
+ ```
277
+
278
+ ### 2. Choose a Video Mode
279
+
280
+ #### Simple Video
281
+
282
+ Quick single-clip generation with full parameter control:
283
+
284
+ | Field | Description |
285
+ |-------|-------------|
286
+ | Prompt | Describe the AI video scene in natural language |
287
+ | Generation Mode | Text-to-Video / Image-to-Video / Text+Image / Keyframes |
288
+ | Resolution | Portrait 9:16 / Landscape 16:9 / Square 1:1 |
289
+ | Duration | 5s / 10s / 15s / 18s / 20s |
290
+ | Reference Image | Optional upload for image-to-video modes |
291
+ | End Frame Image | Optional end frame for keyframes mode |
292
+
293
+ #### Creative Video
294
+
295
+ AI-driven multi-scene storytelling:
296
+
297
+ | Field | Description | Required |
298
+ |-------|-------------|----------|
299
+ | Idea | Describe your AI video concept | Yes |
300
+ | User Requirements | Scene count, duration, and other constraints | - |
301
+ | Visual Style | Cinematic realism, anime, cyberpunk, etc. | - |
302
+ | Chaining Mode | keyframes (recommended) / ti2vid / none | - |
303
+ | Narration | Enable/disable TTS narration, choose voice and speed | - |
304
+ | Subtitle Style | Font, color, size, position, stroke, background | - |
305
+ | Reference Image | Optional character reference for visual consistency | - |
306
+ | End Frames | Custom or auto-generated per-scene end frames | - |
307
+
308
+ #### Manuscript Video
309
+
310
+ Long-form text to narrated video:
311
+
312
+ | Field | Description | Required |
313
+ |-------|-------------|----------|
314
+ | Manuscript Text | Paste your full article, script, or narration | Yes |
315
+ | Resolution | Portrait / Landscape / Square | - |
316
+ | Narration | Voice role and speech rate | - |
317
+ | Subtitle Style | Full subtitle customization | - |
318
+
319
+ > **Note**: Segment duration is auto-calculated based on text length (~4 chars/sec, 5–12s per segment) — no manual setting needed.
320
+
321
+ #### Digital Anchor
322
+
323
+ | Field | Description | Required |
324
+ |-------|-------------|----------|
325
+ | Anchor Script | Enter the text the anchor will say | Yes |
326
+ | Anchor Image | AI-generated or upload custom reference image | - |
327
+ | Resolution | Portrait / Landscape / Square | - |
328
+ | Narration | Voice role and speech rate | - |
329
+ | Subtitle Style | Full subtitle customization | - |
330
+
331
+ ### 3. Click "Start Generating"
332
+
333
+ 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.
334
+
335
+ ### 4. Checkpoint Resume & Task Management
336
+
337
+ 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.
338
+
339
+ ## 🏗️ Project Structure
340
+
341
+ ```
342
+ agnes-video-generator/
343
+ ├── start.sh # One-click launch script
344
+ ├── requirements.txt # Python dependencies
345
+ ├── Dockerfile # Multi-arch Docker image (Python 3.11 + ffmpeg via imageio)
346
+ ├── docker-compose.yml # Docker Compose with persisted volumes
347
+ ├── docker-run.sh # One-command Docker launch (wrapper with bind mounts)
348
+ ├── server.py # FastAPI server (REST + WebSocket)
349
+ ├── static/
350
+ │ └── index.html # Frontend SPA — 5 task tabs, 13 languages (Tailwind CSS)
351
+ ├── core/
352
+ │ ├── config.py # API key, font resolution, default configs
353
+ │ ├── screenwriter.py # Screenwriter Agent (LLM-powered story/script/narration)
354
+ │ ├── task_manager.py # Task state persistence & checkpoint resume
355
+ │ ├── api/
356
+ │ │ ├── agnes_chat.py # LLM Chat API (agnes-2.0-flash)
357
+ │ │ ├── agnes_image.py # Image generation API (agnes-image-2.1-flash / 2.0-flash)
358
+ │ │ ├── agnes_video.py # Video generation API (agnes-video-v2.0)
359
+ │ │ └── rate_limiter.py # Global token bucket rate limiter (16 requests/min)
360
+ │ ├── audio/
361
+ │ │ ├── tts.py # Edge TTS engine + silent fallback engine
362
+ │ │ └── subtitle.py # SRT generation (fine-grained word-level) + overlay
363
+ │ ├── compositor/
364
+ │ │ ├── concatenator.py # Video concatenation + audio/subtitle overlay
365
+ │ │ └── processor.py # Video resize, frame extraction, freeze, silence gen
366
+ │ └── pipelines/
367
+ │ ├── simple_video.py # Pipeline: Simple Video
368
+ │ ├── creative_video.py # Pipeline: Creative Video (10-step)
369
+ │ ├── manuscript_video.py # Pipeline: Manuscript Video (5-step)
370
+ │ └── anchor_video.py # Pipeline: Digital Anchor
371
+ ├── models/
372
+ │ └── task.py # Data models (5 task types, configs, requests)
373
+ ├── resource/
374
+ │ └── fonts/ # Built-in CJK fonts for subtitle rendering
375
+ ├── utils/
376
+ │ ├── image.py # Image download / base64 conversion
377
+ │ └── video.py # Video download
378
+ ├── scripts/
379
+ │ └── regression_runner.py # 10-scenario regression test suite
380
+ └── docs/
381
+ ├── regression_test_plan.md # Regression test plan
382
+ ├── plans-v1.0/ # v1.0 design & planning docs
383
+ ├── plans-v2.0/ # v2.0 review & optimization docs
384
+ └── plans-v3.0/ # v3.0 feature planning docs
385
+ ```
386
+
387
+ ## 🔧 Tech Stack
388
+
389
+ | Layer | Choice | Notes |
390
+ |-------|--------|-------|
391
+ | Backend | Python FastAPI | Async + WebSocket |
392
+ | Frontend | HTML/CSS/JS + Tailwind CSS CDN | Zero build steps, single-file SPA |
393
+ | LLM | Agnes Chat (`agnes-2.0-flash`) | Free — story, script, narration generation |
394
+ | Image AI | `agnes-image-2.1-flash` (t2i) / `agnes-image-2.0-flash` (i2i) | Free — reference images, end frames, standalone image generation |
395
+ | Video AI | `agnes-video-v2.0` | Free — text-to-video, image-to-video, keyframes |
396
+ | TTS | Edge TTS (Microsoft) | Free — 4 Chinese voices, no extra API key needed |
397
+ | Subtitles | moviepy + srt | Fine-grained word-level SRT, multi-line wrapping |
398
+ | Video Processing | moviepy + ffmpeg | Concatenation, subtitle overlay, audio mixing |
399
+
400
+ ## 🎬 Three AI Video Chaining Modes
401
+
402
+ | Mode | How It Works | Best For |
403
+ |------|-------------|----------|
404
+ | **keyframes** | Specify first + last frame per scene; server auto-interpolates transitions | Smooth transitions (recommended) |
405
+ | **ti2vid** | Last frame of previous scene → img2img transition → first frame of next scene | Visual continuity between scenes |
406
+ | **none** | All scenes share the same reference image, independent of each other | Fast output, independent scenes |
407
+
408
+ ## 📋 API Endpoints
409
+
410
+ | Method | Path | Description |
411
+ |--------|------|-------------|
412
+ | GET | `/` | Serve Web UI |
413
+ | GET | `/api/config` | Get API key (masked) |
414
+ | POST | `/api/config` | Save API key |
415
+ | DELETE | `/api/config` | Delete API key |
416
+ | GET | `/api/voices` | List available TTS voices |
417
+ | POST | `/api/image/generate` | Image generation |
418
+ | GET | `/api/image/{task_id}` | Query image task status |
419
+ | POST | `/api/tasks/simple` | Create simple video task |
420
+ | POST | `/api/tasks/creative` | Create creative video task |
421
+ | POST | `/api/tasks/manuscript` | Create manuscript video task |
422
+ | POST | `/api/tasks/anchor` | Create digital anchor task |
423
+ | POST | `/api/tasks` | Generic task creation (backward-compatible) |
424
+ | GET | `/api/tasks` | List all tasks (with type badges) |
425
+ | GET | `/api/tasks/{id}` | Get task details |
426
+ | POST | `/api/tasks/{id}/resume` | Resume an interrupted task |
427
+ | POST | `/api/tasks/{id}/stop` | Stop a running task |
428
+ | GET | `/api/video/{id}` | Download/stream final video |
429
+ | WS | `/ws/{id}` | WebSocket real-time progress |
430
+
431
+ ## ⚠️ Important Notes
432
+
433
+ This project is in early stage — corner cases may not be fully handled. Recommended workflow:
434
+
435
+ 1. Fill in your idea on the page and submit an AI video task
436
+ 2. Watch the **console logs** (the terminal running `server.py`) and be patient
437
+ 3. All key operations are logged for easy debugging
438
+
439
+ ### Log Reference
440
+
441
+ All important operations are logged to the server console:
442
+
443
+ | Prefix | Module |
444
+ |--------|--------|
445
+ | `[Startup]` | Server startup, stale task reset |
446
+ | `[WS]` | WebSocket connect/disconnect |
447
+ | `[Resume]` / `[Stop]` | Task resume/stop |
448
+ | `[Pipeline]` / `[Simple]` / `[Manuscript]` | Pipeline step execution |
449
+ | `[TTS]` / `[Subtitle]` | Audio and subtitle generation |
450
+ | `[Compositor]` | Video concatenation and processing |
451
+ | `[AgnesImage]` / `[AgnesVideo]` / `[AgnesChat]` | AI API calls |
452
+ | `[RateLimiter]` | Global rate limiter |
453
+ | `[TaskManager]` | Task state persistence |
454
+ | `[Screenwriter]` | Screenwriter Agent |
455
+
456
+ ### Output Directory
457
+
458
+ All AI video task artifacts are stored under `.working_dir/{timestamp}_{task_id}/`:
459
+
460
+ ```
461
+ .working_dir/{timestamp}_{task_id}/
462
+ ├── task_state.json # Task state (required for checkpoint resume)
463
+ ├── final_video.mp4 # Final video with narration + subtitles
464
+ ├── story.txt # AI-generated story (creative mode)
465
+ ├── script.json # Scene script (JSON format)
466
+ ├── narration.mp3 # Combined TTS narration audio
467
+ ├── narration.srt # Combined subtitle file
468
+ ├── scene_0/
469
+ │ ├── video.mp4 # Scene 0 AI video
470
+ │ ├── end_frame.png # Scene 0 end frame
471
+ │ └── task.json # Video generation task ID
472
+ ├── scene_1/
473
+ │ └── ...
474
+ └── scene_2/
475
+ └── ...
476
+ ```
477
+
478
+ ## 🙏 Acknowledgments
479
+
480
+ This project is built upon the following open-source projects:
481
+
482
+ - [ViMax](https://github.com/HKUDS/ViMax) — AI video generation framework by HKU Data Science Lab
483
+ - [vimax-agnes](https://github.com/easyeye163/vimax-agnes) — Agnes AI adaptation based on ViMax
484
+
485
+ 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.
486
+
487
+ ## 📄 License
488
+
489
+ MIT
490
+
491
+ ---
492
+
493
+ ## ❓ FAQ
494
+
495
+ ### Is Agnes Video Generator really free? Are there any hidden costs?
496
+
497
+ 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.
498
+
499
+ ### Do I need a GPU to run this AI video generator?
500
+
501
+ 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.
502
+
503
+ ### How is this different from Runway, Pika, or Sora?
504
+
505
+ 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.
506
+
507
+ ### What video generation modes are supported?
508
+
509
+ 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.
510
+
511
+ ### Can I use my own images as references?
512
+
513
+ 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.
514
+
515
+ ### What languages does the UI support?
516
+
517
+ 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.
518
+
519
+ ### Can I run this with Docker?
520
+
521
+ 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.
522
+
523
+ ### Can I host this on my own server?
524
+
525
+ 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.
526
+
527
+ ### How do I get help or report issues?
528
+
529
+ Check the [GitHub Issues](https://github.com/lcy362/agnes-video-generator/issues) page for existing reports or open a new one. The project also includes a comprehensive `AGENTS.md` for AI-agent-assisted debugging. For feature requests, bug reports, or questions, the Issues page is the best place.
530
+
531
+ **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