-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_transcript.py
More file actions
46 lines (39 loc) · 1.25 KB
/
Copy pathrun_transcript.py
File metadata and controls
46 lines (39 loc) · 1.25 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
"""Regenerate transcript/timestamps from an existing audio file only."""
import argparse
from pipeline import config, transcribe
from run_pipeline import _write_plaintext, _write_srt
def main():
parser = argparse.ArgumentParser(
description="Transcribe an existing narration audio file without regenerating TTS."
)
parser.add_argument(
"--audio",
default=config.FULL_AUDIO,
help="Existing narration audio path.",
)
parser.add_argument(
"--json",
default=config.TRANSCRIPT_JSON,
help="Path to write transcript JSON.",
)
parser.add_argument(
"--txt",
default=config.TRANSCRIPT_TXT,
help="Path to write transcript text.",
)
parser.add_argument(
"--srt",
default=config.TRANSCRIPT_SRT,
help="Path to write transcript SRT.",
)
args = parser.parse_args()
config.ensure_dirs()
segments = transcribe.transcribe(args.audio)
config.write_json(args.json, segments)
_write_plaintext(args.txt, segments)
_write_srt(args.srt, segments)
print(f"Wrote transcript JSON: {args.json}")
print(f"Wrote transcript text: {args.txt}")
print(f"Wrote transcript SRT: {args.srt}")
if __name__ == "__main__":
main()