-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexplico.sh
executable file
·53 lines (44 loc) · 1.54 KB
/
explico.sh
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
#!/bin/bash
data="/volume1/transfer/curiosum"
analysis=$data/analysis
today=$(date +"%Y-%m-%d-%H-%M-%S-%Z")
datefolder=$(date +"%Y-%m-%d")
logfile=$data/logs/$datefolder/$today-explico.log
line="======================================================"
# preamble
touch $logfile
echo $line >> $logfile
printf "Explico audio analyser.\n" | tee -a $logfile
printf " This script started at: '%s'\n" "${today}" | tee -a $logfile
read -p " Type date to analyse in format YYYY-MM-DD: " target
printf " Analysing recordings from: '%'s'\n" "${target}" | tee -a $logfile
list=$analysis/$target/files.txt
printf " Storing analysis in: '%s'\n" "${analysis}/${target}" | tee -a $logfile
printf " Checking that subdirectories exist.\n" | tee -a $logfile
mkdir -p "${analysis}/${target}" | tee -a $logfile
printf " Logging to: '%s'\n" "${logfile}" | tee -a $logfile
echo $line >> $logfile
# execution
touch $list
find $data/recordings/$target/*.mp4 \
| sed 's:\ :\\\ :g' \
| sed 's/^/file /' \
| tee $list
echo $line >> $logfile
cat $list >> $logfile
mkdir -p $analysis/$target
# https://trac.ffmpeg.org/wiki/Concatenate
ffmpeg -f concat -safe 0 -i $list $analysis/$target/$target.aac | tee -a $logfile
# https://stackoverflow.com/a/9956920
ffmpeg -i $analysis/$target/$target.aac \
-filter_complex \
"aformat=channel_layouts=mono, \
showwavespic=s=1600x400: \
scale=cbrt" \
-vframes 1 \
$analysis/$target/$target.png \
| tee -a $logfile
# conclusion
echo $line >> $logfile
printf " Completed execution.\n" | tee -a $logfile
# end of script