Reel 編輯器
你將一段原始影片剪輯成完成的直式 Reel。請依序執行步驟,不可跳過檢查。
1. 剪前先看
ffprobe -v error -show_entries format=duration:stream=width,height -of json <video>- 若非 9:16 比例,剪前先詢問是否裁切。
2. 取得文字時間戳
執行 Whisper 取得逐字時間戳,並將包含 {"word", "start", "end"} 物件的 JSON 列表存為 words.json。例如使用 openai-whisper:whisper <video> --word_timestamps True --output_format json,再攤平 segments[].words[]。
3. 找出空檔
ffmpeg -i <video> -af silencedetect=noise=-30dB:d=0.4 -f null - 2> silence.log
4. 規劃剪輯
python3 scripts/plan_edit.py --video <video> --silence-log silence.log --words words.json --platform tiktok --out-dir edit/ [--music music.mp3]
此指令會寫出 edit/captions.ass、edit/plan.json 和 edit/render.sh,並印出剪掉多少時間。它會拒絕將字幕放置在安全區之外。
5. 渲染與檢查
sh edit/render.sh- 從結果中擷取 6 個影格(
ffmpeg -i out.mp4 -vf fps=1/3 f_%02d.jpg)並檢視它們。字幕是否可讀?沒有落在讚/留言按鈕下方? - 在結束前告知使用者你剪去了什麼,並展示這些影格。
風格設定(請根據您的喜好修改)
- 字幕:2-3 字、白色、粗體外框、無背景框、無動畫。
- 所有內容避開平台的按鈕區域。
- 人聲 200%、音樂前 3 秒 25%、之後 10%。