-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
47 lines (37 loc) · 1.23 KB
/
Copy pathmain.py
File metadata and controls
47 lines (37 loc) · 1.23 KB
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
import argparse
import os
from modules.extractor import extract_audio
from modules.transcriber import transcribe_audio
from modules.srt_generator import generate_srt
def main():
parser = argparse.ArgumentParser(
description="AutoSub — Telugu & Indian English subtitle generator"
)
parser.add_argument(
"-i", "--input",
required=True,
help="Path to input video file"
)
parser.add_argument(
"-o", "--output",
default="output",
help="Directory to save SRT file (default: output/)"
)
args = parser.parse_args()
# Validate input file
if not os.path.exists(args.input):
print(f"Error: File not found — {args.input}")
return
# Create output dir if not exists
os.makedirs(args.output, exist_ok=True)
# Get output SRT path
filename = os.path.splitext(os.path.basename(args.input))[0]
srt_path = os.path.join(args.output, f"{filename}.srt")
# Pipeline
print("\n--- AutoSub Starting ---\n")
audio_path = extract_audio(args.input, args.output)
chunks = transcribe_audio(audio_path)
generate_srt(chunks, srt_path)
print(f"\n--- Done! SRT saved to {srt_path} ---\n")
if __name__ == "__main__":
main()