-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-base.sh
executable file
·74 lines (60 loc) · 1.78 KB
/
generate-base.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
#!/bin/bash
# Define colors for logging
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Echo function with color
cecho () {
color=$1
shift
echo -e "${color}$@${NC}"
}
# Function to check if file exists before removing
safe_rm() {
if [ -e "$1" ]; then
rm "$1"
cecho $GREEN "Removed $1"
else
cecho $RED "$1 not found, skipping removal"
fi
}
# Check if arguments are provided for gtt-s.py
if [ $# -eq 0 ]; then
cecho $RED "Usage: $0 <arguments for gtt-s.py>"
exit 1
fi
# Main script
cecho $GREEN "Starting script..."
# Run gen_init.py with arguments
cecho $GREEN "Running gen_init.py (thumbnail + tts)..."
python gen_init.py $* > /dev/null 2>&1
cecho $GREEN "Thumbnail + TTS completed."
# Convert rec16.mp3 to rec16.wav
cecho $GREEN "Converting rec16.mp3 to rec16.wav..."
ffmpeg -i rec16.mp3 -ar 16000 rec16.wav > /dev/null 2>&1
cecho $GREEN "Conversion complete."
# Run main script with model and input file
cecho $GREEN "Running main script..."
./main -m models/base.bin rec16.wav -ojf -sow
cecho $GREEN "Main script completed."
# Run consolidator script
cecho $GREEN "Running fake consolidator script..."
cp rec16.wav.json consolidated.json
cecho $GREEN "Consolidator script completed."
cecho $GREEN "Fetching and Chopping BG Video..."
python get-background.py
cecho $GREEN "BG Video Processed"
cecho $GREEN "Layering Captions on Segment.mp4..."
python captions.py
cecho $GREEN "Captions Layered Successfully"
cecho $GREEN "Merging Audio with Captioned Video..."
python merge-audio.py
cecho $GREEN "Merged Audio Successfully"
cecho $RED "Cleaning Up"
safe_rm "rec16.wav"
safe_rm "rec16.mp3"
safe_rm "rec16.wav.json"
safe_rm "consolidated.json"
safe_rm "./output/segment.mp4"
safe_rm "output_with_captions.mp4"
cecho $GREEN "Script finished."