Created
March 18, 2023 13:21
-
-
Save zanculmarktum/59aab7a3916b654d5a8338fdb0fc5c50 to your computer and use it in GitHub Desktop.
Dynamic WebM resolution
This file contains 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 characters
#!/usr/bin/env bash | |
tmpfile=$(mktemp) | |
clean_up() { | |
rm -f "$tmpfile" | |
} | |
trap "clean_up" EXIT | |
trap "clean_up; exit 1" INT TERM | |
input=apu.jpg | |
curl -LR -o $input https://0x0.st/H-fV.jpg | |
width=$(identify -format '%w' $input) | |
rm -f apu???.webm | |
j=0 | |
for i in $(seq 10 1 $width); do | |
j=$(($j + 1)) | |
h=$(printf '%03d' $j) | |
convert $input -resize ${i}x${i} apu${h}.webm | |
done | |
>$tmpfile | |
for i in $(seq 1 $j); do | |
echo "file $(pwd)/apu$(printf '%03d' $i).webm" >>$tmpfile | |
done | |
for i in $(seq $j -1 1); do | |
echo "file $(pwd)/apu$(printf '%03d' $i).webm" >>$tmpfile | |
done | |
ffmpeg -hide_banner -f concat -safe 0 -i $tmpfile -c copy -y foo.webm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment