Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
script to create movie from images. Design to go with the timelapse script: https://gist.github.com/gre/11219793
#!/bin/bash
#
# script to create movie from images. Design to go with the timelapse script: https://gist.github.com/gre/11219793
#
# Usage: ./generatevideo.sh dirWhereImagesAre/
# Usage: ./generatevideo.sh # default is './timelapse' directory
#
# will generates movie.mp4
dir=${1-"timelapse"}
echo "Creating symlinks...";
cd $dir;
count=0
find . -name '*.jpg' | while read f; do
printf -v counts "%06d" $count
ln -s $f frame_$counts.jpg
count=`expr $count + 1`
done;
cd -;
echo "Generating video...";
ffmpeg -r 30 -i $dir/frame_%06d.jpg movie.mp4
echo "Removing symlinks...";
cd $dir
find . -name 'frame_*.jpg' | while read f; do rm $f; done
cd -
# Gaëtan Renaudeau - DWTFYW License http://www.wtfpl.net/
@gre

This comment has been minimized.

Copy link
Owner Author

@gre gre commented Aug 17, 2017

also can do annotation with the date:

set -e

mkdir snapshots-copy
cd timelapse
count=0
for f in *.jpg ; do
  printf -v counts "%06d" $count
  out=../snapshots-copy/$counts.jpg
  day=${f:0:10}
  time=${f:11:5}
  txt="$day    $time"
  convert $f \
    -font ../src/Game/MinimalPixels.ttf \
    -pointsize 100 \
    -gravity SouthWest \
    -fill '#000' -annotate +24+14 "$txt" \
    -fill '#000' -annotate +16+6 "$txt" \
    -fill '#000' -annotate +24+6 "$txt" \
    -fill '#000' -annotate +16+14 "$txt" \
    -fill '#fff' -annotate +20+10 "$txt" \
    $out
  count=`expr $count + 1`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment