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.
47 lines
961 B
47 lines
961 B
#!/bin/bash
|
|
|
|
MOUNT_PATH="/mnt/extern"
|
|
DATA="${MOUNT_PATH}/timelapse"
|
|
CLIENT_FOLDER="/timelapse"
|
|
|
|
DATA_FOLDER=""
|
|
|
|
case ${1} in
|
|
daily)
|
|
DATA_FOLDER="${1}"
|
|
DATE=`date --date="1 day ago" +%Y%m%d`
|
|
;;
|
|
weekly)
|
|
DATA_FOLDER="${1}"
|
|
DATE=`date --date="1 week ago" +%Y%m%d`
|
|
;;
|
|
monthly)
|
|
DATA_FOLDER="${1}"
|
|
DATE=`date --date="1 month ago" +%Y%m%d`
|
|
;;
|
|
*)
|
|
DATA_FOLDER="yearly"
|
|
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
|
|
ffmpeg -y -loglevel quiet -framerate 30 -pattern_type glob -i "${DATA}/${DATA_FOLDER}/*.jpg" -vcodec libx265 -crf 20 -vf scale=1920:1080 "${DATA}/video/${DATA_FOLDER}_${DATE}.mp4"
|
|
|