From 847e9644cef3f6f01ccc4228d1211fc43de458b1 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Tue, 16 Apr 2019 18:08:28 -0400 Subject: [PATCH] Fix square gif generator --- scripts/square_gif.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/square_gif.sh b/scripts/square_gif.sh index c86b50f..d8beb35 100644 --- a/scripts/square_gif.sh +++ b/scripts/square_gif.sh @@ -1,10 +1,13 @@ #!/bin/bash -TMP_FILE=$(mktemp) - +TMP_CROP=$(mktemp) +TMP_GIF=$(mktemp) +TMP_PALETTE=$(mktemp) echo "Generating square gif of ${1} as ${2}x${2}" -ffmpeg -i "$1" -c:v prores_ks -profile:v 3 -filter:v "crop=1080:1080:420:0" $TMP_FILE -ffmpeg -i $TMP_FILE -f gif -vf scale=$2:$2 "square_${2}.gif" +ffmpeg -y -i "$1" -c:v prores_ks -profile:v 3 -filter:v "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" echo "Generated square_${2}.gif" \ No newline at end of file