aws-samples / aws-samples/aws-transcribe-captioning-tools

get_time_code function error

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
94
Forks
28
PR merge metrics
No merged PRs in 30d

Description

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 ))

Contributor guide

Open the contributing guide

Research direction

Start at the get_time_code function and compare its microsecond formatting with the supplied correction. Verify the resulting WebVTT timestamps keep adjacent captions in the correct order.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
audio-video-rtc
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.