@lunagerm-studio/video-cut-skill 0.0.0-stage → 1.0.0
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 +13 -2
- package/package.json +12 -4
- package/skills/ai-video-opening/SKILL.md +62 -0
- package/skills/ai-video-opening/references/export-and-validation.md +9 -0
- package/skills/ai-video-opening/references/motion-and-layout.md +7 -0
- package/skills/ai-video-opening/references/series-cases.md +7 -0
- package/skills/blue-white-ui-motion/SKILL.md +30 -0
- package/skills/blue-white-ui-motion/agents/openai.yaml +2 -0
- package/skills/blue-white-ui-motion/references/review.md +25 -0
- package/skills/chengfeng-videocut-skills/LICENSE +201 -0
- package/skills/chengfeng-videocut-skills/NOTICE.md +27 -0
- package/skills/chengfeng-videocut-skills/README.md +265 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/SKILL.md +37 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/agents/openai.yaml +2 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/scripts/cut_video.sh +182 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/scripts/detect_en_stutter.js +49 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/scripts/generate_review.js +1484 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/scripts/generate_srt_for_video.sh +75 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/scripts/generate_subtitles.js +141 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/scripts/review_server.js +381 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/scripts/volcengine_transcribe.sh +224 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255/scripts/watch_cut_done.js +86 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/1-/346/240/270/345/277/203/345/216/237/345/210/231.md +56 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/10-/345/210/240/351/231/244/351/243/216/351/231/251/345/210/206/345/261/202.md +44 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/11-/345/217/243/346/222/255/347/250/277/345/257/271/351/275/220.md +40 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/2-/350/257/255/346/260/224/350/257/215/346/243/200/346/265/213.md +30 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/3-/351/235/231/351/237/263/346/256/265/345/244/204/347/220/206.md +56 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/4-/351/207/215/345/244/215/346/243/200/346/265/213.md +77 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/5-/345/215/241/351/241/277/350/257/215.md +48 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/7-/350/277/236/347/273/255/350/257/255/346/260/224/350/257/215.md +32 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/9-/346/256/213/345/217/245/346/243/200/346/265/213.md +79 -0
- package/skills/chengfeng-videocut-skills//345/211/252/345/217/243/346/222/255//347/224/250/346/210/267/344/271/240/346/203/257/README.md +35 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/SKILL.md +32 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/agents/openai.yaml +2 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/references/artifact-contracts.md +168 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/scripts/animation_style.cjs +53 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/scripts/export_final_video.cjs +200 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/scripts/serve_range_preview.cjs +128 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/scripts/user_config.cjs +80 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/scripts/write_render_mode.cjs +149 -0
- package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207//347/224/250/346/210/267/351/205/215/347/275/256/default.json +4 -0
- package/skills/chengfeng-videocut-skills//350/207/252/350/277/233/345/214/226/README.md +23 -0
- package/skills/chengfeng-videocut-skills//350/207/252/350/277/233/345/214/226/SKILL.md +126 -0
- package/skills/continuous-collage-motion/SKILL.md +30 -0
- package/skills/continuous-collage-motion/agents/openai.yaml +4 -0
- package/skills/continuous-collage-motion/references/reference-motion.md +32 -0
- package/skills/continuous-collage-motion/references/shot-plan.md +31 -0
- package/skills/continuous-collage-motion/references/style-check.md +17 -0
- package/skills/table-video/LICENSES/ATTRIBUTION.md +31 -0
- package/skills/table-video/LICENSES/CC-BY-4.0.txt +396 -0
- package/skills/table-video/LICENSES/MIT.txt +21 -0
- package/skills/table-video/SKILL.md +32 -0
- package/skills/table-video/SOURCES.md +61 -0
- package/skills/table-video/agents/openai.yaml +2 -0
- package/skills/table-video/references/complete-motion.md +97 -0
- package/skills/table-video/references/examples/01_/344/270/244/346/256/265/346/274/224/347/244/272.md +73 -0
- package/skills/table-video/references/examples/02_/347/224/237/345/233/276/347/224/237/350/247/206/351/242/221/346/217/220/347/244/272/350/257/215/347/244/272/344/276/213.md +50 -0
- package/skills/table-video/references/examples/03_DESIGN/345/241/253/345/206/231/347/244/272/344/276/213.md +333 -0
- package/skills/table-video/references/examples/04_/350/277/236/347/273/255MG/346/255/243/345/217/215/350/277/207/347/250/213.md +101 -0
- package/skills/table-video/references/examples/05_/345/256/214/346/225/264/350/277/207/347/250/213/346/272/220/347/240/201.md +55 -0
- package/skills/table-video/references/examples/05_/346/205/242/351/225/234/345/244/264/344/270/216/345/220/214/346/236/204/345/233/276/345/233/236/345/275/222.md +35 -0
- package/skills/table-video/references/experience//345/255/227/345/271/225/344/270/216/345/260/201/351/235/242.md +30 -0
- package/skills/table-video/references/experience//345/275/225/345/261/217/345/211/252/350/276/221.md +31 -0
- package/skills/table-video/references/experience//346/211/213/345/212/250/347/224/237/345/233/276/347/224/237/350/247/206/351/242/221.md +53 -0
- package/skills/table-video/references/experience//350/247/206/350/247/211/345/217/231/344/272/213/344/270/216/350/277/236/347/273/255MG.md +102 -0
- package/skills/table-video/references/experience//351/225/234/345/244/264/346/216/250/350/277/233/344/270/216/350/275/254/345/234/272.md +178 -0
- package/skills/table-video/references/intake.md +84 -0
- package/skills/table-video/references/library.md +26 -0
- package/skills/table-video/references/motion-check-method.md +147 -0
- package/skills/table-video/references/planning.md +62 -0
- package/skills/table-video/references/production.md +70 -0
- package/skills/table-video/references/project-rules.md +26 -0
- package/skills/table-video/references/review-and-repair.md +64 -0
- package/skills/table-video/references/self-diagnosis.md +46 -0
- package/skills/table-video/references/sop/01_/345/277/253/351/200/237/345/274/200/345/247/213.md +55 -0
- package/skills/table-video/references/sop/02_/345/210/266/344/275/234SOP.md +77 -0
- package/skills/table-video/references/sop/03_/347/233/256/345/275/225/344/270/216/345/271/266/350/241/214/345/215/217/344/275/234.md +72 -0
- package/skills/table-video/references/sop/04_/351/252/214/346/224/266/344/270/216/350/277/224/344/277/256.md +146 -0
- package/skills/table-video/references/sop/05_/346/226/207/346/241/210/346/243/200/346/237/245_/345/217/257/351/200/211.md +55 -0
- package/skills/table-video/references/sop/06_/351/237/263/346/225/210/344/270/216/351/205/215/344/271/220_/345/217/257/351/200/211.md +138 -0
- package/skills/table-video/references/sop/07_/345/267/245/345/205/267/344/270/216/347/216/257/345/242/203.md +52 -0
- package/skills/table-video/references/sop/08_/346/235/245/346/272/220/344/270/216/350/256/270/345/217/257.md +36 -0
- package/skills/table-video/references/sop/09_DESIGN/345/273/272/347/253/213/344/270/216/346/240/241/351/252/214.md +52 -0
- package/skills/table-video/references/state-contract.md +267 -0
- package/skills/table-video/references/style-and-motion.md +163 -0
- package/skills/table-video/schemas/request.schema.json +44 -0
- package/skills/table-video/schemas/state.schema.json +140 -0
- package/skills/table-video/scripts/cli.mjs +35 -0
- package/skills/table-video/scripts/core.mjs +977 -0
- package/skills/table-video/scripts/gain-proof.mjs +48 -0
- package/skills/table-video/scripts/init-project.mjs +7 -0
- package/skills/table-video/scripts/motion-audit.mjs +589 -0
- package/skills/table-video/scripts/motion-check.mjs +345 -0
- package/skills/table-video/scripts/motion-gates.mjs +997 -0
- package/skills/table-video/scripts/motion-observation.cjs +204 -0
- package/skills/table-video/scripts/preflight.mjs +24 -0
- package/skills/table-video/scripts/process-locate.mjs +57 -0
- package/skills/table-video/scripts/render-motion-example.mjs +143 -0
- package/skills/table-video/scripts/save-reference-image.mjs +249 -0
- package/skills/table-video/scripts/schema.mjs +71 -0
- package/skills/table-video/scripts/stillness.mjs +386 -0
- package/skills/table-video/scripts/storage.mjs +328 -0
- package/skills/table-video/scripts/workflow.mjs +24 -0
- package/skills/talking-head-motion-workflow/SKILL.md +36 -0
- package/skills/talking-head-motion-workflow/agents/openai.yaml +4 -0
- package/skills/talking-head-motion-workflow/references/cinematic-motion-and-sync.md +72 -0
- package/skills/talking-head-motion-workflow/references/classic-ui.md +11 -0
- package/skills/talking-head-motion-workflow/references/history-coverage.md +50 -0
- package/skills/talking-head-motion-workflow/references/layered-assets-and-characters.md +39 -0
- package/skills/talking-head-motion-workflow/references/layout-references.md +41 -0
- package/skills/talking-head-motion-workflow/references/lens-shot-selection.md +138 -0
- package/skills/talking-head-motion-workflow/references/live-interface-motion.md +69 -0
- package/skills/talking-head-motion-workflow/references/motion-recipes.md +40 -0
- package/skills/talking-head-motion-workflow/references/mouse-meter2-case.md +113 -0
- package/skills/talking-head-motion-workflow/references/pop-collage.md +61 -0
- package/skills/talking-head-motion-workflow/references/portable-production.md +32 -0
- package/skills/talking-head-motion-workflow/references/production-requirements.md +85 -0
- package/skills/talking-head-motion-workflow/references/reference-library.md +41 -0
- package/skills/talking-head-motion-workflow/references/safe-areas-and-sound.md +47 -0
- package/skills/talking-head-motion-workflow/references/scene-illustrations.md +19 -0
- package/skills/talking-head-motion-workflow/references/sfx-presets.md +57 -0
- package/skills/talking-head-motion-workflow/references/style-13-github-production.md +33 -0
- package/skills/talking-head-motion-workflow/references/style-13-scene-performance.md +76 -0
- package/skills/talking-head-motion-workflow/references/style-presets.md +111 -0
- package/skills/talking-head-motion-workflow/references/table-video-spatial-mg.md +36 -0
- package/skills/talking-head-motion-workflow/scripts/extract_docx.py +19 -0
- package/skills/talking-head-motion-workflow/scripts/generate_foley.py +93 -0
- package/skills/talking-head-motion-workflow/scripts/render_sfx.py +135 -0
- package/skills/video-production-review/SKILL.md +30 -0
- package/skills/video-production-review/agents/openai.yaml +2 -0
- package/skills/video-production-review/references/episode-review-desk.md +30 -0
- package/skills/video-production-review/references/motion-adjustment-review.md +21 -0
- package/skills/video-production-workflow/SKILL.md +76 -0
- package/skills/video-production-workflow/agents/openai.yaml +2 -0
- package/skills/video-production-workflow/references/table-video-ep09.md +17 -0
- package/skills/video-production-workflow/scripts/check_motion_project.py +83 -0
- package/skills/video-reference-analysis/SKILL.md +32 -0
- package/skills/video-reference-analysis/agents/openai.yaml +2 -0
- package/skills/video-reference-analysis/references/case-format.md +95 -0
- package/skills/video-reference-analysis/references/production-method.md +21 -0
- package/skills/video-reference-analysis/scripts/library.py +371 -0
- package/skills/video-resource-access/SKILL.md +35 -0
- package/skills/video-resource-access/online.enabled +1 -0
- package/skills/video-resource-access/scripts/asset_client.py +159 -0
- package/skills/video-resource-access/scripts/remote_library.py +50 -0
- package//345/256/211/350/243/205/350/257/264/346/230/216.txt +5 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
input: subtitles_words.json
|
|
3
|
+
output: 连续语气词索引列表
|
|
4
|
+
pos: 规则,建议删优先级
|
|
5
|
+
|
|
6
|
+
架构守护者:一旦我被修改,请同步更新:
|
|
7
|
+
1. 所属文件夹的 README.md
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# 连续语气词
|
|
11
|
+
|
|
12
|
+
## 模式
|
|
13
|
+
|
|
14
|
+
两个语气词连在一起:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
嗯啊、啊呃、哦嗯、呃啊
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 检测
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
const fillerWords = ['嗯', '啊', '哎', '诶', '呃', '额', '唉', '哦', '噢', '呀', '欸'];
|
|
24
|
+
|
|
25
|
+
if (fillerWords.includes(curr) && fillerWords.includes(next)) {
|
|
26
|
+
markAsError(curr, next);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 删除策略
|
|
31
|
+
|
|
32
|
+
全部删除。
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
input: 按静音分隔的句子列表
|
|
3
|
+
output: 残句索引列表
|
|
4
|
+
pos: 规则,建议删优先级
|
|
5
|
+
|
|
6
|
+
架构守护者:一旦我被修改,请同步更新:
|
|
7
|
+
1. 所属文件夹的 README.md
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# 残句检测
|
|
11
|
+
|
|
12
|
+
> 🚨 **前置约束:残句一定是前面那句(没说完的),后面重说的完整版必须保留(见核心原则)**
|
|
13
|
+
|
|
14
|
+
## 定义
|
|
15
|
+
|
|
16
|
+
话说到一半突然停住,后面接了静音或重新开始。
|
|
17
|
+
|
|
18
|
+
## 核心原则
|
|
19
|
+
|
|
20
|
+
1. **删前保后**:残句是前面没说完的,删它;后面重说的完整版保留
|
|
21
|
+
2. **整句删除**:识别出残句后,从句首到句尾全部删除,不只是删结尾几个字
|
|
22
|
+
|
|
23
|
+
## 正确分析方法
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
✓ 正确:先分句 → 判断完整性 → 整句删除
|
|
27
|
+
✗ 错误:逐字扫描 → 发现异常结尾 → 只删结尾
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 步骤
|
|
31
|
+
|
|
32
|
+
1. **先按静音切分句子**(静音≥0.5s作为分隔)
|
|
33
|
+
2. **判断每句是否完整**(语义、语法是否自然)
|
|
34
|
+
3. **残句整体标记删除**(从 startIdx 到 endIdx)
|
|
35
|
+
|
|
36
|
+
## 模式
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
残句(整句) + [静音] + 完整句
|
|
40
|
+
↓
|
|
41
|
+
全删
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 案例
|
|
45
|
+
|
|
46
|
+
| 残句 | 后续 | 删除范围 |
|
|
47
|
+
|------|------|---------|
|
|
48
|
+
| "他呢" | [静音] + "这是我剪出来的..." | "他呢" 整句 |
|
|
49
|
+
| "为什么做这个东西呢一" | [静音] + "做这个东西的原因是" | **整句**(不只是"呢一") |
|
|
50
|
+
| "分本区别就是剪映它虽然" | [静音3s] + "眼影它是没有学习能力的" | 整句 + 静音 |
|
|
51
|
+
| "我们先打具体怎么做呢" | "首先" | 整句 |
|
|
52
|
+
| "打开我们的AI" | [静音] + "打开我们的AI然后..." | 整句(前一个不完整版本) |
|
|
53
|
+
|
|
54
|
+
## 判断标准
|
|
55
|
+
|
|
56
|
+
1. **句子不完整**:缺少宾语、谓语或结尾不自然
|
|
57
|
+
2. **后接静音**:残句后通常有明显停顿
|
|
58
|
+
3. **后有重说**:重新开始说类似内容
|
|
59
|
+
|
|
60
|
+
## 与重复句的区别
|
|
61
|
+
|
|
62
|
+
- **重复句**:两句都完整,只是开头相同 → 删较短的
|
|
63
|
+
- **残句**:前一句明显不完整,被打断了 → 删不完整的整句
|
|
64
|
+
|
|
65
|
+
## 常见残句特征
|
|
66
|
+
|
|
67
|
+
- 以"呢"、"吧"、"的"等虚词结尾但不构成完整句
|
|
68
|
+
- 以数字、量词结尾但后面没有名词
|
|
69
|
+
- 句子戛然而止,语义不完整
|
|
70
|
+
- 话说一半被打断,后面重新开始
|
|
71
|
+
|
|
72
|
+
## 易错点
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
❌ 只删"呢一"(异常结尾)
|
|
76
|
+
✓ 删"为什么做这个东西呢一"(整个残句)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**切记**:残句的问题不只是结尾,而是整句都没说完,所以要整句删除。
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
架构守护者:一旦本文件夹有任何变化(新增/删除/重命名文件),请更新此文件
|
|
3
|
+
-->
|
|
4
|
+
|
|
5
|
+
# 用户习惯
|
|
6
|
+
|
|
7
|
+
用户个人偏好,AI 审核时参考。
|
|
8
|
+
|
|
9
|
+
## 文件清单
|
|
10
|
+
|
|
11
|
+
| 文件 | 类型 | 内容 |
|
|
12
|
+
|------|------|------|
|
|
13
|
+
| 1-核心原则.md | 原则 | 删前保后(最高优先级) |
|
|
14
|
+
| 2-语气词检测.md | 偏好 | 嗯啊呃 + 删除边界 |
|
|
15
|
+
| 3-静音段处理.md | 阈值 | ≤0.2s忽略, 0.2-1s预选删, >1s建议删 |
|
|
16
|
+
| 4-重复检测.md | 偏好 | 句间重复 + 句内重复 + 重说纠正(合并) |
|
|
17
|
+
| 5-卡顿词.md | 偏好 | 那个那个、就是就是 |
|
|
18
|
+
| 7-连续语气词.md | 偏好 | 嗯啊、啊呃 |
|
|
19
|
+
| 9-残句检测.md | 偏好 | 话说一半被打断 |
|
|
20
|
+
| 10-删除风险分层.md | 方法论 | 删字安全/删意思危险,复核按风险投放 |
|
|
21
|
+
| 11-口播稿对齐.md | 方法论 | 有口播稿时做句子级对齐补漏 |
|
|
22
|
+
|
|
23
|
+
## AI 审核顺序(按优先级)
|
|
24
|
+
|
|
25
|
+
1. **静音 >1s** → 建议删
|
|
26
|
+
2. **残句** → 删整句(话说一半 + 静音)
|
|
27
|
+
3. **重复** → 删前面,保后面(句间/句内/纠正,见4-重复检测.md)
|
|
28
|
+
4. **卡顿词** → 删前面(那个那个、就是就是)
|
|
29
|
+
5. **语气词** → 标记待人工确认(嗯啊呃)
|
|
30
|
+
6. **有口播稿** → 句子级对齐补漏,抓整句级口误(见11-口播稿对齐.md)
|
|
31
|
+
|
|
32
|
+
## 两条核心方法论
|
|
33
|
+
|
|
34
|
+
- **删前保后**(方向):后说的通常更完整,删前面保后面。见 1-核心原则.md。
|
|
35
|
+
- **删除风险分层**(取舍):删"字"安全、删"意思"危险;复核(verify)只砸高风险项,低风险交网页人工。见 10-删除风险分层.md。
|
package/skills/chengfeng-videocut-skills//345/217/243/346/222/255/346/210/220/347/211/207/SKILL.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 分镜编排与成片合成
|
|
3
|
+
description: 口播成片、做分镜稿、时间线预览、合成口播视频和导出 MP4。接收剪后人声、字幕和逐镜素材,按项目配置完成组接与核验。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 分镜编排与成片合成|让每个切点有画面可看
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## 素材访问方式(服务器适配)
|
|
10
|
+
|
|
11
|
+
使用工具站线上发布包,或配置 `LUNAGREM_SKILL_TOKEN` 时,先读[在线素材交接](../../video-resource-access/SKILL.md)。素材检索与交接以该说明为准:先按台词用途/组件编号检索,再按需取回一个组件及依赖。不要打开内部素材库、案例预览或整库目录,也不要向用户返回库内预览链接;只预览本次任务输出的作品。原文里的本机盘符、assets 模板和素材库入口在此模式下通过接口取用,不假定这些目录已安装。
|
|
12
|
+
|
|
13
|
+
源码工作区未配置凭证时保留原本地流程;检索脚本可显式传 `--local --library 路径` 继续使用本地库。用户自己的原片、项目和导出仍在本地处理;线上模式不向素材库写入内容。
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
本入口重新编排节目分镜、预览和导出交接。基础实现来自 chengfeng / AI产品自由,沿用[上游声明](../NOTICE.md)和[Apache-2.0](../LICENSE)。
|
|
17
|
+
|
|
18
|
+
## 在剪后人声上安排镜头
|
|
19
|
+
|
|
20
|
+
接收剪后口播及对应 SRT。只有文稿时可先做文字方案,将待对声的位置写清。读取 `用户配置/default.json` 的画幅和主风格;显式参数优先,风格入口按 `动画/styles.json` 解析,默认项沿用原有小黑 SVG。先按意思分段,给每镜记录台词范围、观众要看见的东西、素材来源、第一帧何时进入、结果要停多久。展示点击操作要留出按钮和结果同屏的时间;一句态度或评价可以直接留给人物。
|
|
21
|
+
|
|
22
|
+
## 在同一个画布上看整段
|
|
23
|
+
|
|
24
|
+
从已确认分镜开始配镜;新分镜按本期已有确认方式交审。以剪后人声为主时钟,把录屏、人物、图形和独立声音按镜号定位。字幕文件用来对时,上屏遵从本期要求。按[制品接口](references/artifact-contracts.md)组装预览;HTML 镜头在时间线和导出中共用 `?timeline=1&render=1`。依次看一处录屏切入、一处图形交接和片尾。人物采用源色彩,叠加效果放到图形层。修改按镜号落回同一版工程。
|
|
25
|
+
|
|
26
|
+
## 从导出的文件交片
|
|
27
|
+
|
|
28
|
+
用现有导出脚本读取本期画幅、像素倍率与输出路径。打开实际 MP4,核对时长、画幅、音轨、关键点布局、控制条隐藏和前后镜接缝;需要对比肤色时按源时码在一致显示条件下看。将采用版 MP4、时间线预览和需继续编辑的工程入口交回总控。只约定看分镜或预览时,交到对应阶段即可。
|
|
29
|
+
|
|
30
|
+
## 执行已有工程
|
|
31
|
+
|
|
32
|
+
实际运行时,同时读取[本机运行手册(线上素材按需检索)](../../video-resource-access/SKILL.md)中与当前阶段有关的章节,沿用其命令参数、项目路径、数据格式与既有验收约定。该手册是此次改编前的本地版本,保留原有技术细节及来源记录。
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# 口播成片产物契约
|
|
2
|
+
|
|
3
|
+
这个文件只在需要实现 HTML 模块、时间线预览或最终播放器时读取。普通分镜稿阶段不需要加载。
|
|
4
|
+
|
|
5
|
+
## 视觉帧规则
|
|
6
|
+
|
|
7
|
+
- 所有最终画面都是固定尺寸帧;比例来自 `用户配置/default.json` 的 `aspectRatio`。默认 `3:4` 的 CSS 逻辑画布是 `1080x1440`,高清交付通过 DPR `1.5` 输出 `1620x2160`。用户配置只控制比例,逻辑画布和输出尺寸由脚本按比例映射。
|
|
8
|
+
- `.screen` 内不能滚动;某个时间点的画面必须是固定状态。
|
|
9
|
+
- 长网页必须变成截图视口、裁切、推拉缩放或明确步骤状态,不能直接用可滚动 iframe。
|
|
10
|
+
- 每个视觉帧只保留一个主视觉来源:一张图、一段视频、一个截图或一个 HTML 页面。
|
|
11
|
+
- 可以在主视觉上叠加标签、描边、箭头、圈选、高亮。
|
|
12
|
+
- 不要在画面底部加“画面动作”解释;动作说明放在分镜稿或 cue 表里。
|
|
13
|
+
- 信息图优先复用原图,再做局部高亮,不要默认重画。
|
|
14
|
+
- 成片画面不能露出素材路径、内部文件名、工作台说明或实现提示,例如“原图素材 · img/xxx.png”。这些信息只能出现在分镜稿、素材清单或审核页说明里。
|
|
15
|
+
- 没有必要的标题不要放标题。原图对比、结果页、表格页优先保留主视觉、模型名、指标名和短标签;不要为了填版面加解释性大标题。
|
|
16
|
+
- 长图、网页截图和结果页必须裁掉无信息的空白区。裁切应服务当前口播:说到哪个区域,就让哪个区域进入主视窗或放大;不要把底部空白完整保留下来。
|
|
17
|
+
- 数据表和指标图必须列对齐、字号克制、标签短。不要把大字塞进小方块;如果简单表格已经能讲清楚,优先用表格。
|
|
18
|
+
- 竖屏数据表必须吃到主视觉空间。不要把 3 行模型数据压成画面中间的一条小表;在最终数据对比阶段,任务说明、案例标签和总结注释应隐藏或让位,只保留表格、必要短标签和高亮。
|
|
19
|
+
|
|
20
|
+
## Cue 表
|
|
21
|
+
|
|
22
|
+
每个 cue 都是一个语义触发点,必须绑定到口播句子。
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
| Cue | 字幕 | 时间 | 口播句子 | 画面动作 |
|
|
26
|
+
|---|---:|---:|---|---|
|
|
27
|
+
| 4-3 | 21 | 00:38.7 | 以前没有 Codex 的话 | 画面切到“以前:要绕出去” |
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
不要只写 `step 1 / step 2 / step 3`。没有口播句子的 step 不可靠。
|
|
31
|
+
|
|
32
|
+
## HTML 模块
|
|
33
|
+
|
|
34
|
+
最小结构:
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<section class="screen step-0" id="screen">
|
|
38
|
+
...
|
|
39
|
+
</section>
|
|
40
|
+
|
|
41
|
+
<div class="hud">...</div>
|
|
42
|
+
<script src="render-mode.js"></script>
|
|
43
|
+
<script>
|
|
44
|
+
const screen = document.getElementById("screen");
|
|
45
|
+
|
|
46
|
+
function setStep(step) {
|
|
47
|
+
screen.className = `screen step-${Math.max(0, Math.min(step, MAX_STEP))}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
window.addEventListener("message", (event) => {
|
|
51
|
+
if (event.data?.type !== "set-step") return;
|
|
52
|
+
setStep(Number(event.data.step || 0));
|
|
53
|
+
});
|
|
54
|
+
</script>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
要求:
|
|
58
|
+
|
|
59
|
+
- 根节点使用 `.screen`。
|
|
60
|
+
- 状态由 `.step-N` 类控制。
|
|
61
|
+
- 监听 `postMessage({ type: "set-step", step })`。
|
|
62
|
+
- 同时支持 `postMessage({ type: "set-step", step, time })` 和 `window.__VIDEO_CURRENT_TIME__`;最终逐帧导出会反复 seek 到任意时间点,HTML 模块必须能从当前时间直接恢复到正确状态,不依赖自然播放过渡。
|
|
63
|
+
- 需要自然播放预览时可以用 GSAP timeline,但必须同时提供可确定复现的检查入口:`?static=1` 固定最终或代表性画面,复杂动画再提供 `?frame=step-name` / `?frame=mid` 这类定点状态,方便抽帧验收。
|
|
64
|
+
- 手动检查时可以保留 HUD;最终渲染必须通过 `render-mode.js` 隐藏。
|
|
65
|
+
- 最终渲染必须使用当前比例对应的固定逻辑画布坐标。默认 `1080x1440` 时,逻辑图、流程图、说明图使用统一主视觉区:宽约 `900px`、高约 `1040px`、水平居中;如果当前比例是 `16:9` 或 `4:3`,必须按实际逻辑画布重新换算主视觉区。不要在主视觉上写 `max-width: 520px`、`height: min(..., 620px)` 这类预览尺寸上限,否则放到成片里会变成“小图”。
|
|
66
|
+
- 响应式 CSS 只能服务手动预览;`?render=1` 下必须回到固定逻辑画布和统一安全区。`render-mode.js` 要把 `.screen` 或 body 直属 `.stage` 固定到逻辑画布,并移除主视觉容器的预览尺寸上限,例如 `.photo-frame`、`.chart-frame`、`.image-frame`、`.shot-frame`、`.dashboard-frame`、`.diagram`、`.table-wrap`、`.wrap` 的 `max-width` / `max-height`。HTML 模块之间的主视觉大小要一致,不能每个模块各自按内容自适应。
|
|
67
|
+
- 时间线预览页和最终播放器必须加载同一套渲染 URL:HTML 模块都用 `?timeline=1&render=1`。预览页只允许把最终画布等比缩放进窗口,不允许让 iframe 里的模块按预览窗口重新响应式排版。
|
|
68
|
+
- 最终逐帧导出时必须禁用 CSS transition / animation。状态变化由当前 `time` 或 `step` 决定,不要依赖 `.22s ease`、`requestAnimationFrame` 播放进度或真实时间累计。
|
|
69
|
+
- 使用 GSAP `from()` 动画的模块,在 `postMessage({ type: "set-step" })` 控制状态时必须显式恢复被动画改过的 `opacity`、`transform`、`display` 等属性。否则逐帧 seek 到中间时间点时,表格单元格、图片或标签可能保持透明。
|
|
70
|
+
- 口播点名某个模型、图片或案例时,对应视觉元素要有明确焦点动作,例如放大、移入中心、描边、圈选或其余元素退后;不能只做统一闪烁或统一入场。
|
|
71
|
+
- 需要解释动画、流程动画或手绘感动画时,先读 `用户配置/default.json` 的 `animationStyle`,再到 `动画/styles.json` 找对应的动画子 Skill;默认是 `xiaohei`。
|
|
72
|
+
- 需要手绘感高亮时,用 Rough.js;如果会增加不稳定性,用 SVG 兜底。
|
|
73
|
+
- Rough.js 不要每帧重画,只在 step、视口或图片尺寸变化时重画。
|
|
74
|
+
|
|
75
|
+
导出前抽检:
|
|
76
|
+
|
|
77
|
+
- 新增或修改 HTML 模块后,先用 final-player 在用户配置比例对应的 viewport 下抽该模块的关键帧,不只看单独 HTML 页面。
|
|
78
|
+
- 至少检查该模块第一步、最后一步,以及它放回时间线后的实际时间点。
|
|
79
|
+
- 如果模块提供了 `?frame=...` 定点状态,必须逐个检查这些状态是否无溢出、无遮挡、无标题/说明冗余、焦点对象足够大。
|
|
80
|
+
- 如果一条视频里有多个 HTML module,必须从 `final-player.html` 的 scenes 枚举所有 module 逐个抽帧;不要只检查刚改过或主观认为高风险的几页。漏检某一页时,最终导出会忠实保留那一页的小字、小框或预览比例问题。
|
|
81
|
+
- 如果 HTML 模块相对视频/截图明显偏小、偏大、偏上、偏下,先修模块坐标和 render mode,再整条导出。
|
|
82
|
+
- 如果时间线预览和导出视频大小不一致,优先检查 computed box:在预览 iframe 和 final-player iframe 中分别读取主视觉容器的 `getBoundingClientRect()`。同时确认导出脚本是用逻辑画布 viewport + DPR 输出高清,不是把 CSS 画布直接放大。常见问题是预览窗口较小没有触发 `max-width`,但导出画布是高清固定尺寸,`.photo-frame { max-width: 455px }` 这类规则会把导出画面压小。
|
|
83
|
+
|
|
84
|
+
## 时间线预览
|
|
85
|
+
|
|
86
|
+
预览播放器必须有:
|
|
87
|
+
|
|
88
|
+
- 播放 / 暂停
|
|
89
|
+
- 和原视频/原音频同步的进度条
|
|
90
|
+
- 音量控制
|
|
91
|
+
- 倍速:`1x`、`1.25x`、`1.5x`、`2x`
|
|
92
|
+
|
|
93
|
+
倍速必须同时影响隐藏的原视频时钟和可见视频片段,保证音画同步。
|
|
94
|
+
|
|
95
|
+
## 最终播放器
|
|
96
|
+
|
|
97
|
+
场景列表结构:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
const scenes = [
|
|
101
|
+
{ id: "1", kind: "video", start: 0, end: 7.62 },
|
|
102
|
+
{
|
|
103
|
+
id: "2",
|
|
104
|
+
kind: "html",
|
|
105
|
+
src: "module-02-proof.html",
|
|
106
|
+
start: 7.62,
|
|
107
|
+
end: 10.82,
|
|
108
|
+
maxStep: 1,
|
|
109
|
+
cueSteps: [
|
|
110
|
+
{ at: 7.62, step: 0 },
|
|
111
|
+
{ at: 9.00, step: 1 }
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
必须暴露:
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
window.seekTo = async function seekTo(time) {
|
|
121
|
+
// 加载当前场景,seek 视频或给 iframe 发送 set-step。
|
|
122
|
+
return { scene: currentScene.id, kind: currentScene.kind, time, step };
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
window.finalVideo = { scenes, totalDuration };
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
基础 CSS:
|
|
129
|
+
|
|
130
|
+
```css
|
|
131
|
+
html,
|
|
132
|
+
body,
|
|
133
|
+
#stage {
|
|
134
|
+
width: var(--frame-width, 1080px);
|
|
135
|
+
height: var(--frame-height, 1440px);
|
|
136
|
+
margin: 0;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
background: #f3ecdd;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
#stage video,
|
|
142
|
+
#stage iframe {
|
|
143
|
+
position: absolute;
|
|
144
|
+
inset: 0;
|
|
145
|
+
width: var(--frame-width, 1080px);
|
|
146
|
+
height: var(--frame-height, 1440px);
|
|
147
|
+
border: 0;
|
|
148
|
+
background: #f3ecdd;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
HTML 模块必须用 `?render=1` 加载。最终播放器不能出现控制条、HUD、审核信息或浏览器 UI。
|
|
153
|
+
|
|
154
|
+
## 验收命令
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
ffprobe -v error \
|
|
158
|
+
-show_entries format=duration,size:stream=index,codec_type,codec_name,width,height,r_frame_rate,sample_rate,channels \
|
|
159
|
+
-of json /absolute/path/to/final.mp4
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
抽关键帧示例:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
ffmpeg -y -ss 00:00:09.10 -i final.mp4 -frames:v 1 renders/final-check-009s.jpg
|
|
166
|
+
ffmpeg -y -ss 00:01:31.70 -i final.mp4 -frames:v 1 renders/final-check-092s.jpg
|
|
167
|
+
ffmpeg -y -ss 00:02:51.50 -i final.mp4 -frames:v 1 renders/final-check-172s.jpg
|
|
168
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { loadUserConfig } = require("./user_config.cjs");
|
|
4
|
+
|
|
5
|
+
const SKILL_DIR = path.resolve(__dirname, "..");
|
|
6
|
+
const DEFAULT_ANIMATION_STYLES_PATH = path.join(SKILL_DIR, "动画", "styles.json");
|
|
7
|
+
|
|
8
|
+
function readJson(filePath) {
|
|
9
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function resolveInsideAnimation(relativePath) {
|
|
13
|
+
return path.join(SKILL_DIR, "动画", relativePath);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function loadAnimationStyle(options = {}) {
|
|
17
|
+
const stylesPath = path.resolve(options.stylesPath || DEFAULT_ANIMATION_STYLES_PATH);
|
|
18
|
+
if (!fs.existsSync(stylesPath)) {
|
|
19
|
+
throw new Error(`Animation styles registry not found: ${stylesPath}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const userConfig = loadUserConfig({
|
|
23
|
+
configPath: options.userConfigPath || options.configPath,
|
|
24
|
+
});
|
|
25
|
+
const registry = readJson(stylesPath);
|
|
26
|
+
const styleName = String(options.style || userConfig.animationStyle || "xiaohei").trim();
|
|
27
|
+
const style = registry.styles && registry.styles[styleName];
|
|
28
|
+
if (!style) {
|
|
29
|
+
const available = Object.keys(registry.styles || {}).join(", ");
|
|
30
|
+
throw new Error(`Unknown animation style "${styleName}". Available styles: ${available}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
registry,
|
|
35
|
+
stylesPath,
|
|
36
|
+
userConfigPath: userConfig.configPath,
|
|
37
|
+
styleName,
|
|
38
|
+
label: style.label || styleName,
|
|
39
|
+
skillDir: style.skillDir ? resolveInsideAnimation(style.skillDir) : "",
|
|
40
|
+
skillFile: style.skillFile ? resolveInsideAnimation(style.skillFile) : "",
|
|
41
|
+
templateDir: style.templateDir ? resolveInsideAnimation(style.templateDir) : "",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function renderAnimationSummary(animationStyle) {
|
|
46
|
+
return `${animationStyle.label} (${animationStyle.styleName})`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = {
|
|
50
|
+
DEFAULT_ANIMATION_STYLES_PATH,
|
|
51
|
+
loadAnimationStyle,
|
|
52
|
+
renderAnimationSummary,
|
|
53
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { execFileSync } = require("child_process");
|
|
5
|
+
const { loadUserConfig, renderSummary } = require("./user_config.cjs");
|
|
6
|
+
|
|
7
|
+
function parseArgs(argv) {
|
|
8
|
+
const args = {};
|
|
9
|
+
for (let i = 2; i < argv.length; i += 1) {
|
|
10
|
+
const key = argv[i];
|
|
11
|
+
if (!key.startsWith("--")) continue;
|
|
12
|
+
const name = key.slice(2);
|
|
13
|
+
const next = argv[i + 1];
|
|
14
|
+
if (!next || next.startsWith("--")) {
|
|
15
|
+
args[name] = true;
|
|
16
|
+
} else {
|
|
17
|
+
args[name] = next;
|
|
18
|
+
i += 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return args;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function loadPlaywright() {
|
|
25
|
+
const candidates = [
|
|
26
|
+
process.env.PLAYWRIGHT_MODULE,
|
|
27
|
+
"playwright",
|
|
28
|
+
].filter(Boolean);
|
|
29
|
+
|
|
30
|
+
for (const candidate of candidates) {
|
|
31
|
+
try {
|
|
32
|
+
return require(candidate);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// Try the next known location.
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
throw new Error("Unable to load Playwright. Install it locally or set PLAYWRIGHT_MODULE.");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function findHeadlessShellCandidates() {
|
|
42
|
+
const cacheDir = path.join(process.env.HOME || "", "Library", "Caches", "ms-playwright");
|
|
43
|
+
if (!cacheDir || !fs.existsSync(cacheDir)) return [];
|
|
44
|
+
return fs
|
|
45
|
+
.readdirSync(cacheDir)
|
|
46
|
+
.filter((name) => name.startsWith("chromium_headless_shell-"))
|
|
47
|
+
.sort()
|
|
48
|
+
.reverse()
|
|
49
|
+
.map((name) => path.join(cacheDir, name, "chrome-headless-shell-mac-arm64", "chrome-headless-shell"))
|
|
50
|
+
.filter((candidate) => fs.existsSync(candidate));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function findBrowserExecutable(explicitPath) {
|
|
54
|
+
const candidates = [
|
|
55
|
+
explicitPath,
|
|
56
|
+
process.env.CHROME_EXECUTABLE,
|
|
57
|
+
...findHeadlessShellCandidates(),
|
|
58
|
+
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
59
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
60
|
+
].filter(Boolean);
|
|
61
|
+
|
|
62
|
+
return candidates.find((candidate) => fs.existsSync(candidate)) || "";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function requireArg(args, name) {
|
|
66
|
+
if (!args[name]) {
|
|
67
|
+
console.error(`[error] missing required argument: --${name}`);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
return args[name];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function main() {
|
|
74
|
+
const args = parseArgs(process.argv);
|
|
75
|
+
const projectDir = path.resolve(requireArg(args, "project-dir"));
|
|
76
|
+
const inputVideo = path.resolve(requireArg(args, "input-video"));
|
|
77
|
+
const userConfig = loadUserConfig({
|
|
78
|
+
configPath: args.config,
|
|
79
|
+
aspectRatio: args["aspect-ratio"] || args.ratio,
|
|
80
|
+
});
|
|
81
|
+
const player = args.player || "final-player.html";
|
|
82
|
+
const playerUrl = args["player-url"] || "";
|
|
83
|
+
const fps = Number(args.fps || 30);
|
|
84
|
+
const hasExplicitSize = Boolean(args.width || args.height);
|
|
85
|
+
const width = Number(args.width || userConfig.width);
|
|
86
|
+
const height = Number(args.height || userConfig.height);
|
|
87
|
+
const deviceScaleFactor = Number(
|
|
88
|
+
args["device-scale-factor"] || args.dpr || args.scale || (hasExplicitSize ? 1 : userConfig.deviceScaleFactor || 1)
|
|
89
|
+
);
|
|
90
|
+
const outputWidth = Math.round(width * deviceScaleFactor);
|
|
91
|
+
const outputHeight = Math.round(height * deviceScaleFactor);
|
|
92
|
+
const stageSelector = args.stage || "#stage";
|
|
93
|
+
const framesDir = path.resolve(projectDir, args["frames-dir"] || "renders/final-video-frames");
|
|
94
|
+
const output = path.resolve(projectDir, args.output || `renders/final-${outputWidth}x${outputHeight}.mp4`);
|
|
95
|
+
const tempVideo = path.resolve(projectDir, args["temp-video"] || "renders/final-video-only.mp4");
|
|
96
|
+
const quality = Number(args.quality || 100);
|
|
97
|
+
const requestedFrameFormat = String(args["frame-format"] || args["image-format"] || "png").toLowerCase();
|
|
98
|
+
const frameFormat = requestedFrameFormat === "png" ? "png" : "jpeg";
|
|
99
|
+
const frameExt = frameFormat === "png" ? "png" : "jpg";
|
|
100
|
+
const preset = args.preset || "slow";
|
|
101
|
+
const crf = String(args.crf || 14);
|
|
102
|
+
const audioBitrate = args["audio-bitrate"] || "192k";
|
|
103
|
+
|
|
104
|
+
if (!fs.existsSync(projectDir)) throw new Error(`Project directory not found: ${projectDir}`);
|
|
105
|
+
if (!fs.existsSync(inputVideo)) throw new Error(`Input video not found: ${inputVideo}`);
|
|
106
|
+
console.log(`[config] ${userConfig.configPath}`);
|
|
107
|
+
console.log(`[ratio] ${renderSummary(userConfig)}`);
|
|
108
|
+
console.log(`[capture] viewport=${width}x${height} dpr=${deviceScaleFactor} output=${outputWidth}x${outputHeight}`);
|
|
109
|
+
console.log(`[frames] format=${frameFormat}${frameFormat === "jpeg" ? ` quality=${quality}` : ""}`);
|
|
110
|
+
console.log(`[encode] preset=${preset} crf=${crf}`);
|
|
111
|
+
|
|
112
|
+
fs.rmSync(framesDir, { recursive: true, force: true });
|
|
113
|
+
fs.mkdirSync(framesDir, { recursive: true });
|
|
114
|
+
fs.mkdirSync(path.dirname(output), { recursive: true });
|
|
115
|
+
|
|
116
|
+
const { chromium } = loadPlaywright();
|
|
117
|
+
const browserExecutable = findBrowserExecutable(args["chrome-executable"] || args["browser-executable"]);
|
|
118
|
+
const launchOptions = browserExecutable
|
|
119
|
+
? { headless: true, executablePath: browserExecutable, timeout: Number(args["browser-timeout"] || 30000) }
|
|
120
|
+
: { headless: true, timeout: Number(args["browser-timeout"] || 30000) };
|
|
121
|
+
if (browserExecutable) console.log(`[browser] ${browserExecutable}`);
|
|
122
|
+
const browser = await chromium.launch(launchOptions);
|
|
123
|
+
const page = await browser.newPage({
|
|
124
|
+
viewport: { width, height },
|
|
125
|
+
deviceScaleFactor,
|
|
126
|
+
});
|
|
127
|
+
page.setDefaultTimeout(0);
|
|
128
|
+
|
|
129
|
+
const playerPath = path.join(projectDir, player);
|
|
130
|
+
const targetUrl = playerUrl || `file://${playerPath}`;
|
|
131
|
+
await page.goto(targetUrl, { waitUntil: "domcontentloaded" });
|
|
132
|
+
await page.waitForFunction(() => typeof window.seekTo === "function");
|
|
133
|
+
|
|
134
|
+
let duration = Number(args.duration || 0);
|
|
135
|
+
if (!duration) {
|
|
136
|
+
duration = await page.evaluate(() => window.finalVideo?.totalDuration || 0);
|
|
137
|
+
}
|
|
138
|
+
if (!duration) throw new Error("Unable to determine duration. Pass --duration or expose window.finalVideo.totalDuration.");
|
|
139
|
+
|
|
140
|
+
const stage = page.locator(stageSelector);
|
|
141
|
+
const frameCount = Math.ceil(duration * fps);
|
|
142
|
+
|
|
143
|
+
for (let i = 0; i < frameCount; i += 1) {
|
|
144
|
+
const time = i / fps;
|
|
145
|
+
await page.evaluate(async (t) => {
|
|
146
|
+
if (typeof window.seekTo !== "function") throw new Error("final-player.html must expose window.seekTo(time)");
|
|
147
|
+
await window.seekTo(t);
|
|
148
|
+
}, time);
|
|
149
|
+
|
|
150
|
+
const frameName = `frame-${String(i).padStart(5, "0")}.${frameExt}`;
|
|
151
|
+
const screenshotOptions = {
|
|
152
|
+
path: path.join(framesDir, frameName),
|
|
153
|
+
type: frameFormat,
|
|
154
|
+
scale: "device",
|
|
155
|
+
};
|
|
156
|
+
if (frameFormat === "jpeg") screenshotOptions.quality = quality;
|
|
157
|
+
await stage.screenshot(screenshotOptions);
|
|
158
|
+
|
|
159
|
+
if (i % 150 === 0 || i === frameCount - 1) {
|
|
160
|
+
const percent = (((i + 1) / frameCount) * 100).toFixed(1);
|
|
161
|
+
console.log(`[frames] ${i + 1}/${frameCount} ${percent}%`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
await browser.close();
|
|
166
|
+
|
|
167
|
+
fs.rmSync(tempVideo, { force: true });
|
|
168
|
+
fs.rmSync(output, { force: true });
|
|
169
|
+
|
|
170
|
+
execFileSync("ffmpeg", [
|
|
171
|
+
"-y",
|
|
172
|
+
"-framerate", String(fps),
|
|
173
|
+
"-i", path.join(framesDir, `frame-%05d.${frameExt}`),
|
|
174
|
+
"-c:v", "libx264",
|
|
175
|
+
"-preset", preset,
|
|
176
|
+
"-crf", crf,
|
|
177
|
+
"-pix_fmt", "yuv420p",
|
|
178
|
+
tempVideo,
|
|
179
|
+
], { stdio: "inherit" });
|
|
180
|
+
|
|
181
|
+
execFileSync("ffmpeg", [
|
|
182
|
+
"-y",
|
|
183
|
+
"-i", tempVideo,
|
|
184
|
+
"-i", inputVideo,
|
|
185
|
+
"-map", "0:v:0",
|
|
186
|
+
"-map", "1:a:0?",
|
|
187
|
+
"-c:v", "copy",
|
|
188
|
+
"-c:a", "aac",
|
|
189
|
+
"-b:a", audioBitrate,
|
|
190
|
+
"-shortest",
|
|
191
|
+
output,
|
|
192
|
+
], { stdio: "inherit" });
|
|
193
|
+
|
|
194
|
+
console.log(`[done] ${output}`);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
main().catch((error) => {
|
|
198
|
+
console.error(error);
|
|
199
|
+
process.exit(1);
|
|
200
|
+
});
|