fix: use clean white subtitle style
Some checks failed
自动更新代码和重启 / update-and-restart (push) Has been cancelled
CI检查 + 自动部署 / check (push) Has been cancelled
CI检查 + 自动部署 / deploy (push) Has been cancelled

This commit is contained in:
冰朔 2026-06-24 12:22:50 +08:00
parent e955f92aad
commit d11026c1e3
5 changed files with 114 additions and 20 deletions

View File

@ -126,7 +126,8 @@ JZAO外置盘: 产物存放地,不是状态主控。
| 固定道具合成路线 | ✅ 已建立 | `video-ai-system/plans/script-to-screen/EP01-LOCKED-PROP-COMPOSITING-ROUTE.hdlp` |
| 苏白+牌匾合成小样 | 🟡 技术通过·位置失败 | `video-ai-system/outputs/tests/TEST-COMP-001-SUBAI-PLAQUE-OVERLAY-RUN-001-REPORT.hdlp` |
| 牌匾固定贴图 | ✅ PNG已生成 | `video-ai-system/assets/props/PROP-TDZ-PLAQUE/texture/tdz-plaque-texture.png` |
| 字幕渲染合成 | ✅ 干净底片RUN-002通过 | `video-ai-system/outputs/tests/TEST-SUBTITLE-002-CLEAN-RUN-001-REPORT.hdlp` |
| 字幕渲染合成 | ✅ 纯白样式RUN-003通过 | `video-ai-system/outputs/tests/TEST-SUBTITLE-003-CLEAN-WHITE-RUN002-REPORT.hdlp` |
| 百宗会人群底片 | 🟡 RUN-002可作氛围候选 | `video-ai-system/outputs/tests/TEST-PROP-001-TDZ-PLAQUE-RUN-002-REPORT.hdlp` |
| 苏白TTS配音 | ✅ 工程测试通过 | `video-ai-system/outputs/tests/TEST-TTS-001-SUBAI-RUN-001-REPORT.hdlp` |
| 模型/成本路线 | ✅ 已建立 | `video-ai-system/knowledge/D144-MODEL-COST-ROUTE.hdlp` |
| 腾讯AI开发交接 | ✅ 已建立 | `video-ai-system/plans/D144-TENCENT-AI-DEV-HANDOFF.hdlp` |

View File

@ -18,7 +18,7 @@ Subtitle Renderer · 字幕渲染引擎
python subtitle-renderer.py --srt input.srt --video input.mp4 --output output.mp4
# 自定义字幕样式
python subtitle-renderer.py --srt input.srt --font-size 48 --font-color white --bg-color black --position bottom
python subtitle-renderer.py --srt input.srt --font-size 48 --font-color white --style clean-white --position bottom
# 作为模块导入
from subtitle_renderer import render_subtitles
@ -27,7 +27,7 @@ Subtitle Renderer · 字幕渲染引擎
字幕样式配置
--font-size : 字体大小默认 36
--font-color : 字体颜色默认 white
--bg-color : 背景色默认 semi-transparent black
--style : 字幕样式clean-white / black-box默认 clean-white
--position : 位置top / middle / bottom默认 bottom
--margin-bottom : 底部边距默认 100px
@ -62,16 +62,36 @@ except ImportError:
DEFAULT_STYLE = {
"font_size": 36,
"font_color": "white",
"bg_color": "rgba(0, 0, 0, 0.6)",
"bg_enabled": False,
"position": "bottom", # top / middle / bottom
"margin_bottom": 100,
"margin_horizontal": 60,
"stroke_color": "black",
"stroke_width": 2,
"stroke_width": 0,
"video_width": 1080,
"video_height": 1920,
}
SUBTITLE_STYLE_PRESETS = {
"clean-white": {
"font_color": "white",
"bg_enabled": False,
"stroke_width": 0,
},
"black-box": {
"font_color": "white",
"bg_enabled": True,
"bg_fill": (0, 0, 0, 160),
"stroke_width": 0,
},
"outlined-white": {
"font_color": "white",
"bg_enabled": False,
"stroke_width": 2,
"stroke_color": "black",
},
}
CHINESE_FONT_CANDIDATES = [
"/System/Library/Fonts/PingFang.ttc",
"/System/Library/Fonts/Hiragino Sans GB.ttc",
@ -132,20 +152,22 @@ def render_subtitle_png(
x = (width - text_width) // 2
y = (height - text_height) // 2
# 绘制背景(半透明黑底)
bg_padding = 20
bg_x1 = x - bg_padding
bg_y1 = y - bg_padding
bg_x2 = x + text_width + bg_padding
bg_y2 = y + text_height + bg_padding
draw.rectangle([bg_x1, bg_y1, bg_x2, bg_y2], fill=(0, 0, 0, 160))
# 可选背景。默认纯白字幕不画背景。
if style.get("bg_enabled", False):
bg_padding = 20
bg_x1 = x - bg_padding
bg_y1 = y - bg_padding
bg_x2 = x + text_width + bg_padding
bg_y2 = y + text_height + bg_padding
draw.rectangle([bg_x1, bg_y1, bg_x2, bg_y2], fill=style.get("bg_fill", (0, 0, 0, 160)))
# 绘制描边
# 可选描边。默认纯白字幕不描边。
stroke_width = style.get("stroke_width", 2)
stroke_color = style.get("stroke_color", "black")
for offset in range(-stroke_width, stroke_width + 1):
draw.text((x + offset, y), text, font=font, fill=stroke_color)
draw.text((x, y + offset), text, font=font, fill=stroke_color)
if stroke_width > 0:
for offset in range(-stroke_width, stroke_width + 1):
draw.text((x + offset, y), text, font=font, fill=stroke_color)
draw.text((x, y + offset), text, font=font, fill=stroke_color)
# 绘制主文本
font_color = style.get("font_color", "white")
@ -308,7 +330,7 @@ def main():
parser.add_argument("--output", help="输出视频路径(配合 --video 使用)")
parser.add_argument("--font-size", type=int, default=36, help="字体大小")
parser.add_argument("--font-color", default="white", help="字体颜色")
parser.add_argument("--bg-color", default="rgba(0,0,0,0.6)", help="背景色")
parser.add_argument("--style", default="clean-white", choices=sorted(SUBTITLE_STYLE_PRESETS.keys()), help="字幕样式")
parser.add_argument("--position", default="bottom", choices=["top", "middle", "bottom"], help="字幕位置")
parser.add_argument("--video-width", type=int, default=1080, help="视频宽度")
parser.add_argument("--video-height", type=int, default=1920, help="视频高度")
@ -317,9 +339,9 @@ def main():
# 构建样式字典
style = {
**SUBTITLE_STYLE_PRESETS[args.style],
"font_size": args.font_size,
"font_color": args.font_color,
"bg_color": args.bg_color,
"position": args.position,
"video_width": args.video_width,
"video_height": args.video_height,

View File

@ -112,7 +112,8 @@ preview-003: 暂不生成。
| 固定道具合成路线 | ✅ | `plans/script-to-screen/EP01-LOCKED-PROP-COMPOSITING-ROUTE.hdlp` |
| 苏白+牌匾合成小样 | 🟡 技术通过·位置失败 | `outputs/tests/TEST-COMP-001-SUBAI-PLAQUE-OVERLAY-RUN-001-REPORT.hdlp` |
| 牌匾固定贴图 | ✅ PNG已生成 | `assets/props/PROP-TDZ-PLAQUE/texture/tdz-plaque-texture.png` |
| 字幕渲染合成 | ✅ 干净底片RUN-002通过 | `outputs/tests/TEST-SUBTITLE-002-CLEAN-RUN-001-REPORT.hdlp` |
| 字幕渲染合成 | ✅ 纯白样式RUN-003通过 | `outputs/tests/TEST-SUBTITLE-003-CLEAN-WHITE-RUN002-REPORT.hdlp` |
| 百宗会人群底片 | 🟡 RUN-002可作氛围候选 | `outputs/tests/TEST-PROP-001-TDZ-PLAQUE-RUN-002-REPORT.hdlp` |
| 苏白TTS配音 | ✅ 工程测试通过 | `outputs/tests/TEST-TTS-001-SUBAI-RUN-001-REPORT.hdlp` |
| 模型/成本路线 | ✅ 已建立 | `knowledge/D144-MODEL-COST-ROUTE.hdlp` |
| 腾讯AI开发交接 | ✅ 已建立 | `plans/D144-TENCENT-AI-DEV-HANDOFF.hdlp` |
@ -208,6 +209,8 @@ preview-003: 暂不生成。
- [x] 执行 TEST-COMP-001 RUN-001: 苏白底片+固定牌匾合成 → 技术通过但位置失败
- [x] 修复字幕管线: SRT→PNG→FFmpeg overlay合成 → `outputs/tests/TEST-SUBTITLE-001-RUN-001-REPORT.hdlp`
- [x] 纠正字幕测试底片: 使用干净苏白视频重跑 → `outputs/tests/TEST-SUBTITLE-002-CLEAN-RUN-001-REPORT.hdlp`
- [x] 调整字幕默认风格为纯白无黑底/无阴影 → `outputs/tests/TEST-SUBTITLE-003-CLEAN-WHITE-RUN002-REPORT.hdlp`
- [x] 重定性 RUN-002: 牌匾一致性失败,但百宗会人群氛围可用
- [x] 测试苏白Edge-TTS工程配音 → `outputs/tests/TEST-TTS-001-SUBAI-RUN-001-REPORT.hdlp`
- [x] 建立模型/成本路线 → `knowledge/D144-MODEL-COST-ROUTE.hdlp`
- [x] 建立腾讯AI人格体开发交接清单 → `plans/D144-TENCENT-AI-DEV-HANDOFF.hdlp`

View File

@ -55,6 +55,7 @@ pass:
- 牌匾仍为竖式。
- “天道宗”三字大体可读。
- 苏白白衣、少年感和开口表演仍可见。
- 百宗会有人来人往,环境氛围和群像流动感可用。
fail:
- 不是竖屏正片构图。
@ -70,7 +71,7 @@ fail:
```
status: FAIL_FOR_SAME_SCENE_CONTINUITY
approved_for: 经验样本
approved_for: 环境/人群氛围候选底片、经验样本
not_approved_for: E1-SHOT03正片、跨镜最终资产
```
@ -85,3 +86,10 @@ not_approved_for: E1-SHOT03正片、跨镜最终资产
3. 通过剪辑/合成保证竖屏构图和牌匾位置。
```
D144补充:
```
用户反馈: 这个底片“有人来人往这些”是可用的。
修正裁决: 不作为牌匾同场一致性通过,但保留为百宗会人群/环境氛围候选。
可用于后续环境参考、群众氛围参考、横版概念底片。
```

View File

@ -0,0 +1,60 @@
# TEST-SUBTITLE-003 · RUN-002底片纯白字幕报告
> HLDP://video-ai-system/outputs/tests/TEST-SUBTITLE-003-CLEAN-WHITE-RUN002-REPORT
> 类型: 字幕样式测试 · clean-white
> 日期: D144 · 2026-06-24 12:20 CST
> 铸渊 ICE-GL-ZY001
---
## 输入
```
base_video: /Volumes/JZAO/铸渊-ICE-GL-ZY001/OUT-输出/视频/zai-fu-fei-xiu-xian/ep01/tests/TEST-PROP-001-TDZ-PLAQUE-RUN-002-SUBAI-SAME-SCENE.mp4
subtitle_style: clean-white
output: /Volumes/JZAO/铸渊-ICE-GL-ZY001/OUT-输出/视频/zai-fu-fei-xiu-xian/ep01/tests/TEST-SUBTITLE-003-RUN002-CLEAN-WHITE.mp4
```
---
## 用户反馈对应
```
字幕不要半透明黑底/阴影感。
纯白色字幕即可。
```
---
## 观察
```
pass:
- 字幕为纯白。
- 无黑底。
- 无描边阴影。
- 中文显示正常。
- RUN-002底片有人来人往百宗会环境氛围可用。
risk:
- 纯白字幕在浅色背景上可能读性下降。
- 最终商用样式仍需按镜头亮度做安全检查。
```
---
## 裁决
```
status: PASS_FOR_CLEAN_WHITE_STYLE_TEST
approved_for: 当前字幕默认风格候选
not_approved_for: 所有镜头最终免检样式
```
下一步:
```
subtitle-renderer.py 默认样式改为 clean-white。
每个镜头烧字幕后仍需抽帧检查可读性。
```