Skip to content

Instantly share code, notes, and snippets.

@brasic
Last active January 13, 2023 12:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brasic/dba88123f0bcbdc51621180538cc3bd5 to your computer and use it in GitHub Desktop.
Save brasic/dba88123f0bcbdc51621180538cc3bd5 to your computer and use it in GitHub Desktop.
homer bush
#!/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