2021-12-04 00:24:47 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-09-24 18:09:02 +08:00
|
|
|
# Copyright 2021-2024 New Vector Ltd.
|
2021-12-04 00:24:47 +08:00
|
|
|
#
|
2024-09-24 18:09:02 +08:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
# Please see LICENSE in the repository root for full details.
|
2021-12-04 00:24:47 +08:00
|
|
|
|
|
|
|
set -e
|
|
|
|
echo "Converting file $1"
|
|
|
|
file=$(echo $1 | sed 's/\.[^.]*$//')
|
|
|
|
ffmpeg -i $1 -filter_complex "[0:v] fps=12,scale=480:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" $file-tmp.gif
|
|
|
|
echo "Converting to Gif"
|
|
|
|
gifsicle -O3 --lossy=80 -o $file.gif $file-tmp.gif
|
|
|
|
rm $file-tmp.gif
|
|
|
|
echo "Done, $file.gif has been generated"
|