snippets/png-to-vertical-video-mp4.sh

22 lines
585 B
Bash
Raw Permalink Normal View History

2024-02-03 21:58:16 +00:00
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