-
-
Save yegorg/939926984aa4be1f8ad2ef4bbca66958 to your computer and use it in GitHub Desktop.
A handy bash function to convert a video (e.g. a screen cap) to a gif using ffmpeg in your shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function video_to_gif { | |
local input_video_path="$1" | |
local output_gif_path="$2" | |
local fps="${3:-10}" | |
local scale="${4:-1080}" | |
local loop="${5:-0}" | |
ffmpeg -i "${input_video_path}" -vf "setpts=PTS/1,fps=${fps},scale=${scale}:-2:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop $loop "${output_gif_path}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment