Created
August 5, 2025 04:24
-
-
Save masakielastic/c28f71caa92301f819e33e35f1555aaa to your computer and use it in GitHub Desktop.
Revisions
-
masakielastic created this gist
Aug 5, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ 2枚の立ち絵をもとに ffmpeg で目パチ動画を作成する =========================================== 2枚の立ち絵(eye_open.png と eye_closed.png)を用意します。立ち絵は [PSDTool](https://oov.github.io/psdtool/)で生成できます。 1秒24コマとして10秒240コマ分の画像を生成します。 ```sh chmod +x generate_blink_frames.sh ./generate_blink_frames.sh ``` ffmeg で動画を生成します。 ``` ffmpeg -framerate 24 -i frame_%03d.png -c:v libx264 -pix_fmt yuv420p -t 10 eye_blink.mp4 ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ #!/bin/bash set -e # 初期化 rm -f frame_*.png # 入力ファイル OPEN="eye_open.png" CLOSED="eye_closed.png" # 総フレーム数 TOTAL_FRAMES=240 FPS=24 frame_num=1 while [ $frame_num -le $TOTAL_FRAMES ]; do # 開いた目をランダムな長さだけ続ける(24〜72フレーム=1〜3秒) open_duration=$(( (RANDOM % 49) + 24 )) # 24〜72 end_open=$((frame_num + open_duration - 1)) if [ $end_open -gt $TOTAL_FRAMES ]; then end_open=$TOTAL_FRAMES fi for ((i=frame_num; i<=end_open; i++)); do cp "$OPEN" $(printf "frame_%03d.png" "$i") done frame_num=$((end_open + 1)) # 閉じた目(1フレーム) if [ $frame_num -le $TOTAL_FRAMES ]; then cp "$CLOSED" $(printf "frame_%03d.png" "$frame_num") frame_num=$((frame_num + 1)) fi done echo "✅ フレーム画像の生成が完了しました(frame_001.png ~ frame_$(printf "%03d" $((frame_num - 1))).png)"