mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-02 11:26:41 +00:00
parent
2d6659b9ea
commit
75722b037d
|
@ -120,12 +120,11 @@ def _format_ts(ts):
|
||||||
Convert an MPEG PES timestamp into a WebVTT timestamp.
|
Convert an MPEG PES timestamp into a WebVTT timestamp.
|
||||||
This will lose sub-millisecond precision.
|
This will lose sub-millisecond precision.
|
||||||
"""
|
"""
|
||||||
|
msec = int((ts + 45) // 90)
|
||||||
ts = int((ts + 45) // 90)
|
secs, msec = divmod(msec, 1000)
|
||||||
ms , ts = divmod(ts, 1000) # noqa: W504,E221,E222,E203
|
mins, secs = divmod(secs, 60)
|
||||||
s , ts = divmod(ts, 60) # noqa: W504,E221,E222,E203
|
hrs, mins = divmod(mins, 60)
|
||||||
min, h = divmod(ts, 60) # noqa: W504,E221,E222
|
return '%02u:%02u:%02u.%03u' % (hrs, mins, secs, msec)
|
||||||
return '%02u:%02u:%02u.%03u' % (h, min, s, ms)
|
|
||||||
|
|
||||||
|
|
||||||
class Block(object):
|
class Block(object):
|
||||||
|
|
Loading…
Reference in a new issue