Skip to content

Instantly share code, notes, and snippets.

@mrspeaker
Created April 28, 2014 18:24
Show Gist options
  • Select an option

  • Save mrspeaker/11379979 to your computer and use it in GitHub Desktop.

Select an option

Save mrspeaker/11379979 to your computer and use it in GitHub Desktop.
create movie from multiple png files
# script to create movie from multiple png files
dir=${1-"timelapse"}
cd $dir;
echo "Creating symlinks...";
# start at 0
count=0
# take all files named shot - something ordered by date
find . -name '*.jpg' | while read f; do
# get the index in 0000 format
printf -v counts "%06d" $count
# link file to a frame_0000 named symbolic link
ln -s $f frame_$counts.jpg
# increment counter
count=`expr $count + 1`
done;
cd -;
echo "Generating video...";
# create movie
ffmpeg -r 30 -i $dir/frame_%06d.jpg movie.mp4
echo "Removing symlinks...";
# remove the links
cd $dir
find . -name 'frame_*.jpg' | while read f; do rm $f; done
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment