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 case ${1} in
daily) daily)
DATA_FOLDER="daily" DATA_FOLDER="daily"
FILE_NAME="${DATA_FOLDER}_`date +%Y%m%d`" DATE=`ls "${DATA}/${DATA_FOLDER}/" | head -1 | cut -d"-" -f1`
DATE=`date --date="1 day ago" +%Y%m%d` FILE_NAME="${DATA_FOLDER}_${DATE}"
;; ;;
weekly) weekly)
DATA_FOLDER="weekly" DATA_FOLDER="weekly"
FILE_NAME="${DATA_FOLDER}_`date +%Y_%V`" DATE=`ls "${DATA}/${DATA_FOLDER}/" | head -1 | cut -d"-" -f1`
DATE=`date --date="1 week ago" +%Y%m%d` DATE=`date --date="${DATE}" +%Y_%V`
FILE_NAME="${DATA_FOLDER}_${DATE}"
;; ;;
monthly) monthly)
DATA_FOLDER="monthly" DATA_FOLDER="monthly"
FILE_NAME="${DATA_FOLDER}_`date +%Y_%m`" DATE=`ls "${DATA}/${DATA_FOLDER}/" | head -1 | cut -d"-" -f1`
DATE=`date --date="1 month ago" +%Y%m%d` DATE=`date --date="${DATE}" +%Y_%m`
FILE_NAME="${DATA_FOLDER}_${DATE}"
;; ;;
*) *)
DATA_FOLDER="yearly" DATA_FOLDER="yearly"
FILE_NAME="${DATA_FOLDER}_`date +%Y`" DATE=`ls "${DATA}/${DATA_FOLDER}/" | head -1 | cut -d"-" -f1`
DATE=`date +%Y%m%d` DATE=`date --date="${DATE}" +%Y`
FILE_NAME="${DATA_FOLDER}_${DATE}"
;; ;;
esac esac
@ -47,5 +50,5 @@ then
exit 402 exit 402
fi 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" 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