declare -a ori=("v" "c" "h") tsfile=$(date -d "today" +"%Y%m%d%H%M%S") for f in "${ori[@]}" do for i in *.png do for j in $(seq 1 3) do convert $i -gravity center -background black -scale 540x960 -extent 540x960 $i-framed${f}$j.png done done mkdir -p frames${f}/ convert -limit memory 4GiB -limit map 4GiB *-framed${f}*.png -delay 10 -morph 10 frames${f}/%05d.morph.png ffmpeg -i frames${f}/%05d.morph.png -c:v libx264 -vf fps=15 -pix_fmt yuv420p output-${tsfile}-${f}.mp4 rm -rf frames${f} done rm -f *-framed*.png