Last active
July 6, 2021 16:44
-
-
Save notwa/5f6c43d02d476eb704e5cab2448ca116 to your computer and use it in GitHub Desktop.
something i threw together to make a discord banner out of video frames and will probably want to find and refer to 5 years from now
This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
ffmpeg -i mpv-shot%4d.png -filter_complex "\ | |
select=between(n\,20\,39),setpts=PTS-STARTPTS,\ | |
crop=1920:768:0:100,\ | |
scale=600:-1,\ | |
split=2[palette_in][gif];\ | |
[palette_in]palettegen[palette_out];\ | |
[gif]fifo[gif_fifo];\ | |
[gif_fifo][palette_out]paletteuse\ | |
" -y chuu.gif | |
cp -p chuu.gif chuu.unoptimized.gif | |
gifsicle -b --no-comments --no-names --no-extensions -d5 -l -O9 chuu.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the frame numbers in the
between
expression are inclusive.the -d option to gifsicle controls the final framerate of the gif (-d5 => 100/5=20 fps).
the complex filter piping is lifted from https://quinbenson.wordpress.com/2019/07/15/ffmpeg-png-to-animated-gif/