Files
tool__scripts/manage-video/video-wizard/0-convert-gif.sh
2026-07-09 01:05:56 +02:00

23 lines
569 B
Bash
Executable File

#!/bin/bash
TARGET_DIR="./0-input"
if [ ! -d "$TARGET_DIR" ]; then
echo "---->>>> Error: Directory '$TARGET_DIR' does not exist."
exit 1
fi
cd "$TARGET_DIR"
for gif in *.gif; do
if [ -f "$gif" ]; then
mp4="${gif%.gif}.mp4"
if ffmpeg -hide_banner -loglevel error -i "$gif" -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "$mp4"; then
echo "---->>>> Converted $gif to $mp4 successfully."
rm "$gif"
else
echo "---->>>> Failed to convert $gif."
fi
fi
done