Skip to content

Instantly share code, notes, and snippets.

@sjwilliams
Created April 19, 2019 16:18
Show Gist options
  • Save sjwilliams/1f06cd93aa4c6236219c8a902fa6e2e1 to your computer and use it in GitHub Desktop.
Save sjwilliams/1f06cd93aa4c6236219c8a902fa6e2e1 to your computer and use it in GitHub Desktop.
Stack video frames onto a single image
#!/bin/bash
# https://stackoverflow.com/questions/46145576/stack-multiple-images-in-semitransparent-layers-with-imagemagick
FRAMESDIR=frames
INPUTVIDEO=input.mp4
curl https://cdn.joshwilliams.com/projects/2019/videostack/input.mp4 -o $INPUTVIDEO
mkdir -p $FRAMESDIR
ffmpeg -i $INPUTVIDEO -vf scale=1280:-1 -r 5 $FRAMESDIR/%04d.png
LIST=$(find ./$FRAMESDIR -name "*.png" -print0 | xargs -0 echo)
convert $LIST -evaluate-sequence mean output.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment