Last active
August 12, 2024 15:36
-
-
Save brasic/dba88123f0bcbdc51621180538cc3bd5 to your computer and use it in GitHub Desktop.
homer bush
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 | |
set -euxo | |
cleanup() { | |
rm -f 1.mp4 2.mp4 3.mp4 4.mp4 palette.png | |
} | |
trap cleanup EXIT | |
# extend the last frame | |
ffmpeg -y -i input.gif \ | |
-filter_complex "[0]trim=0:5[hold];[0][hold]concat[extended];[extended][0]overlay" \ | |
-pix_fmt yuv420p -c:a none \ | |
1.mp4 | |
# face overlay | |
ffmpeg -y -i 1.mp4 -i face.png \ | |
-filter_complex "[0:v][1:v] overlay=213:30:enable='between(n,0,13)'" \ | |
-pix_fmt yuv420p -c:a none \ | |
2.mp4 | |
# circle overlay | |
ffmpeg -y -i 2.mp4 -i circle.png \ | |
-filter_complex \ | |
"[0:v][1:v] overlay=233:25:enable='between(n,14,24)'" \ | |
-pix_fmt yuv420p -c:a none \ | |
3.mp4 | |
# nose | |
ffmpeg -y -i 3.mp4 -i nose.png \ | |
-filter_complex \ | |
"[0:v][1:v] overlay=255:23:enable='between(n,25,33)'" \ | |
-pix_fmt yuv420p -c:a none \ | |
4.mp4 | |
# generate gif palette | |
ffmpeg -y -i 4.mp4 -vf palettegen palette.png | |
# generate gif | |
ffmpeg -y -i 4.mp4 -i palette.png -lavfi paletteuse output.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment