-
Notifications
You must be signed in to change notification settings - Fork 0
/
daily-motion
executable file
·70 lines (55 loc) · 1.23 KB
/
daily-motion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
#
# creates a movie from all pictures of the motion detection camera
# set -x
# CWD=$(pwd)
WORKDIR=.
FRAMERATE=${FRAMERATE:-50}
MACHINE=${MACHINE:europe}
function usage {
echo "usage: $(basename $0) [-m MACHINE ] [-r framerate] [-d workdir]"
exit
}
if [[ ${#} -eq 0 ]]; then
usage
fi
while getopts ":m:r:hd:" arg; do
case "${arg}" in
m)
MACHINE=$OPTARG
;;
r)
FRAMERATE=$OPTARG
;;
d)
WORKDIR=$OPTARG
;;
h)
usage
;;
?)
echo unknown option $OPTARG
usage
esac
done
pushd $WORKDIR > /dev/null
DIR=$(basename $(pwd))
# echo Environment
# echo ------------------------
# echo FRAMERATE=$FRAMERATE
# echo DIR=$DIR
# echo WORKDIR=$WORKDIR
# echo MACHINE=$MACHINE
# echo ------------------------
# echo .
ffmpeg -y -hide_banner -v error -r $FRAMERATE -f image2 -pattern_type glob -i '**/*[0-9].jpg' -c:v libx264 -preset slower -b:v 1500k -r $FRAMERATE $DIR.mp4
if [ $? -eq 0 ]
then
mv $DIR.mp4 /sdb/www/motions/$MACHINE
mailx -s "Daily Motion $DIR" [email protected] <<EOM
new daily motion in https://rathaus.vineta.ca/motions/$MACHINE/$DIR.mp4
local path /sdb/www/motions/$MACHINE/$DIR.mp4
EOM
# echo move $DIR.mp4 created
fi
popd > /dev/null