2019-04-04 04:53:55 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-04-16 22:08:28 +00:00
|
|
|
TMP_CROP=$(mktemp)
|
|
|
|
TMP_GIF=$(mktemp)
|
|
|
|
TMP_PALETTE=$(mktemp)
|
2019-04-04 04:53:55 +00:00
|
|
|
echo "Generating square gif of ${1} as ${2}x${2}"
|
|
|
|
|
2019-05-31 20:35:09 +00:00
|
|
|
ffmpeg -y -i "$1" -c:v prores_ks -profile:v 3 -filter:v "scale=1920:1080:force_original_aspect_ratio=decrease,crop=1080:1080:420:0" "$TMP_CROP.mov"
|
|
|
|
ffmpeg -y -i "$TMP_CROP.mov" -c:v prores_ks -profile:v 3 -vf scale=$2:$2 "$TMP_GIF.mov"
|
|
|
|
ffmpeg -y -i "$TMP_GIF.mov" -vf palettegen "$TMP_PALETTE.png"
|
|
|
|
ffmpeg -y -i "$TMP_GIF.mov" -i "$TMP_PALETTE.png" -filter_complex paletteuse -f gif "square_${2}.gif"
|
2019-04-04 04:53:55 +00:00
|
|
|
|
2019-05-31 18:58:30 +00:00
|
|
|
echo "Generated square_${2}.gif"
|