Fixing date in video filename.

master
Holger Wirtz 5 years ago
parent e748ffb44e
commit c3e89004f8
  1. 21
      bin/timelapse_video.sh

@ -9,23 +9,26 @@ DATA_FOLDER=""
case ${1} in
daily)
DATA_FOLDER="daily"
FILE_NAME="${DATA_FOLDER}_`date +%Y%m%d`"
DATE=`date --date="1 day ago" +%Y%m%d`
DATE=`ls "${DATA}/${DATA_FOLDER}/" | head -1 | cut -d"-" -f1`
FILE_NAME="${DATA_FOLDER}_${DATE}"
;;
weekly)
DATA_FOLDER="weekly"
FILE_NAME="${DATA_FOLDER}_`date +%Y_%V`"
DATE=`date --date="1 week ago" +%Y%m%d`
DATE=`ls "${DATA}/${DATA_FOLDER}/" | head -1 | cut -d"-" -f1`
DATE=`date --date="${DATE}" +%Y_%V`
FILE_NAME="${DATA_FOLDER}_${DATE}"
;;
monthly)
DATA_FOLDER="monthly"
FILE_NAME="${DATA_FOLDER}_`date +%Y_%m`"
DATE=`date --date="1 month ago" +%Y%m%d`
DATE=`ls "${DATA}/${DATA_FOLDER}/" | head -1 | cut -d"-" -f1`
DATE=`date --date="${DATE}" +%Y_%m`
FILE_NAME="${DATA_FOLDER}_${DATE}"
;;
*)
DATA_FOLDER="yearly"
FILE_NAME="${DATA_FOLDER}_`date +%Y`"
DATE=`date +%Y%m%d`
DATE=`ls "${DATA}/${DATA_FOLDER}/" | head -1 | cut -d"-" -f1`
DATE=`date --date="${DATE}" +%Y`
FILE_NAME="${DATA_FOLDER}_${DATE}"
;;
esac
@ -47,5 +50,5 @@ then
exit 402
fi
# sort files
# create video
ffmpeg -y -loglevel quiet -framerate 30 -pattern_type glob -i "${DATA}/${DATA_FOLDER}/*.jpg" -vcodec libx265 -crf 20 -vf scale=1920:1080 "${DATA}/video/${FILE_NAME}.mp4"

Loading…
Cancel
Save