I was playing a little bit with timelapse photos and although it is pretty simple to convert them into video in linux, it is always nice to have one command that will do all magic for you.
Here is my tiny script.
#!/bin/bash echo "*** I believe we're in the folder with all images from the cam." echo "*** 1. Let's resize images to 1920x1080 (into 'resized' folder)" mkdir resized mogrify -path resized -resize 1920x1080! *.jpg *.JPG cd resized echo "*** 2. Let's create file with list of pictures (using awesome pyp)" ls --color=none -1 | pyp "pp.sort() | p" > files.txt echo "*** 3. Let's make some video with mencoder (15fps)" mencoder -idx -nosound -noskip -ovc lavc -lavcopts vcodec=ljpeg -o output.avi -mf fps=15 'mf://@files.txt' echo "*** 4. Recode video into mpeg" ffmpeg -i output.avi -y -sameq -vf scale=1920:1440,crop=1920:1080 ../output.avi echo "*** 5. Some cleanups" cd .. rm -rf resized echo "*** 6. We're done. Here is your video:" echo `pwd`/output.avi
This works pretty simple:
- you copy your timelapse photos to some folder
- cd there (folder with photos)
- run script
- wait a while....
- get your output.avi
There are some requirements this script is relying on:
- pyp - the awesome almighty utility i'm in love with
- morgify - need to resize images
- mencoder (
apt-get install mencoder)
And here you can see the result: