修复线上视频导出失败 + 配音预览音画同步
- Dockerfile: 补装 ffmpeg 与中文字体 fonts-noto-cjk,修线上导出报 "No such file or directory: 'ffmpeg'" 及字幕中文方块;换阿里云 apt 源防构建超时 - export.py: 字幕字体加载加 Noto CJK glob 兜底,适配不同版本 fonts-noto-cjk - pipeline.tsx: 配音预览改 Web Audio 精确排程(借鉴 WebAV)——预解码 + source.start(when,offset) + 增量重排,正在发声的句绝不掐断,消除字幕音错位与卡顿 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,20 @@ def _load_font(size: int):
|
||||
return ImageFont.truetype(path, size, index=0)
|
||||
except Exception: # noqa: BLE001
|
||||
continue
|
||||
# 兜底:扫常见字体目录里任意 Noto CJK 文件(fonts-noto-cjk 不同版本文件名可能不同),
|
||||
# 找不到才退英文位图字体(中文会变方块)——保证线上装了 noto-cjk 就一定能用上
|
||||
import glob
|
||||
|
||||
for pattern in (
|
||||
"/usr/share/fonts/**/NotoSansCJK*.ttc",
|
||||
"/usr/share/fonts/**/NotoSansCJK*.otf",
|
||||
"/usr/share/fonts/**/NotoSerifCJK*.ttc",
|
||||
):
|
||||
for path in glob.glob(pattern, recursive=True):
|
||||
try:
|
||||
return ImageFont.truetype(path, size, index=0)
|
||||
except Exception: # noqa: BLE001
|
||||
continue
|
||||
return ImageFont.load_default()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user