From 9eb63cf7034d96287850b9e20b43e02ddcc37abf Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 1 Jun 2016 00:26:43 -0400 Subject: [PATCH] Add bin/mov2gif --- bin/mov2gif | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 bin/mov2gif diff --git a/bin/mov2gif b/bin/mov2gif new file mode 100755 index 00000000..aaece5a2 --- /dev/null +++ b/bin/mov2gif @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ ! -f "$1" ]; then + >&2 echo "Movie file doesn't exist!" + exit +fi + +palette="/tmp/palette.png" +flags="fps=${4:-10},scale=${3:-640}:-1:flags=lanczos" + +ffmpeg -v warning -i "$1" -vf "$flags,palettegen" -y "$palette" +ffmpeg -v warning -i "$1" -i "$palette" -lavfi "$flags [x]; [x][1:v] paletteuse" -y "$2" + +[ -f "$palette" ] && rm -f "$palette"