aws-samples / aws-transcribe-captioning-tools

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

get_time_code function error #6

Open kelleymertig opened 4 years ago

kelleymertig commented 4 years ago

The get_time_code function sometimes delivers the microseconds incorrectly causing the following caption to appear before the previous caption is removed.

I corrected the issue by overriding the function with the code below:

Format and return a string that contains the converted number of seconds into WebVTT format

def get_time_code( aws_timecode ): timedelta = datetime.timedelta(seconds=float(aws_timecode))

hours = (timedelta.seconds // 3600) % 24
minutes = (timedelta.seconds // 60) % 60
seconds = timedelta.seconds % 60
microseconds = timedelta.microseconds / 1000
return str( "%02d:%02d:%02d.%03d" % (hours, minutes, seconds, microseconds ))