-
Notifications
You must be signed in to change notification settings - Fork 7
/
batch.sh
77 lines (57 loc) · 1.57 KB
/
batch.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Process .WAV files in directory source/ and sub-divide
# transcribe and combine
# Source helper functions
source ./install.sh
# Create project folder
project=`date '+%Y%m%d%H%M%S'`
mkdir $project
echo "Create folder "$project
# Clear out working parts/
# Remove contents of parts
rm -rf parts/
mkdir parts
# Convert any mp4 files in source/
echo "Convert any mp4 into wav"
# Move into source/ directory
cd source
for m in *.mp4
do
echo "Converting "$m
ffmpeg -i $m -vn -acodec pcm_s16le -ar 44100 -ac 2 $m.wav
remove_silence $m.wav
rm *original*
done
# Return to main path
cd ..
# Fixed to processing from working_source directory
for f in ./source/*.wav
do
echo "Working on" $f "part"
echo "Clear parts/ folder which holds 59 second blocks"
rm -rf parts/
mkdir parts
# Remove silence in .wav creation
# echo "Remove silence and audio bursts"
# remove_silence $f
echo "Process each audio listening block to 59 second Google processing blocks"
# create 59 second parts
process_wav_sub_minute_parts $f
echo "Spawn worker threads to send to Google to process"
python3 fast.py
# When fast.py is done it creates transcript.txt file
today=`date '+%Y%m%d%H%M%S'`
mv -v transcript.txt 'transcript-'$today'.txt'
done
mkdir $project
# Clean up
echo "Move original files,processed wavs, and transcripts to project folder"
mv -v source/*.mp4 $project
mkdir $project/wavs
mv -v source/*.wav $project/wavs
mv -v transcript-*.txt ./$project
cd $project
cat *.txt >'all_'$project'_transcripts.txt
cd ..
# echo "Clean up .wav files in source/"
echo "Done"