Skip to content

Instantly share code, notes, and snippets.

@gre
Created April 30, 2014 12:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gre/3f4c32d33c4695cc4de6 to your computer and use it in GitHub Desktop.
Save gre/3f4c32d33c4695cc4de6 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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