Created
July 13, 2018 14:16
-
-
Save steverichey/a5caa0baa5726b262faa36556c23597e to your computer and use it in GitHub Desktop.
GIF creation with some optimization options
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
#!/bin/sh | |
# this was created for an admittedly specialized purpose but has some neat settings i want to remember | |
palette="/tmp/palette.png" | |
cropped="/tmp/cropped.mp4" | |
width="275" | |
filters="fps=15,scale=${width}:-1:flags=lanczos" | |
ffmpeg -y -i $1 -vf "crop=${width}:${width}:10:10" $cropped | |
ffprobe -v quiet -print_format json -show_format -show_streams $cropped | |
ffmpeg -v warning -i $1 -vf "$filters,palettegen=stats_mode=diff" -y $palette | |
ffmpeg -i $cropped -i $palette -s 128x128 -ss 00:00:01.750 -t 00:00:00.965 -lavfi "$filters,paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -y $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment