Created
April 28, 2014 18:24
-
-
Save mrspeaker/11379979 to your computer and use it in GitHub Desktop.
create movie from multiple png files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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