Skip to content

Instantly share code, notes, and snippets.

@dmd

dmd/-

Created March 7, 2017 20:21
Show Gist options
  • Select an option

  • Save dmd/1d4680c6cf40f3d3f9e67c5a7fdc2036 to your computer and use it in GitHub Desktop.

Select an option

Save dmd/1d4680c6cf40f3d3f9e67c5a7fdc2036 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e # die on any failure
trap 'rm -rf /tmp/nestframes' ERR
TARGET=/Users/dmd/Documents/dashare/205spring/surv
DAYSAGO=$1
if [[ $# -eq 0 ]]; then
echo "need days ago"
exit 0
fi
YESTERDAY=$(date -v-${DAYSAGO}d +"%Y-%m-%d")
for PLACE in B L
do
mkdir -p /tmp/nestframes/${PLACE}
scp dev.host:nest-grabber/data/stills/${PLACE}*${YESTERDAY}*.jpg /tmp/nestframes/${PLACE}/
/usr/local/bin/ffmpeg -n -r 20 -pattern_type glob -i "/tmp/nestframes/${PLACE}/*.jpg" -c:v libx264 -vf fps=25 -pix_fmt yuv420p ${TARGET}/${PLACE}-${YESTERDAY}.mp4
done
rm -rf /tmp/nestframes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment