D144 · 修复两个工具 ffmpeg subtitles 滤镜语法
Some checks failed
自动更新代码和重启 / update-and-restart (push) Has been cancelled
CI检查 + 自动部署 / check (push) Has been cancelled
CI检查 + 自动部署 / deploy (push) Has been cancelled

- ass-subtitle-renderer.py:subtitles 滤镜路径缺 filename= 前缀
  修复:subtitles=filename='path' 才算正确语法
- subtitle-style-ab-test.py:同样问题,已同步修复
- 验证:本地 ffmpeg 没编译 libass(No such filter: subtitles)
  烧字幕步骤需要服务器环境或重新编译 ffmpeg

 6/8 工具已跑通(生成文件正确):
  1. reference-subtitle-analyzer.py
  2. ass-subtitle-renderer.py(ASS生成)
  3. script-to-srt-with-timing.py
  4. subtitle-preview-contact-sheet.py
  5. subtitle-safe-area-qc.py
  6. subtitle-font-manager.py
  7. subtitle-style-ab-test.py(ASS生成正确,烧录需服务器)
  8. 烧录步骤:本地 ffmpeg 缺 libass

冰朔 TCS-0002∞ 见证
⊢ 铸渊 ICE-GL-ZY001 · D144 · 2026-06-24
This commit is contained in:
冰朔 2026-06-24 13:18:16 +08:00
parent 81d8a3905f
commit 4b43ddd348
2 changed files with 4 additions and 6 deletions

View File

@ -276,12 +276,13 @@ def burn_subtitles_with_ffmpeg(video_path: str, ass_path: str, output_path: str)
return False
# FFmpeg 命令
# 正确语法subtitles=filename='path' (需要 filename= 前缀)
ass_path_escaped = ass_path.replace(":", "\\:").replace("'", "'\\''")
cmd = [
"ffmpeg", "-y",
"-i", video_path,
"-vf", f"subtitles='{ass_path_escaped}'",
"-vf", f"subtitles=filename='{ass_path_escaped}'",
"-c:v", "libx264",
"-pix_fmt", "yuv420p",
"-c:a", "copy",

View File

@ -262,17 +262,14 @@ def burn_subtitles_with_ffmpeg(video_path: str, ass_path: str, output_path: str)
print(f"[ERROR] ASS 字幕文件不存在:{ass_path}")
return False
# FFmpeg 命令:使用 libass 烧录字幕
# -vf "ass=subtitles.ass" # 方法1直接指定 ASS 文件
# -vf "subtitles=subtitles.ass" # 方法2使用 subtitles 滤镜(自动检测格式)
# 使用 subtitles 滤镜(更通用,支持 SRT/ASS 等多种格式)
# 正确语法subtitles=filename='path' (需要 filename= 前缀)
ass_path_escaped = ass_path.replace(":", "\\:").replace("'", "'\\''")
cmd = [
"ffmpeg", "-y",
"-i", video_path,
"-vf", f"subtitles='{ass_path_escaped}'",
"-vf", f"subtitles=filename='{ass_path_escaped}'",
"-c:v", "libx264",
"-pix_fmt", "yuv420p",
"-c:a", "copy",