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

Support X-TIMESTAMP-MAP for WebVTT #34

Open
X-C0DE opened this issue Aug 19, 2020 · 5 comments
Open

Support X-TIMESTAMP-MAP for WebVTT #34

X-C0DE opened this issue Aug 19, 2020 · 5 comments

Comments

@X-C0DE
Copy link

X-C0DE commented Aug 19, 2020

On the vtt subtitle fragments, when opened in the subtitle edit, it does a correction/conversion, showing the "translated" times, but with pysubs2, as well with ffmpeg or another program where I can do a simple direct conversion from vtt to srt, this "translation" of the respective times does not happen... I tried to find the logic behind it and noticed that there is a delay based on the MPEGTS value, found at the beginning of the subtitle... does it have anything to do with it?

I am attaching a file where you can see this problem that I mention
file-1_vtt.zip

@tkarabela
Copy link
Owner

WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:368640

Yes, the X-TIMESTAMP-MAP seems to be specifying an offset of subtitle times vs. media times ( https://sdks.support.brightcove.com/features/synchronizing-webvtt-captions.html ), though this is not part of the standard ( https://www.w3.org/TR/webvtt1/ ).

To handle this, it would be necessary to know what is the time scale of the MPEGTS timestamp:

  • Is it 368640 * 1 microsecond?
  • Is it 368640 * some constant defined in the MPEG-TS standard?
  • Does it depend on the input file? (let's hope not)

@X-C0DE
Copy link
Author

X-C0DE commented Oct 18, 2020

to solve this problem i made a workarround 🤣
delay = TIMESTAMP / 90
so I take this delay value in ms and apply it to the whole subtitle

@tkarabela
Copy link
Owner

It would be good to have some support for this, but I'm not sure how to implement this. If anyone has experience with X-TIMESTAMP-MAP, feel free to point me in the right direction or open a pull request.

@tkarabela
Copy link
Owner

Note for implementation of X-TIMESTAMP-MAP: The MPEG timestamps should be Presentation Timestamps (PES) with one unit being 1/90000 s. See also https://www.rfc-editor.org/rfc/rfc8216#section-3.5

@tkarabela tkarabela changed the title Subtitles fix Support X-TIMESTAMP-MAP for WebVTT Oct 31, 2022
@moi15moi
Copy link
Contributor

moi15moi commented Dec 6, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants