#!/bin/bash


rm m/*

I=0
for file in `ls -ltr *.png | tr -s ' ' | cut -d' ' -f 8`
do
	filenr=`printf %03d $I`
	echo "file cp $file m/$filenr.png"
	cp $file m/$I.png
	((I++))
done

/usr/local/bin/ffmpeg -y -r 6 -qscale 5 -i m/%1d.png -s 640x360 ./timelaps.temp.mp4
HandBrakeCLI -i timelaps.temp.mp4 -o timelaps.mp4 -e x264 -b 512 -O
rm timelaps.temp.mp4
