commit bf6daa3eb26c558ae9221451170664ee2b8837be
parent 07afb9e21633d819d9b66808b42f976e1224416d
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Wed, 15 Apr 2020 17:27:34 +0200
ffmpres: improve GIF preset
Former-commit-id: 4699e96d93f77210ab1c625980de67dddeaba04d
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/scripts/ffmpres b/scripts/ffmpres
@@ -94,8 +94,17 @@ process_video() {
ffmpeg -i "$1" "${1%%.*}.mp3"
break;;
"GIF")
+ printf "FPS (default 24): "
+ read -r fps
+ printf "Scale (default unchanged): "
+ read -r scale
+ if [ -n "$scale" ]; then
+ local filters="fps=${fps:-24},scale=$scale:flags=lanczos"
+ else
+ local filters="fps=${fps:-24},scale=0:-1:flags=lanczos"
+ fi
+ echo "Creating gif"
local palette="/tmp/palette.png"
- local filters="fps=24,scale=0:-1:flags=lanczos"
ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y "$palette"
ffmpeg -v warning -i "$1" -i "$palette" -lavfi "$filters [x]; [x][1:v] paletteuse" -y "${1%%.*}.gif"
break;;