# -*- 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) # 导入 pipeline(src 目录) 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}")