Files
zyt/training-videos/scripts/gen-sheets.sh
T
long 3cd3553af2 feat: 新增 training-videos 素材流水线
AI 跟练的素材生产工具,产物写入 TUICallKit-Vue3/training:
- 教练动作帧:AI 设定稿 → 切帧对齐、锁脸、插帧 → 导出小程序帧与 COS 高清帧
- 示范视频:Remotion 渲染四个动作的示范视频
- 背景音乐:程序合成的原创循环音乐(npm run bgm)
2026-10-31 10:33:25 +08:00

39 lines
1.7 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/zsh
# 用本机 Codex(image_generation)生成连续动作设定稿:一张图里按阅读顺序画一个动作的全部帧
#
# 用法:scripts/gen-sheets.sh [动作 ...] (默认 squat raise jack march,并行生成)
# 产物:work/sheets/<动作>.png(透明背景 16:9,约 1672×941),日志 work/sheets/log_<动作>.txt
# 挑出满意的结果后:python3 scripts/coach_adopt.py <动作>,收进 assets/sheets 再跑 coach_frames.py
#
# 参考图:assets/coach-reference.png(角色)+ 第二张姿势参考:
# squat / march:起止关键姿势(assets/sheets/refs/<动作>_keys.jpg)
# raise / jack :程序画的逐帧人偶姿势图(coach_pose_guide.py),帧间距和左右都由程序决定
# 依赖:codex CLI 已登录,且开启 image_generation 功能(codex features list 可查)
set -u
ROOT=${0:a:h:h}
OUT=$ROOT/work/sheets
mkdir -p $OUT
REF=$ROOT/assets/coach-reference.png
gen_one() {
local move=$1 pose
case $move in
squat|march) pose=$ROOT/assets/sheets/refs/${move}_keys.jpg ;;
raise|jack)
pose=$OUT/guide_$move.png
python3 $ROOT/scripts/coach_pose_guide.py $move $pose > /dev/null ;;
*) echo "未知动作:$move"; return 1 ;;
esac
rm -f $OUT/$move.png
# -i 可以接多个文件,提示词前必须加 --,否则会被当成图片路径
codex exec --skip-git-repo-check --ephemeral -s workspace-write -C $OUT -i "$REF,$pose" -- "$(cat $ROOT/scripts/prompts/$move.txt)" \
< /dev/null > $OUT/log_$move.txt 2>&1
echo "$move: $(file -b $OUT/$move.png 2>/dev/null || echo 失败,见 log_$move.txt)"
}
for move in ${@:-squat raise jack march}; do
gen_one $move &
sleep 1
done
wait