Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timestamps and strip extraneous whitespace in WebVTT output #219

Merged
merged 2 commits into from
Oct 3, 2022

Conversation

tomstuart
Copy link
Contributor

YouTube won’t accept the generated .vtt files if there are any timestamps beyond an hour, because the hour field isn’t formatted correctly. It also shows extraneous whitespace around the segment text because we’re not stripping it. This PR fixes both problems.

Per the WebVTT specification [0]:

> A WebVTT timestamp consists of the following components, in the given
> order:
>
> 1. Optionally (required if hours is non-zero):
>   1. Two or more ASCII digits, representing the hours as a base ten
>      integer.
>   2. A U+003A COLON character (:)

YouTube won’t accept timestamps containing single-digit hours.

[0] https://www.w3.org/TR/webvtt1/#webvtt-timestamp
We already do this for plain text and SubRip output, so we should do it
for WebVTT too.
Copy link

@Kabanosk Kabanosk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jongwook jongwook merged commit 02b7430 into openai:main Oct 3, 2022
@tomstuart tomstuart deleted the fix-vtt-output branch December 7, 2022 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants