컷별 댓글 추천 작업을 태스크 단위로 되돌릴 수 있게 버전관리를 시작한다. .gitignore 로 영상·캐시(.downloads 2.7G, .comments 72M, .media 28M)와 비밀키(.gemini_key)를 제외했다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
"""1단 CLI: 영상 1개 → 점프컷 CapCut 드래프트.
|
|
|
|
사용:
|
|
python build_jumpcut.py <video> [draft_name]
|
|
|
|
검증은 빌드 성공이 아니라 CapCut 에서 직접 재생으로 한다.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
# Windows 콘솔에서 한글 깨짐 방지
|
|
try:
|
|
sys.stdout.reconfigure(encoding="utf-8")
|
|
except Exception:
|
|
pass
|
|
|
|
from capcut_agent.probe import probe
|
|
from capcut_agent.silence import detect_speech_segments
|
|
from capcut_agent.draft import build_jumpcut_draft
|
|
|
|
|
|
def main(argv: list[str]) -> int:
|
|
if len(argv) < 2:
|
|
print("usage: python build_jumpcut.py <video> [draft_name]")
|
|
return 2
|
|
|
|
video = os.path.abspath(argv[1])
|
|
if not os.path.isfile(video):
|
|
print(f"파일 없음: {video}")
|
|
return 2
|
|
|
|
name = argv[2] if len(argv) > 2 else (
|
|
os.path.splitext(os.path.basename(video))[0] + "_jumpcut"
|
|
)
|
|
|
|
t0 = time.time()
|
|
meta = probe(video)
|
|
print(f"[probe] {meta.width}x{meta.height} @ {meta.fps}fps, {meta.duration:.2f}s")
|
|
|
|
segs = detect_speech_segments(video, meta.duration)
|
|
speech_total = sum(e - s for s, e in segs)
|
|
print(f"[silence] 발화 {len(segs)}개 구간, 합계 {speech_total:.2f}s "
|
|
f"(원본 {meta.duration:.2f}s, 컷 {meta.duration - speech_total:.2f}s 제거)")
|
|
|
|
path = build_jumpcut_draft(video, segs, meta, name)
|
|
print(f"[draft] 생성 완료 → {path}")
|
|
print(f"[done] {time.time() - t0:.1f}s. CapCut 에서 '{name}' 열어 재생 검증하세요.")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main(sys.argv))
|