mirror of
https://github.com/charmbracelet/gum
synced 2024-05-08 01:06:37 +02:00
docs(examples): Convert to GIF (ffmpeg) script
This commit is contained in:
parent
473cab8216
commit
00ba1f77a7
15
examples/convert-to-gif.sh
Executable file
15
examples/convert-to-gif.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script converts some video to a GIF. It prompts the user to select an
|
||||
# video file with `gum filter` Set the frame rate, desired width, and max
|
||||
# colors to use Then, converts the video to a GIF.
|
||||
|
||||
INPUT=$(gum filter --placeholder "Input file")
|
||||
FRAMERATE=$(gum input --prompt "Frame rate: " --placeholder "Frame Rate" --prompt.foreground 240 --value "50")
|
||||
WIDTH=$(gum input --prompt "Width: " --placeholder "Width" --prompt.foreground 240 --value "1200")
|
||||
MAXCOLORS=$(gum input --prompt "Max Colors: " --placeholder "Max Colors" --prompt.foreground 240 --value "256")
|
||||
|
||||
BASENAME=$(basename "$INPUT")
|
||||
BASENAME="${BASENAME%%.*}"
|
||||
|
||||
gum spin --title "Converting to GIF" -- ffmpeg -i "$INPUT" -vf "fps=$FRAMERATE,scale=$WIDTH:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=$MAXCOLORS[p];[s1][p]paletteuse" "$BASENAME.gif"
|
Loading…
Reference in a new issue