-
Notifications
You must be signed in to change notification settings - Fork 0
/
concat-daily-movies
executable file
·45 lines (41 loc) · 1.04 KB
/
concat-daily-movies
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
#!/bin/bash
#
# compacts all daily movies to one monthly film
if (( $(find -iname '*.webm'|wc -l) > 0 ))
then
EXT='.webm'
MONTH=$(stat -c%n *.webm|cut -b 1-7|head -1)
elif (( $(find -iname '*.mp4'|wc -l) > 0 ))
then
EXT='.mp4'
MONTH=$(stat -c%n *.mp4|cut -b 1-7|head -1)
else
echo "no mp4 nor webm files found in $(pwd)"
exit
fi
if [ -f $MONTH-sound$EXT ]
then
echo $MONTH-sound$EXT already exist.
rm -i $MONTH-sound$EXT
exit
fi
if [ -f $MONTH-month$EXT ]
then
echo $MONTH-month$EXT already exist.
rm -i $MONTH-month$EXT
exit
fi
echo "#file list for concatenation" > mylist.txt
\ls -1 *$EXT | while read line
do echo file \'$line\' >> mylist.txt
done
ffmpeg -f concat -safe 0 -i mylist.txt -c copy $MONTH-month$EXT
if [ "$EXT" == ".webm" ]
then
ffmpeg -i $MONTH-month$EXT -i ~timelapse/archive/movies/sound/alles.webm -c copy -shortest $MONTH-sound$EXT
else
# assuming mp4
ffmpeg -i $MONTH-month$EXT -i ~timelapse/archive/movies/sound/alles.mp3 -c copy -shortest $MONTH-sound$EXT
fi
echo monthly movie in $MONTH-month$EXT
rm mylist.txt