refactor: extract config.py, add burn_only, fix title_segments and font size

- Extract all path/API config to config.py (single source of truth)
- Add run.py / burn_only.py / run.bat / burn.bat entry points
- burn_only: skip transcription/subtitle gen, fast reburn existing SRTs
- Fix title_segments: use transcript keyword time for split point
- Fix subtitle: each overlapping title shows max title_duration (not full clip)
- Fix burn_only font size: default from 90 to 60
- Delete old run_lesson1.bat/py, temp debug scripts
- Update README, ARCHITECTURE, CHANGELOG, add USAGE.md
This commit is contained in:
hmo
2026-05-03 23:22:10 +08:00
parent cf5004cf6a
commit aad1548348
39 changed files with 826 additions and 556 deletions
+73
View File
@@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
"""
快速烧录脚本 - 跳过所有转录/字幕生成步骤
直接用已有的 clips + title.srt + content.srt 合并烧录
用法:
python burn_only.py
python burn_only.py "D:\\path\\to\\output_dir"
"""
import sys
import os
# 导入统一配置
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import config
OUTPUT = config.OUTPUT
if len(sys.argv) > 1:
OUTPUT = sys.argv[1]
TITLE_SRT = os.path.join(OUTPUT, "subs", "v1_title.srt")
CONTENT_SRT = os.path.join(OUTPUT, "subs", "v1_content.srt")
CLIPS_DIR = os.path.join(OUTPUT, "intermediates")
MERGED_PATH = os.path.join(OUTPUT, "concat_merged.mp4")
print(f"[Fast Burn Mode]")
print(f"Output: {OUTPUT}")
print()
# 检查必要文件
if not os.path.exists(TITLE_SRT):
print(f"ERROR: title.srt not found\n{TITLE_SRT}")
sys.exit(1)
if not os.path.exists(CONTENT_SRT):
print(f"ERROR: content.srt not found\n{CONTENT_SRT}")
sys.exit(1)
# 导入 pipelinesrc 目录)
src_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "src")
sys.path.insert(0, src_dir)
from core import Pipeline
# 构造 minimal config(只需要 output_dir 和 video_params
pipeline_config = {
'output_dir': OUTPUT,
'clips': [],
'video_src': None,
'video_params': {},
'term_corrections': {},
'api_key': '',
'api_host': '',
}
pipeline = Pipeline(pipeline_config)
# 合并视频(如需要)
if os.path.exists(MERGED_PATH):
print(f"Found existing merged video: {MERGED_PATH}")
merged_path = MERGED_PATH
else:
import glob
clip_files = sorted(glob.glob(os.path.join(CLIPS_DIR, "clip*.mp4")))
if not clip_files:
print(f"ERROR: No clip videos found\n{CLIPS_DIR}\\clip*.mp4")
sys.exit(1)
print(f"Merging {len(clip_files)} clips...")
merged_path = pipeline.step_merge(clip_files)
print(f"Merged: {merged_path}")
# 烧录
print("Burning subtitles...")
final_path = pipeline.step_burn(merged_path, TITLE_SRT, CONTENT_SRT)
print(f"\nDone: {final_path}")