Skip to content

Instantly share code, notes, and snippets.

@vool
Created February 13, 2019 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vool/7842d1282384f7bee0f6b38d14baede2 to your computer and use it in GitHub Desktop.
Save vool/7842d1282384f7bee0f6b38d14baede2 to your computer and use it in GitHub Desktop.
Script to animate images from cams into annual movie
#!/bin/bash
i=0
tmp_dir="temp/"
if [ ! -d $tmp_dir ]; then
mkdir -p $tmp_dir;
fi
for d in $(printf '%2d\n' {0..364}); do
#echo "$d"
for f in $d/*.jpg ; do
echo "$f"
if [[ $(find $f -type f -size +1k 2>/dev/null) ]]; then
printf -v n "%06d" $i;
echo "Coping to $n.jpg";
cp "$f" "$tmp_dir$n.jpg"
i=$((i + 1))
else
echo "bad $n"
#exit;
fi
done
done
echo "done"
ffmpeg -framerate 60 -i "$tmp_dir%06d.jpg" video.mp4
while true; do
read -p "Do you want to delete the temp dir ? " yn
case $yn in
[Yy]* ) rm -rf $tmp_dir ; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment