aws-samples / aws-transcribe-captioning-tools

Convert AWS Transcribe output into multiple caption formats.
MIT No Attribution
93 stars 28 forks source link

Can't find srt.py #1

Open statik opened 5 years ago

statik commented 5 years ago

Hi! I'm interested in using these tools, but I don't see the srt.py file mentioned in the README.

joshua-wyatt commented 5 years ago

Same issue here, looking for vtt.py as described.

JCFerrerG commented 5 years ago

Misleading information

Looking through the commit logs, neither srt.py nor vtt.py were included since those lines in the README were authored.

I suspect that the references to srt.py and vtt.py are misleading (and possibly a mistake).

Another potential mistake, is that src/srtUtils.py and tools/srtUtils.py are duplicates. This makes me wonder if this sample is actively maintained.

@EddieGoynesAmazon , would you be able to provide feedback on my comments above?

A working example

srtUtils.py contains the writeTranscriptToSRT function. An example usage of this can be found in translatevideo.py#L85. A description of this example can be found in the the blog post.

I used this to create the following snippet -- which replicates the behavior ascribed to srt.py in the README.

# srt.py
import sys

from srtUtils import *

input_file = sys.argv[1]
output_file = sys.argv[2]

with open(input_file", "r") as f:
      data = writeTranscriptToSRT(f.read(), 'en', output_file )

Other examples

I recommend looking at these more elaborate serverless examples:

deanx commented 5 years ago

The below really works. That is the code I am using right now.

srt.py

import sys

from srtUtils import *

input_file = sys.argv[1] output_file = sys.argv[2]

with open(input_file, "r") as f: data = writeTranscriptToSRT(f.read(), 'en', output_file )

========================================================

webvtt.py

import sys

from webvttUtils import *

input_file = sys.argv[1] output_file = sys.argv[2]

with open(input_file, "r") as f: data = writeTranscriptToWebVTT(f.read(), 'en', output_file )