dotfiles/.config/scripts/functions/ffmpeg

11 lines
322 B
Bash

#!/bin/bash
function video_to_gif() {
if [ "$#" -ne 4 ]; then
echo "Usage: video_to_gif input.mp4 output.gif start duration"
return 1
fi
ffmpeg -ss "$3" -t "$4" -i "$1" \
-vf "fps=24,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-loop 0 "$2"
}