-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-24h-movie
executable file
·100 lines (82 loc) · 2.11 KB
/
create-24h-movie
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
#
# chdir into $1
# assume it's a timelapse directory
# process directory with timelapse pictures
# from tl000001.jpg to tl<maxnum>.jpg
#
# create a x265/hevc video fullsize HD in 1920x1080 with quality level 23
# create a vp9 video sized 640x480 with max bitrate of 500kb for webstreaming
# move the movie files to ~/movies
# delete the directory
# tracing
# set -x
MOVIES=${MOVIES:-~/movies}
INTERVAL=${INTERVAL:-120} # in seconds
LOGLEVEL=${LOGLEVEL:-error}
RATE=${RATE:-30} # frame rate 25 PAL, 30 NTSC
VERBOSE=${VERBOSE:-0}
if [ "$VERBOSE" = "0" ]; then
# VERBOSE=1
LOGLEVEL=error
else
echo "effective paramaters:"
echo "MOVIES=$MOVIES"
echo "INTERVAL=$INTERVAL"
echo "RATE=$RATE"
echo "VERBOSE=$VERBOSE"
V="-v"
fi
if [ -z "$1" ]; then
echo error: no parameter given!
echo need directory to chdir
echo exit
exit
fi
if [ ! -d "$1" ]; then
echo $(realpath $1) is not a directory or doesn\'t exist
echo exit
exit
fi
# echo change into dir $1
cd $1
MONTH=$(date -d "$(basename $(pwd))" +"%m-%B")
# echo $MONTH
# we're called like this
# find -type d | egrep '.*/2017[[:digit:]]{4}$'|xargs -l create-24h-movie
process-tl-dir -i $INTERVAL -v $VERBOSE
rc=$?
if [ $rc -ne 0 ]; then
echo "process-tl-dir returned $rc"
echo "$(pwd): couldn't process pictures"
exit
fi
# find really the latest exif-*
EXIF=$(find -type d -name 'exif-*' -cmin -10 -printf '%f')
cd $EXIF
mkdir -p $MOVIES/$MONTH/small/{webm,hevc}
#mkmov vp9 -w 640 -q 26 -b 500k -2 -v $LOGLEVEL -r $RATE
#mv -v *.webm $MOVIES/$MONTH/small/webm
#mkmov hevc -w 640 -b 500k -2 -v $LOGLEVEL -r $RATE
#mv -v *.mp4 $MOVIES/$MONTH/small/hevc
# zuerst, geht am schnellsten
mkmov -c x264 -w 1920 -b 3500k -r $RATE
mkdir -p $MOVIES/$MONTH/x264
mv $V *.mp4 $MOVIES/$MONTH/x264
#
mkmov -c vp9 -w 1920 -b 3500k -2 -r $RATE
mkdir -p $MOVIES/$MONTH/webm
mv $V *.webm $MOVIES/$MONTH/webm
#
mkmov -c hevc -w 1920 -b 3500k -2 -r $RATE
mkdir -p $MOVIES/$MONTH/x265
mv $V *.mp4 $MOVIES/$MONTH/x265
#
mkmov -c hevc -w 1920 -r $RATE
mkdir -p $MOVIES/$MONTH/hq
mv $V *.mp4 $MOVIES/$MONTH/hq
cd ..
if [ "$VERBOSE" == "1" ]; then
echo remove $EXIF
fi
rm -rf $EXIF