Skip to content

Instantly share code, notes, and snippets.

@luisparravicini
Last active April 12, 2020 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisparravicini/754d54a9e858210ac4c601525d788049 to your computer and use it in GitHub Desktop.
Save luisparravicini/754d54a9e858210ac4c601525d788049 to your computer and use it in GitHub Desktop.
ffmpeg options added to make twitter accept the video
#!/bin/bash
#
# Takes a directory of macOS screemshots, label each file with
# a timestamp and creates a video with them.
#
dir=$1
if [ -z "$dir" ]; then
echo usage: $0 path
exit 1
fi
index=0
for f in $dir/*.png; do
timestamp=$(basename "$f" | sed -e 's/Screen Shot //' -e 's/ at / - /' -e 's/\.png//')
fname=$(printf '%s/%03d.png' `dirname "$f"` $index)
let index=index+1
echo $timestamp
mogrify -crop 1394x678+206+186 +repage "$f"
convert "$f" -background black -fill white -pointsize 20 \
-gravity south label:"$timestamp" -geometry +0+10 \
-composite "$fname"
rm "$f"
done
out=flights.mp4
ffmpeg -framerate 1 -i "$dir"/%03d.png -r 12 -vcodec libx264 -pix_fmt yuv420p $out
echo created $out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment