Files
o2o-weather/admin/nalssigak/scripts/clips.sh
T

23 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# usage: clips.sh <작업 폴더> [woman_a woman_b man_a man_b 중 다시 만들 것]
# 작업 폴더에 woman_photo.png·man_photo.png(코디 사진)와 woman_a.txt·woman_b.txt·man_a.txt·man_b.txt(동작 설명)를 두면
# 4초 클립 4개(woman_a.mp4 …)를 만든다. 이미 있는 클립은 건너뛰고, 이름을 주면 그 클립만 지우고 다시 만든다.
set -euo pipefail
HERE=$(cd "$(dirname "$0")" && pwd)
WORK=$(cd "$1" && pwd); shift
cd "$WORK"
for name in "$@"; do rm -f "$name.mp4" "$name.workflow.json"; done
trap '"$HERE/server.sh" down' EXIT
negative=$(cat "$HERE/../templates/negative.txt")
for who in woman man; do
[ -s ${who}_first.png ] || ffmpeg -hide_banner -loglevel error -y -i ${who}_photo.png \
-vf "scale=1088:1920:force_original_aspect_ratio=increase:flags=lanczos,crop=1088:1920" -frames:v 1 ${who}_first.png
done
for name in woman_a woman_b man_a man_b; do
[ -s "$name.mp4" ] && { echo "$name 이미 있음"; continue; }
echo "== $name 시작 $(date +%H:%M:%S)"
python3 "$HERE/generate.py" --image "${name%_*}_first.png" --prompt-file "$name.txt" --negative "$negative" \
--duration 4 --seed $((RANDOM % 9000 + 100)) --anchor-end --keep-running --output "$name.mp4"
echo "== $name 완료 $(date +%H:%M:%S)"
done