You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
timelapse/bin/timelapse_video.sh

52 lines
1.1 KiB

5 years ago
#!/bin/bash
MOUNT_PATH="/mnt/extern"
DATA="${MOUNT_PATH}/timelapse"
CLIENT_FOLDER="/timelapse"
DATA_FOLDER=""
case ${1} in
daily)
5 years ago
DATA_FOLDER="daily"
FILE_NAME="${DATA_FOLDER}_`date +%Y%m%d`"
5 years ago
DATE=`date --date="1 day ago" +%Y%m%d`
;;
weekly)
5 years ago
DATA_FOLDER="weekly"
FILE_NAME="${DATA_FOLDER}_`date +%Y_%V`"
5 years ago
DATE=`date --date="1 week ago" +%Y%m%d`
;;
monthly)
5 years ago
DATA_FOLDER="monthly"
FILE_NAME="${DATA_FOLDER}_`date +%Y_%m`"
5 years ago
DATE=`date --date="1 month ago" +%Y%m%d`
;;
*)
DATA_FOLDER="yearly"
5 years ago
FILE_NAME="${DATA_FOLDER}_`date +%Y`"
5 years ago
DATE=`date +%Y%m%d`
;;
esac
mountpoint -q ${MOUNT_PATH}
if [ ${?} != 0 ]
then
sudo mount --uuid ${DATA_DEVICE_UUID} -o uid=1000,gid=1000,umask=0022 ${MOUNT_PATH} || echo "Cannot mount data device with UUID ${DATA_DEVICE_UUID}!"; exit 1
fi
if [ ! -e "${DATA}" ]
then
echo "No directory: ${DATA}"
exit 401
fi
if [ ! -e "${DATA}/video" ]
then
echo "No directory: ${DATA}/video"
exit 402
fi
# sort files
5 years ago
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"