feat: 카드·영상 스크립트를 윈도우에서도 돌게 — 외부 프로그램 위치를 scripts/bin.mjs 로 모음, 크롬이 45초 넘게 멈추면 그 장만 다시 찍음, claude 프롬프트는 stdin 으로
This commit is contained in:
1 parent
63b4fa74fe
commit
e28359ff47
15 files changed
+150
-51
No files matched your search
@@ -16,7 +16,7 @@ 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" \
|
||||
"${PYTHON:-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
|
||||
@@ -30,12 +30,12 @@ def main():
|
||||
"",
|
||||
Path(args.prompt_file).read_text(encoding="utf-8").strip(),
|
||||
])
|
||||
command = ["codex", "exec", "--skip-git-repo-check", "-C", str(work), "-s", "workspace-write", "-m", IMAGE_MODEL,
|
||||
command = [os.environ.get("CODEX_BIN") or shutil.which("codex") or "codex", "exec", "--skip-git-repo-check", "-C", str(work), "-s", "workspace-write", "-m", IMAGE_MODEL,
|
||||
"-c", 'model_reasoning_effort="low"']
|
||||
for image in args.image:
|
||||
command += ["-i", str(Path(image).resolve())]
|
||||
try:
|
||||
subprocess.run(command, input=task, text=True, stdout=subprocess.DEVNULL, check=True)
|
||||
subprocess.run(command, input=task, encoding="utf-8", stdout=subprocess.DEVNULL, check=True)
|
||||
result = work / "result.png"
|
||||
if not result.is_file():
|
||||
pngs = sorted(work.glob("*.png"))
|
||||
|
||||
@@ -7,12 +7,14 @@ set -euo pipefail
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
WORK=$(cd "$1" && pwd)
|
||||
MUSIC=${2:-}
|
||||
# 윈도우는 python3 대신 python·py 일 수 있다
|
||||
PY=${PYTHON:-python3}
|
||||
cd "$WORK"
|
||||
[ -s mask.png ] || python3 "$HERE/render.py" mask --out mask.png
|
||||
[ -s frame.png ] || python3 "$HERE/render.py" frame --out frame.png
|
||||
[ -s outro.png ] || python3 "$HERE/render.py" outro --out outro.png
|
||||
[ -s mask.png ] || "$PY" "$HERE/render.py" mask --out mask.png
|
||||
[ -s frame.png ] || "$PY" "$HERE/render.py" frame --out frame.png
|
||||
[ -s outro.png ] || "$PY" "$HERE/render.py" outro --out outro.png
|
||||
part=6.7; outro=2.4; fade=0.4
|
||||
o1=$(python3 -c "print($part - $fade)"); o2=$(python3 -c "print(2 * $part - 2 * $fade)")
|
||||
o1=$(awk "BEGIN{print $part - $fade}"); o2=$(awk "BEGIN{print 2 * $part - 2 * $fade}")
|
||||
card="scale=816:1440:flags=lanczos,format=rgba"
|
||||
blur="scale=272:480,boxblur=10:2,scale=1088:1920,crop=1080:1920:4:0,eq=brightness=0.03:saturation=0.9,format=rgba"
|
||||
join() { # 클립a 클립b 이름
|
||||
@@ -37,11 +39,11 @@ inputs=(); chain=""; prev="0:v"; k=1
|
||||
while read -r name start end; do
|
||||
[ -n "${name:-}" ] || continue
|
||||
inputs+=(-loop 1 -framerate 24 -t 15 -i "bubbles/$name.png")
|
||||
fo=$(python3 -c "print(round($end - 0.2, 2))")
|
||||
fo=$(awk "BEGIN{printf \"%g\", $end - 0.2}")
|
||||
chain+="[$k:v]format=rgba,fade=in:st=$start:d=0.2:alpha=1,fade=out:st=$fo:d=0.2:alpha=1[b$k];"
|
||||
chain+="[$prev][b$k]overlay=x=0:y='max(0\,20*(1-(t-$start)/0.2))':enable='between(t,$start,$end)'[v$k];"
|
||||
prev="v$k"; k=$((k+1))
|
||||
done < bubbles.txt
|
||||
done < <(tr -d '\r' < bubbles.txt)
|
||||
if [ $k -eq 1 ]; then cp base.mp4 bubbles.mp4; else
|
||||
ffmpeg -hide_banner -loglevel error -y -i base.mp4 "${inputs[@]}" -filter_complex "${chain%;}" -map "[$prev]" -map 0:a \
|
||||
-c:v libx264 -preset slow -crf 17 -profile:v high -pix_fmt yuv420p -c:a copy -movflags +faststart bubbles.mp4
|
||||
|
||||
@@ -156,7 +156,7 @@ def main():
|
||||
if side % 64 or not 256 <= side <= 2048:
|
||||
sys.exit("width와 height는 256~2048 사이 64의 배수여야 합니다")
|
||||
|
||||
server = [str(HERE / "server.sh")]
|
||||
server = ["bash", str(HERE / "server.sh")]
|
||||
if subprocess.run(server + ["up"]).returncode != 0:
|
||||
sys.exit("전용 컨테이너를 시작하지 못했습니다")
|
||||
with socket.socket() as sock:
|
||||
|
||||
@@ -18,7 +18,20 @@ import urllib.parse
|
||||
from pathlib import Path
|
||||
|
||||
TEMPLATES = Path(__file__).resolve().parent.parent / "templates"
|
||||
CHROME = os.environ.get("CHROME_BIN", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
|
||||
def _chrome():
|
||||
env = os.environ.get("CHROME_BIN") or os.environ.get("CHROME_PATH")
|
||||
if env:
|
||||
return env
|
||||
if sys.platform == "win32":
|
||||
for base in (os.environ.get("PROGRAMFILES"), os.environ.get("PROGRAMFILES(X86)"), os.environ.get("LOCALAPPDATA")):
|
||||
path = Path(base or "") / "Google/Chrome/Application/chrome.exe"
|
||||
if base and path.is_file():
|
||||
return str(path)
|
||||
return "chrome.exe"
|
||||
return "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" if sys.platform == "darwin" else "google-chrome"
|
||||
|
||||
|
||||
CHROME = _chrome()
|
||||
# compose.sh 의 영상 창 크기와 같아야 한다
|
||||
CARD = (816, 1440)
|
||||
|
||||
|
||||
Reference in new issue
Block a user