diff --git a/.config/scripts/functions/ffmpeg b/.config/scripts/functions/ffmpeg new file mode 100644 index 0000000..30af80d --- /dev/null +++ b/.config/scripts/functions/ffmpeg @@ -0,0 +1,10 @@ +#!/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" +}