reelforge 1.19.1 → 1.20.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 CHANGED
@@ -1,295 +1,295 @@
1
- # reelforge
2
-
3
- > Turn a topic or script into a finished vertical video — narration, visuals, and subtitles, assembled for you. Every capability is a command, with `--help` at every level.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install -g reelforge
9
- ```
10
-
11
- Or use directly without install:
12
-
13
- ```bash
14
- npx reelforge <command>
15
- ```
16
-
17
- After install, two binaries are on your `PATH` — `reelforge` and the short alias `rf`. Both behave identically; the docs use `rf` from here on.
18
-
19
- ```bash
20
- rf --version # same as `reelforge --version`
21
- ```
22
-
23
- ## Quick start
24
-
25
- The CLI ships pointing at the hosted service. Log in once, then call:
26
-
27
- ```bash
28
- npm install -g reelforge
29
- rf login # opens browser; headless? rf login <api_key>
30
- rf whoami # balance + api_keys
31
- rf create "为什么我们还没找到外星文明?" # auto-saves to ./<title>-<id>.mp4 in cwd
32
- ```
33
-
34
- That's the whole story — no server to run.
35
-
36
- ### Output behavior
37
-
38
- | invocation | result |
39
- |---|---|
40
- | `rf create "..."` | Saves to `./<sanitized-title>-<task_id_short>.mp4`, prints the path |
41
- | `rf create "..." -o ./videos/space.mp4` | Saves to that exact path (must include filename, not just a directory) |
42
- | `rf create "..." --no-download` | Skips local save, prints JSON result with `video_url` |
43
- | `rf create "..." \| jq .video_url` | When stdout is piped, download is skipped automatically |
44
-
45
- ## Global options
46
-
47
- | flag | description |
48
- |---|---|
49
- | `-s, --server <url>` | Server URL (overrides `$REELFORGE_SERVER`; defaults to the hosted service) |
50
- | `-k, --api-key <key>` | API key (overrides `$REELFORGE_API_KEY` and `reelforge login` saved key) |
51
- | `--json` | Output raw JSON instead of pretty text — pipe-friendly |
52
- | `--quiet` | Suppress informational messages on stderr |
53
- | `-v, --version` | Show CLI version |
54
- | `-h, --help` | Show help (works on every sub-command) |
55
-
56
- ## Command map
57
-
58
- Run `rf <command> --help` for full details on any of these.
59
-
60
- ### Core capabilities
61
-
62
- | command | what it does |
63
- |---|---|
64
- | `llm chat -p <text>` | Send one prompt to the configured model |
65
- | `llm presets` | List built-in model presets |
66
- | `tts ... -t <text> -o out.mp3` | Text-to-speech (free local + cloud voice options) |
67
- | `tts voices [--locale zh]` | List supported voices |
68
- | `images generate -p <prompt>` | Image generation |
69
-
70
- ### Content / audio / subtitle atomics
71
-
72
- | command | what it does |
73
- |---|---|
74
- | `content scene-plan -t <topic>` | Single LLM call: title + master script + per-scene image prompts (replaces the old narration / split / image-prompts / title trio) |
75
- | `content scene-plan --script <text-or-@file>` | Same, but the user supplies the script verbatim — LLM only segments and writes image prompts |
76
- | `audio transcribe -f <file>` / `--url <url>` | Speech-to-text with word + segment timestamps |
77
- | `subtitles split -t <text-or-@file>` | Deterministic tiered-punctuation subtitle line splitter (pure function, zero billing) |
78
-
79
- ### Composition
80
-
81
- | command | what it does |
82
- |---|---|
83
- | `templates list [--size 1080x1920] [--type image]` | List HTML frame templates |
84
- | `templates preview <keyOrPath> [-o out.png]` | Render a preview from a preset key **or your own local .html file** |
85
- | `templates show <key> [-o file.html]` | Print or save the source HTML of any preset — copy it as a starting point for a custom template |
86
- | `frames render -t <keyOrPath> --title ... --text ...` | Render a single composed frame to PNG. `-t` accepts a preset key **or a local .html path** |
87
- | `compositions concat <v1> <v2> -o out.mp4` | FFmpeg concat (+ optional BGM) |
88
- | `compositions bgm -i video.mp4 --bgm bgm.mp3 -o out.mp4` | Add background music |
89
- | `compositions image-to-video -i img.png -a aud.mp3 -o out.mp4` | Build video from image + audio |
90
- | `compositions overlay -v video.mp4 --overlay overlay.png -o out.mp4` | Overlay PNG on video |
91
-
92
- ### End-to-end pipelines
93
-
94
- All `pipelines *` commands submit an **async task** and (by default) poll until it finishes with a live progress indicator on stderr. Use `--no-wait` to return immediately with a `task_id`, then `rf tasks wait <id>` later.
95
-
96
- The standard pipeline turns a topic or script into a finished vertical video — narration, visuals, and subtitles are generated and assembled for you. One continuous narration track; visuals cut at scene boundaries; subtitles cut at line boundaries.
97
-
98
- | command | what it does |
99
- |---|---|
100
- | `pipelines standard -t <topic>` (or `--script <text>`) | Audio-first pipeline; `-d/--duration` and `-p/--pace` are the two main knobs |
101
-
102
- #### Composition knobs
103
-
104
- Three independent axes — mix and match as you like:
105
-
106
- | flag | values | default | what changes |
107
- |---|---|---|---|
108
- | `--motion` | `off` / `lite` / `max` | `lite` | per-scene zoompan + crossfade intensity |
109
- | `--layout` | `full` / `blur-bg` / `letterbox` | `full` | how the image sits in the canvas |
110
- | `--subtitle-style` | `plate` / `stroke` / `cinema` | `plate` | subtitle look |
111
-
112
- **Layout presets**:
113
- - `full` — image fills the whole 1080×1920 canvas. Generates a 1080×1920 image. High-impact; best for human portraits, landscapes, 9:16-native content.
114
- - `blur-bg` — image at 1080×1080 centered, top/bottom is a gaussian-blurred copy of the **same image** moving in sync with the foreground. Generates a 1080×1080 image (cheaper + no wasted pixels). Best for charts, screenshots, non-9:16 source content (小红书 / 抖音 style).
115
- - `letterbox` — image at 1080×1080 centered, top/bottom is a solid matte (CSS color). Generates a 1080×1080 image. Cinematic / calm. Customize the matte with `--layout-matte-color "#1a1a1a"` (default `black`).
116
-
117
- Examples:
118
- ```bash
119
- rf create "财经日报" --layout blur-bg # 小红书 / 抖音
120
- rf create "纪录片片段" --layout letterbox --motion max # 电影感
121
- rf create "..." --layout letterbox --layout-matte-color "#1a1a1a" # 柔和黑
122
- ```
123
-
124
- ### Resources
125
-
126
- | command | what it does |
127
- |---|---|
128
- | `bgm list / upload <file> / delete <name>` | Manage background music |
129
- | `files list / upload <file> / download <path> / delete <path>` | Manage user assets |
130
-
131
- ### System
132
-
133
- | command | what it does |
134
- |---|---|
135
- | `config get` | Read server config (keys masked) |
136
- | `config set <key> <value>` | Update a dotted-path setting (e.g. `llm.api_key sk-xxx`) |
137
- | `config patch <file>` | Apply a JSON-merge patch |
138
- | `tasks list [--status running]` | List recent tasks |
139
- | `tasks get <id>` / `tasks wait <id>` / `tasks cancel <id>` | Task lifecycle |
140
- | `history list / get <id> / delete <id>` | Browse / delete completed runs |
141
- | `health` | Server health + capability check |
142
-
143
- ### Heavy brand customization (custom overlay templates)
144
-
145
- `--motion` / `--layout` / `--subtitle-*` / `--brand-*` cover the common cases. For full visual identity ownership (custom path bar, accent decorations, light theme, footer block, etc.) pass a custom overlay HTML via `--frame-template <local.html | preset_key>`:
146
-
147
- ```bash
148
- rf templates show 1080x1920/default.html -o ./my-brand.html
149
- # ...edit my-brand.html (change colors, add structure, etc.)...
150
- rf create "我的视频" --frame-template ./my-brand.html
151
- ```
152
-
153
- **Contract for custom HTML**:
154
-
155
- - Canvas is **1080×1920** (pipeline-fixed; don't declare a different size in `<meta>`).
156
- - Background must be **transparent** — the scene image is composited by the renderer outside the HTML layer.
157
- - **`{{image}}` no longer exists.** Using `<img src="{{image}}">` is a hard error at submit time. The image is composited by the renderer.
158
- - The pipeline injects these placeholders for you:
159
-
160
- | Placeholder | What it is |
161
- |---|---|
162
- | `{{title}}` `{{text}}` | per-frame content |
163
- | `{{index}}` `{{total}}` | "scene N of M" — `{{total}}` is the LLM-decided scene count, don't hardcode |
164
- | `{{layout}}` | `"full"` / `"blur-bg"` / `"letterbox"` — react via `body[data-layout="..."]` CSS to put title/subtitle in the matte zones when layout ≠ full |
165
- | `{{subtitle_style}}` `{{subtitle_color}}` `{{subtitle_background}}` | subtitle preset + overrides |
166
- | `{{brand_position}}` `{{brand_handle}}` `{{brand_slogan}}` `{{brand_logo}}` `{{brand_color}}` | brand-chrome inputs (use or ignore as you like) |
167
-
168
- Inline HTML is hard-capped at 2 MB. The audio + motion + character-ref + scene-plan stages all keep working identically — only the overlay layer is yours.
169
-
170
- **Publishing to short-video platforms (Douyin / TikTok / WeChat Channels)** — the default composition renders to the full 1080×1920 canvas, but those apps overlay UI on top/bottom/right and cover-crop ~96-180px on each side on taller phones. ReelForge does NOT bake platform-specific padding into the renderer. Look up reference safe-zone numbers + recommended `--media-anchor-y` values per platform:
171
-
172
- ```bash
173
- rf platform # overview table for all platforms
174
- rf platform 抖音 # detail + anchor variants (alias of douyin)
175
- rf platform tiktok
176
- rf platform wechat # 视频号
177
- ```
178
-
179
- ## Examples
180
-
181
- ```bash
182
- # 1. One-click out a video (45s default, AI writes the script)
183
- rf create "为什么我们还没找到外星文明?"
184
-
185
- # 2. Longer video with a slower visual rhythm
186
- rf create "深夜便利店的灯光" -d 90 -p slow
187
-
188
- # 3. Your own script — no narration-splitting on your side, the pipeline handles it
189
- rf create --script @./my-script.txt
190
- rf create --script "雨水缓缓滑落在玻璃窗上,像是无声的泪珠。"
191
-
192
- # 4. Preview-first workflow: scrub the storyboard in the browser
193
- # before paying for the MP4 render. Finalize with `rf render` when satisfied.
194
- rf create "..." --preview-only # opens browser studio
195
- rf render <task-id> # produce the MP4
196
-
197
- # 5. Push the image square up to grow the bottom matte (抖音 long-description
198
- # case); subtitle position follows the image automatically.
199
- rf create "..." --layout blur-bg --media-anchor-y 0.40
200
- # See `rf platform 抖音` for the safe range and per-scenario recommendations.
201
-
202
- # 6. Encoder budget — pick a quality preset or set an exact bitrate.
203
- rf create "..." --quality draft # ~1 Mbps, ~3-4× smaller than default
204
- rf create "..." --video-bitrate 750k # exact bitrate
205
- rf create "..." --crf 28 # fine-grained control
206
-
207
- # 7. Pick a built-in visual style preset
208
- rf create "美食教程" --style photorealistic
209
-
210
- # 5. Pipeline form with explicit output path
211
- rf pipelines standard \
212
- --script @./script.txt \
213
- --frame-template 1080x1920/image_default.html \
214
- -p normal -o smoke.mp4
215
-
216
- # 6. Inspect existing tasks & redownload a finished video
217
- rf tasks list --limit 5
218
- rf history get <task-id> --download recovered.mp4
219
-
220
- # 7. Atomics for stand-alone use
221
- rf content scene-plan -t "雨天的玻璃窗" -d 45 --json | jq .scenes
222
- rf audio transcribe -f narration.mp3 --json | jq '.words[:5]'
223
- rf subtitles split -t @./narration.txt --min 10 --hard-max 24
224
-
225
- # 8. JSON pipe for automation
226
- rf llm presets --json | jq '.[].defaultModel'
227
-
228
- # 9. Use your own HTML template (no PR/release needed)
229
- # Any --frame-template that points to a local .html file is read and sent
230
- # inline. Declare size inside the file via
231
- # <meta name="template:width" content="1080">
232
- # <meta name="template:height" content="1920">
233
- # or pass --frame-template-size 1080x1920.
234
- rf templates show 1080x1920/image_default.html -o my-brand.html # copy a preset
235
- # ...edit my-brand.html to suit your style...
236
- rf templates preview ./my-brand.html --title "Hello" -o preview.png
237
- rf frames render -t ./my-brand.html --values '{"author":"Alice"}' -o frame.png
238
- rf pipelines standard -t "宠物" --frame-template ./my-brand.html -o final.mp4
239
- ```
240
-
241
- ### Custom HTML templates
242
-
243
- Easiest way to start: grab a preset as a reference.
244
-
245
- ```bash
246
- rf templates list # see all keys
247
- rf templates show 1080x1920/static_default.html # print to stdout
248
- rf templates show 1080x1920/image_default.html -o my-brand.html # save and edit
249
- ```
250
-
251
- `{{title}}`, `{{text}}`, `{{image}}`, `{{index}}`, `{{total}}` are reserved built-ins auto-injected by the pipeline; everything else uses the `{{name:type=default}}` DSL (`type` ∈ `text|number|color|bool`). Pass extras through `--values '{"author":"Alice"}'` (or `template_params` on the pipeline API).
252
-
253
- - `{{index}}` — current scene number, 1-based
254
- - `{{total}}` — scene count the LLM actually produced (use this for "scene N of M" badges; don't hardcode in `template_params`, the scene count is decided at runtime)
255
-
256
- #### Template type — does the pipeline generate an AI image per scene?
257
-
258
- When you ship an inline template through `rf create` / `rf pipelines standard`, ReelForge needs to know whether each scene should kick off image generation. Resolution priority (high → low):
259
-
260
- 1. Explicit flag — `--frame-template-type image|static|asset` (or `frame_template_type` in the API body).
261
- 2. Inside the HTML — `<meta name="template:type" content="image">` (or `static` / `asset`).
262
- 3. **Default: `image`** — best practice for zero-config users. If your template doesn't reference scene imagery (pure-text card, etc.), declare `static` explicitly to skip image generation and its cost.
263
-
264
- The placeholder `{{image}}` no longer doubles as a type signal — declare type explicitly.
265
-
266
- Limits and safety:
267
-
268
- - Max 2 MB per inline HTML.
269
- - The render sandbox blocks `file://`, loopback / private / link-local IPs, CGNAT range, cloud-metadata, and `*.local` / `*.internal` hostnames. So your template can only reference public `https`/`http` resources or `data:` URIs.
270
- - If the CLI is talking to a hosted server, local-path `--image` won't reach the server; either upload to `rf files upload` first or use an HTTPS URL / data: URI.
271
-
272
- #### API field reference
273
-
274
- | endpoint | inline HTML field | size field | type field |
275
- |---|---|---|---|
276
- | `POST /api/v1/frames/render` | `template_html` | `size` | — (n/a, no image generation) |
277
- | `POST /api/v1/templates/preview` | `template_html` | `size` | — |
278
- | `POST /api/v1/pipelines/standard` | `frame_template_inline` | `frame_template_size` | `frame_template_type` |
279
-
280
- The pipeline endpoint uses the `frame_template_*` prefix because it already has a `frame_template` field (preset key). The single-frame endpoints use the shorter `template_html` because they don't.
281
-
282
- ## Tip — getting unstuck
283
-
284
- Every level has `--help`:
285
-
286
- ```bash
287
- rf --help # top-level overview
288
- rf pipelines --help # list of pipelines
289
- rf pipelines standard --help # full option reference
290
- rf tts edge --help # one specific command
291
- ```
292
-
293
- ## License
294
-
295
- Apache-2.0
1
+ # reelforge
2
+
3
+ > Turn a topic or script into a finished vertical video — narration, visuals, and subtitles, assembled for you. Every capability is a command, with `--help` at every level.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g reelforge
9
+ ```
10
+
11
+ Or use directly without install:
12
+
13
+ ```bash
14
+ npx reelforge <command>
15
+ ```
16
+
17
+ After install, two binaries are on your `PATH` — `reelforge` and the short alias `rf`. Both behave identically; the docs use `rf` from here on.
18
+
19
+ ```bash
20
+ rf --version # same as `reelforge --version`
21
+ ```
22
+
23
+ ## Quick start
24
+
25
+ The CLI ships pointing at the hosted service. Log in once, then call:
26
+
27
+ ```bash
28
+ npm install -g reelforge
29
+ rf login # opens browser; headless? rf login <api_key>
30
+ rf whoami # balance + api_keys
31
+ rf create "为什么我们还没找到外星文明?" # auto-saves to ./<title>-<id>.mp4 in cwd
32
+ ```
33
+
34
+ That's the whole story — no server to run.
35
+
36
+ ### Output behavior
37
+
38
+ | invocation | result |
39
+ |---|---|
40
+ | `rf create "..."` | Saves to `./<sanitized-title>-<task_id_short>.mp4`, prints the path |
41
+ | `rf create "..." -o ./videos/space.mp4` | Saves to that exact path (must include filename, not just a directory) |
42
+ | `rf create "..." --no-download` | Skips local save, prints JSON result with `video_url` |
43
+ | `rf create "..." \| jq .video_url` | When stdout is piped, download is skipped automatically |
44
+
45
+ ## Global options
46
+
47
+ | flag | description |
48
+ |---|---|
49
+ | `-s, --server <url>` | Server URL (overrides `$REELFORGE_SERVER`; defaults to the hosted service) |
50
+ | `-k, --api-key <key>` | API key (overrides `$REELFORGE_API_KEY` and `reelforge login` saved key) |
51
+ | `--json` | Output raw JSON instead of pretty text — pipe-friendly |
52
+ | `--quiet` | Suppress informational messages on stderr |
53
+ | `-v, --version` | Show CLI version |
54
+ | `-h, --help` | Show help (works on every sub-command) |
55
+
56
+ ## Command map
57
+
58
+ Run `rf <command> --help` for full details on any of these.
59
+
60
+ ### Core capabilities
61
+
62
+ | command | what it does |
63
+ |---|---|
64
+ | `llm chat -p <text>` | Send one prompt to the configured model |
65
+ | `llm presets` | List built-in model presets |
66
+ | `tts ... -t <text> -o out.mp3` | Text-to-speech (free local + cloud voice options) |
67
+ | `tts voices [--locale zh]` | List supported voices |
68
+ | `images generate -p <prompt>` | Image generation |
69
+
70
+ ### Content / audio / subtitle atomics
71
+
72
+ | command | what it does |
73
+ |---|---|
74
+ | `content scene-plan -t <topic>` | Single LLM call: title + master script + per-scene image prompts (replaces the old narration / split / image-prompts / title trio) |
75
+ | `content scene-plan --script <text-or-@file>` | Same, but the user supplies the script verbatim — LLM only segments and writes image prompts |
76
+ | `audio transcribe -f <file>` / `--url <url>` | Speech-to-text with word + segment timestamps |
77
+ | `subtitles split -t <text-or-@file>` | Deterministic tiered-punctuation subtitle line splitter (pure function, zero billing) |
78
+
79
+ ### Composition
80
+
81
+ | command | what it does |
82
+ |---|---|
83
+ | `templates list [--size 1080x1920] [--type image]` | List HTML frame templates |
84
+ | `templates preview <keyOrPath> [-o out.png]` | Render a preview from a preset key **or your own local .html file** |
85
+ | `templates show <key> [-o file.html]` | Print or save the source HTML of any preset — copy it as a starting point for a custom template |
86
+ | `frames render -t <keyOrPath> --title ... --text ...` | Render a single composed frame to PNG. `-t` accepts a preset key **or a local .html path** |
87
+ | `compositions concat <v1> <v2> -o out.mp4` | FFmpeg concat (+ optional BGM) |
88
+ | `compositions bgm -i video.mp4 --bgm bgm.mp3 -o out.mp4` | Add background music |
89
+ | `compositions image-to-video -i img.png -a aud.mp3 -o out.mp4` | Build video from image + audio |
90
+ | `compositions overlay -v video.mp4 --overlay overlay.png -o out.mp4` | Overlay PNG on video |
91
+
92
+ ### End-to-end pipelines
93
+
94
+ All `pipelines *` commands submit an **async task** and (by default) poll until it finishes with a live progress indicator on stderr. Use `--no-wait` to return immediately with a `task_id`, then `rf tasks wait <id>` later.
95
+
96
+ The standard pipeline turns a topic or script into a finished vertical video — narration, visuals, and subtitles are generated and assembled for you. One continuous narration track; visuals cut at scene boundaries; subtitles cut at line boundaries.
97
+
98
+ | command | what it does |
99
+ |---|---|
100
+ | `pipelines standard -t <topic>` (or `--script <text>`) | Audio-first pipeline; `-d/--duration` and `-p/--pace` are the two main knobs |
101
+
102
+ #### Composition knobs
103
+
104
+ Three independent axes — mix and match as you like:
105
+
106
+ | flag | values | default | what changes |
107
+ |---|---|---|---|
108
+ | `--motion` | `off` / `lite` / `max` | `lite` | per-scene zoompan + crossfade intensity |
109
+ | `--layout` | `full` / `blur-bg` / `letterbox` | `full` | how the image sits in the canvas |
110
+ | `--subtitle-style` | `plate` / `stroke` / `cinema` | `plate` | subtitle look |
111
+
112
+ **Layout presets**:
113
+ - `full` — image fills the whole 1080×1920 canvas. Generates a 1080×1920 image. High-impact; best for human portraits, landscapes, 9:16-native content.
114
+ - `blur-bg` — image at 1080×1080 centered, top/bottom is a gaussian-blurred copy of the **same image** moving in sync with the foreground. Generates a 1080×1080 image (cheaper + no wasted pixels). Best for charts, screenshots, non-9:16 source content (小红书 / 抖音 style).
115
+ - `letterbox` — image at 1080×1080 centered, top/bottom is a solid matte (CSS color). Generates a 1080×1080 image. Cinematic / calm. Customize the matte with `--layout-matte-color "#1a1a1a"` (default `black`).
116
+
117
+ Examples:
118
+ ```bash
119
+ rf create "财经日报" --layout blur-bg # 小红书 / 抖音
120
+ rf create "纪录片片段" --layout letterbox --motion max # 电影感
121
+ rf create "..." --layout letterbox --layout-matte-color "#1a1a1a" # 柔和黑
122
+ ```
123
+
124
+ ### Resources
125
+
126
+ | command | what it does |
127
+ |---|---|
128
+ | `bgm list / upload <file> / delete <name>` | Manage background music |
129
+ | `files list / upload <file> / download <path> / delete <path>` | Manage user assets |
130
+
131
+ ### System
132
+
133
+ | command | what it does |
134
+ |---|---|
135
+ | `config get` | Read server config (keys masked) |
136
+ | `config set <key> <value>` | Update a dotted-path setting (e.g. `llm.api_key sk-xxx`) |
137
+ | `config patch <file>` | Apply a JSON-merge patch |
138
+ | `tasks list [--status running]` | List recent tasks |
139
+ | `tasks get <id>` / `tasks wait <id>` / `tasks cancel <id>` | Task lifecycle |
140
+ | `history list / get <id> / delete <id>` | Browse / delete completed runs |
141
+ | `health` | Server health + capability check |
142
+
143
+ ### Heavy brand customization (custom overlay templates)
144
+
145
+ `--motion` / `--layout` / `--subtitle-*` / `--brand-*` cover the common cases. For full visual identity ownership (custom path bar, accent decorations, light theme, footer block, etc.) pass a custom overlay HTML via `--frame-template <local.html | preset_key>`:
146
+
147
+ ```bash
148
+ rf templates show 1080x1920/default.html -o ./my-brand.html
149
+ # ...edit my-brand.html (change colors, add structure, etc.)...
150
+ rf create "我的视频" --frame-template ./my-brand.html
151
+ ```
152
+
153
+ **Contract for custom HTML**:
154
+
155
+ - Canvas is **1080×1920** (pipeline-fixed; don't declare a different size in `<meta>`).
156
+ - Background must be **transparent** — the scene image is composited by the renderer outside the HTML layer.
157
+ - **`{{image}}` no longer exists.** Using `<img src="{{image}}">` is a hard error at submit time. The image is composited by the renderer.
158
+ - The pipeline injects these placeholders for you:
159
+
160
+ | Placeholder | What it is |
161
+ |---|---|
162
+ | `{{title}}` `{{text}}` | per-frame content |
163
+ | `{{index}}` `{{total}}` | "scene N of M" — `{{total}}` is the LLM-decided scene count, don't hardcode |
164
+ | `{{layout}}` | `"full"` / `"blur-bg"` / `"letterbox"` — react via `body[data-layout="..."]` CSS to put title/subtitle in the matte zones when layout ≠ full |
165
+ | `{{subtitle_style}}` `{{subtitle_color}}` `{{subtitle_background}}` | subtitle preset + overrides |
166
+ | `{{brand_position}}` `{{brand_handle}}` `{{brand_slogan}}` `{{brand_logo}}` `{{brand_color}}` | brand-chrome inputs (use or ignore as you like) |
167
+
168
+ Inline HTML is hard-capped at 2 MB. The audio + motion + character-ref + scene-plan stages all keep working identically — only the overlay layer is yours.
169
+
170
+ **Publishing to short-video platforms (Douyin / TikTok / WeChat Channels)** — the default composition renders to the full 1080×1920 canvas, but those apps overlay UI on top/bottom/right and cover-crop ~96-180px on each side on taller phones. ReelForge does NOT bake platform-specific padding into the renderer. Look up reference safe-zone numbers + recommended `--media-anchor-y` values per platform:
171
+
172
+ ```bash
173
+ rf platform # overview table for all platforms
174
+ rf platform 抖音 # detail + anchor variants (alias of douyin)
175
+ rf platform tiktok
176
+ rf platform wechat # 视频号
177
+ ```
178
+
179
+ ## Examples
180
+
181
+ ```bash
182
+ # 1. One-click out a video (45s default, AI writes the script)
183
+ rf create "为什么我们还没找到外星文明?"
184
+
185
+ # 2. Longer video with a slower visual rhythm
186
+ rf create "深夜便利店的灯光" -d 90 -p slow
187
+
188
+ # 3. Your own script — no narration-splitting on your side, the pipeline handles it
189
+ rf create --script @./my-script.txt
190
+ rf create --script "雨水缓缓滑落在玻璃窗上,像是无声的泪珠。"
191
+
192
+ # 4. Preview-first workflow: scrub the storyboard in the browser
193
+ # before paying for the MP4 render. Finalize with `rf render` when satisfied.
194
+ rf create "..." --preview-only # opens browser studio
195
+ rf render <task-id> # produce the MP4
196
+
197
+ # 5. Push the image square up to grow the bottom matte (抖音 long-description
198
+ # case); subtitle position follows the image automatically.
199
+ rf create "..." --layout blur-bg --media-anchor-y 0.40
200
+ # See `rf platform 抖音` for the safe range and per-scenario recommendations.
201
+
202
+ # 6. Encoder budget — pick a quality preset or set an exact bitrate.
203
+ rf create "..." --quality draft # ~1 Mbps, ~3-4× smaller than default
204
+ rf create "..." --video-bitrate 750k # exact bitrate
205
+ rf create "..." --crf 28 # fine-grained control
206
+
207
+ # 7. Pick a built-in visual style preset
208
+ rf create "美食教程" --style photorealistic
209
+
210
+ # 5. Pipeline form with explicit output path
211
+ rf pipelines standard \
212
+ --script @./script.txt \
213
+ --frame-template 1080x1920/image_default.html \
214
+ -p normal -o smoke.mp4
215
+
216
+ # 6. Inspect existing tasks & redownload a finished video
217
+ rf tasks list --limit 5
218
+ rf history get <task-id> --download recovered.mp4
219
+
220
+ # 7. Atomics for stand-alone use
221
+ rf content scene-plan -t "雨天的玻璃窗" -d 45 --json | jq .scenes
222
+ rf audio transcribe -f narration.mp3 --json | jq '.words[:5]'
223
+ rf subtitles split -t @./narration.txt --min 10 --hard-max 24
224
+
225
+ # 8. JSON pipe for automation
226
+ rf llm presets --json | jq '.[].defaultModel'
227
+
228
+ # 9. Use your own HTML template (no PR/release needed)
229
+ # Any --frame-template that points to a local .html file is read and sent
230
+ # inline. Declare size inside the file via
231
+ # <meta name="template:width" content="1080">
232
+ # <meta name="template:height" content="1920">
233
+ # or pass --frame-template-size 1080x1920.
234
+ rf templates show 1080x1920/image_default.html -o my-brand.html # copy a preset
235
+ # ...edit my-brand.html to suit your style...
236
+ rf templates preview ./my-brand.html --title "Hello" -o preview.png
237
+ rf frames render -t ./my-brand.html --values '{"author":"Alice"}' -o frame.png
238
+ rf pipelines standard -t "宠物" --frame-template ./my-brand.html -o final.mp4
239
+ ```
240
+
241
+ ### Custom HTML templates
242
+
243
+ Easiest way to start: grab a preset as a reference.
244
+
245
+ ```bash
246
+ rf templates list # see all keys
247
+ rf templates show 1080x1920/static_default.html # print to stdout
248
+ rf templates show 1080x1920/image_default.html -o my-brand.html # save and edit
249
+ ```
250
+
251
+ `{{title}}`, `{{text}}`, `{{image}}`, `{{index}}`, `{{total}}` are reserved built-ins auto-injected by the pipeline; everything else uses the `{{name:type=default}}` DSL (`type` ∈ `text|number|color|bool`). Pass extras through `--values '{"author":"Alice"}'` (or `template_params` on the pipeline API).
252
+
253
+ - `{{index}}` — current scene number, 1-based
254
+ - `{{total}}` — scene count the LLM actually produced (use this for "scene N of M" badges; don't hardcode in `template_params`, the scene count is decided at runtime)
255
+
256
+ #### Template type — does the pipeline generate an AI image per scene?
257
+
258
+ When you ship an inline template through `rf create` / `rf pipelines standard`, ReelForge needs to know whether each scene should kick off image generation. Resolution priority (high → low):
259
+
260
+ 1. Explicit flag — `--frame-template-type image|static|asset` (or `frame_template_type` in the API body).
261
+ 2. Inside the HTML — `<meta name="template:type" content="image">` (or `static` / `asset`).
262
+ 3. **Default: `image`** — best practice for zero-config users. If your template doesn't reference scene imagery (pure-text card, etc.), declare `static` explicitly to skip image generation and its cost.
263
+
264
+ The placeholder `{{image}}` no longer doubles as a type signal — declare type explicitly.
265
+
266
+ Limits and safety:
267
+
268
+ - Max 2 MB per inline HTML.
269
+ - The render sandbox blocks `file://`, loopback / private / link-local IPs, CGNAT range, cloud-metadata, and `*.local` / `*.internal` hostnames. So your template can only reference public `https`/`http` resources or `data:` URIs.
270
+ - If the CLI is talking to a hosted server, local-path `--image` won't reach the server; either upload to `rf files upload` first or use an HTTPS URL / data: URI.
271
+
272
+ #### API field reference
273
+
274
+ | endpoint | inline HTML field | size field | type field |
275
+ |---|---|---|---|
276
+ | `POST /api/v1/frames/render` | `template_html` | `size` | — (n/a, no image generation) |
277
+ | `POST /api/v1/templates/preview` | `template_html` | `size` | — |
278
+ | `POST /api/v1/pipelines/standard` | `frame_template_inline` | `frame_template_size` | `frame_template_type` |
279
+
280
+ The pipeline endpoint uses the `frame_template_*` prefix because it already has a `frame_template` field (preset key). The single-frame endpoints use the shorter `template_html` because they don't.
281
+
282
+ ## Tip — getting unstuck
283
+
284
+ Every level has `--help`:
285
+
286
+ ```bash
287
+ rf --help # top-level overview
288
+ rf pipelines --help # list of pipelines
289
+ rf pipelines standard --help # full option reference
290
+ rf tts edge --help # one specific command
291
+ ```
292
+
293
+ ## License
294
+
295
+ Apache-2.0
package/bin/reelforge.js CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env node
2
- // Thin shim so `reelforge` (alias `rf`) is invokable globally. The actual
3
- // implementation is bundled to dist/ by `npm run build`.
4
- import("../dist/index.js").catch((err) => {
5
- // eslint-disable-next-line no-console
6
- console.error(err?.stack || err);
7
- process.exit(1);
8
- });
1
+ #!/usr/bin/env node
2
+ // Thin shim so `reelforge` (alias `rf`) is invokable globally. The actual
3
+ // implementation is bundled to dist/ by `npm run build`.
4
+ import("../dist/index.js").catch((err) => {
5
+ // eslint-disable-next-line no-console
6
+ console.error(err?.stack || err);
7
+ process.exit(1);
8
+ });
@@ -59,35 +59,35 @@ async function readAsDataUri(specPath, baseDir) {
59
59
  const buf = await fs.readFile(abs);
60
60
  return { dataUri: `data:${mime};base64,${buf.toString("base64")}`, bytes: buf.byteLength };
61
61
  }
62
- const EXAMPLE_SPEC_HINT = `{
63
- "experimental": "compose.v2",
64
- "audio": { "narration": "./narration.mp3" },
65
- "scenes": [
66
- { "start_sec": 0, "end_sec": 5, "image": "./s1.png", "motion": "zoom-in" },
67
- { "start_sec": 5, "end_sec": 11, "video": "./clip.mp4", "muted": true }
68
- ],
69
- "subtitles": [
70
- { "start_sec": 0, "end_sec": 5, "text": "为什么咖啡因让人精神" },
71
- { "start_sec": 5, "end_sec": 11, "text": "原来它跟睡眠物质是同一把钥匙" }
72
- ],
73
- "title": "咖啡因的真相"
62
+ const EXAMPLE_SPEC_HINT = `{
63
+ "experimental": "compose.v2",
64
+ "audio": { "narration": "./narration.mp3" },
65
+ "scenes": [
66
+ { "start_sec": 0, "end_sec": 5, "image": "./s1.png", "motion": "zoom-in" },
67
+ { "start_sec": 5, "end_sec": 11, "video": "./clip.mp4", "muted": true }
68
+ ],
69
+ "subtitles": [
70
+ { "start_sec": 0, "end_sec": 5, "text": "为什么咖啡因让人精神" },
71
+ { "start_sec": 5, "end_sec": 11, "text": "原来它跟睡眠物质是同一把钥匙" }
72
+ ],
73
+ "title": "咖啡因的真相"
74
74
  }`;
75
- const EXAMPLE_SPEC_V3_HINT = `{
76
- "experimental": "compose.v3",
77
- "audio": { "tts_voice": "熊小二" },
78
- "scenes": [
79
- {
80
- "video": "./s1.mp4", "muted": true,
81
- "narration": ["今天热得不行", "我跑厕所睡觉"],
82
- "intro_title": "热到躲厕所"
83
- },
84
- {
85
- "image": "./splash.jpg",
86
- "narration": ["主人你找拖鞋去吧"]
87
- }
88
- ],
89
- "subtitle_style": "stroke",
90
- "title": "贼喵被抓现行"
75
+ const EXAMPLE_SPEC_V3_HINT = `{
76
+ "experimental": "compose.v3",
77
+ "audio": { "tts_voice": "熊小二" },
78
+ "scenes": [
79
+ {
80
+ "video": "./s1.mp4", "muted": true,
81
+ "narration": ["今天热得不行", "我跑厕所睡觉"],
82
+ "intro_title": "热到躲厕所"
83
+ },
84
+ {
85
+ "image": "./splash.jpg",
86
+ "narration": ["主人你找拖鞋去吧"]
87
+ }
88
+ ],
89
+ "subtitle_style": "stroke",
90
+ "title": "贼喵被抓现行"
91
91
  }`;
92
92
  export function registerCompose(program) {
93
93
  program
@@ -194,10 +194,8 @@ function optsToBody(opts) {
194
194
  out.subtitle_background = opts.subtitleBackground;
195
195
  if (opts.subtitleBottom !== undefined && Number.isFinite(opts.subtitleBottom))
196
196
  out.subtitle_bottom_px = opts.subtitleBottom;
197
- if (opts.components !== undefined)
198
- out.image_only = !opts.components;
199
- if (opts.theme !== undefined && opts.theme.trim())
200
- out.theme = opts.theme.trim();
197
+ if (opts.profile !== undefined && opts.profile.trim())
198
+ out.profile = opts.profile.trim();
201
199
  if (opts.subtitleTranslate !== undefined) {
202
200
  const v = opts.subtitleTranslate.trim();
203
201
  out.subtitle_translate_to = /^(off|none|no)$/i.test(v) ? "" : v;
@@ -299,8 +297,7 @@ export function registerCreate(program) {
299
297
  .option("--subtitle-color <css>", "override subtitle text color, e.g. '#ffeb3b'. Omit for preset default.")
300
298
  .option("--subtitle-background <css>", "override plate-preset background, e.g. 'rgba(20,30,80,0.75)'. Other presets ignore.")
301
299
  .option("--subtitle-bottom <px>", "override the subtitle bottom offset in px (default 400, the lower-third position). blur-bg/letterbox images move up to clear it.", (v) => parseInt(v, 10))
302
- .option("--components", "render data COMPONENTS (charts / cards / terminals / kinetic numbers) for suitable scenes instead of only AI images (default: image-only). Pair with --theme to pick the look.")
303
- .option("--theme <id>", "single visual theme for the whole video: neo-brutal | bloomberg | editorial | terminal | swiss | liquid-glass | y2k | neon | bauhaus | ios | prime (财经/金融). Only used with --components. Omit → inferred from the script.")
300
+ .option("--profile <id>", "视频的「场景」(垂类):plain(默认,纯 AI 图,无组件)| finance(财经/金融,数据组件 + 鎏金深蓝)| mindset(财商认知,认知组件 + 暖纸黏土)| general(通用组件,中性皮)。选了 profile 即带出它的组件、配色、配图风、封面与字幕默认,可被其他 flag 覆盖。")
304
301
  .option("--subtitle-translate <lang>", "双语字幕:把每条字幕翻译成指定语言,以小一号文字显示在主字幕下方,如 'en'(英文)/ 'ja'(日文)。开启后字幕分段自动变短(主字幕保持单行)。默认:开(en);传 'off' 关闭(也可覆盖 recipe 设置)")
305
302
  .option("--cover", "给视频加一张设计封面图作为首帧。抖音/TikTok/视频号默认抓取首帧当 9 宫格缩略图——加了 cover 在 feed 里更出挑;不加则首帧是 scene-01 + 字幕。也可由 recipe 自动启用(cover.enabled=true)。")
306
303
  .option("--no-cover", "强制关闭封面,无视 recipe 设置")
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
- {
2
- "name": "reelforge",
3
- "version": "1.19.1",
4
- "description": "AI 视频生成 CLI。一句话主题或自己的脚本 → 自动出抖音/TikTok/视频号竖屏 MP4。安装即用:`reelforge` 或短别名 `rf`。",
5
- "license": "Apache-2.0",
6
- "type": "module",
7
- "bin": {
8
- "reelforge": "./bin/reelforge.js",
9
- "rf": "./bin/reelforge.js"
10
- },
11
- "files": [
12
- "bin",
13
- "dist",
14
- "README.md"
15
- ],
16
- "engines": {
17
- "node": ">=22"
18
- },
19
- "scripts": {
20
- "build": "tsc -p tsconfig.json && node scripts/copy-docs.mjs",
21
- "dev": "tsc -p tsconfig.json --watch",
22
- "typecheck": "tsc -p tsconfig.json --noEmit",
23
- "clean": "rimraf dist",
24
- "prepublishOnly": "npm run clean && npm run build"
25
- },
26
- "dependencies": {
27
- "commander": "^12.1.0",
28
- "kleur": "^4.1.5"
29
- },
30
- "devDependencies": {
31
- "@types/node": "^20.14.0",
32
- "rimraf": "^6.0.1",
33
- "typescript": "^5.5.0"
34
- },
35
- "keywords": [
36
- "reelforge",
37
- "ai-video",
38
- "douyin",
39
- "tiktok",
40
- "shorts",
41
- "vertical-video",
42
- "cli"
43
- ]
44
- }
1
+ {
2
+ "name": "reelforge",
3
+ "version": "1.20.1",
4
+ "description": "AI 视频生成 CLI。一句话主题或自己的脚本 → 自动出抖音/TikTok/视频号竖屏 MP4。安装即用:`reelforge` 或短别名 `rf`。",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "reelforge": "./bin/reelforge.js",
9
+ "rf": "./bin/reelforge.js"
10
+ },
11
+ "files": [
12
+ "bin",
13
+ "dist",
14
+ "README.md"
15
+ ],
16
+ "engines": {
17
+ "node": ">=22"
18
+ },
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json && node scripts/copy-docs.mjs",
21
+ "dev": "tsc -p tsconfig.json --watch",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit",
23
+ "clean": "rimraf dist",
24
+ "prepublishOnly": "npm run clean && npm run build"
25
+ },
26
+ "dependencies": {
27
+ "commander": "^12.1.0",
28
+ "kleur": "^4.1.5"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^20.14.0",
32
+ "rimraf": "^6.0.1",
33
+ "typescript": "^5.5.0"
34
+ },
35
+ "keywords": [
36
+ "reelforge",
37
+ "ai-video",
38
+ "douyin",
39
+ "tiktok",
40
+ "shorts",
41
+ "vertical-video",
42
+ "cli"
43
+ ]
44
+ }