Make An Animated GIF With ffmpeg
This is the script I use to make animated gifs:
Code
INPUT_PATH="input.mp4"
OUTPUT_PATH="output.gif"
WIDTH=440
FPS=10
CROP="crop=in_w:in_h:0:0,"
ffmpeg -i "${INPUT_PATH}" \
-vf "${CROP}fps=${FPS},scale=${WIDTH}:-2:flags=lanczos,split[s0][s1];\
[s0]palettegen=max_colors=64:reserve_transparent=0[p];\
[s1][p]paletteuse" \
-y "${OUTPUT_PATH}"
You can also run it with start and end times with the `-ss #`` (start second) and `-t #`` (time to capture) flags. I don't keep those in my script because I've already cut the videos by that time.
Code
ffmpeg -i "${INPUT_PATH}" \
-ss 2 \
-t 3
-vf "${CROP}fps=${FPS},scale=${WIDTH}:-2:flags=lanczos,split[s0][s1];\
[s0]palettegen=max_colors=64:reserve_transparent=0[p];\
[s1][p]paletteuse" \
-y "${OUTPUT_PATH}"