D144 · 修复两个工具 ffmpeg subtitles 滤镜语法
- 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:
parent
81d8a3905f
commit
4b43ddd348
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user