Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th July 2021, 00:07   #1  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 748
Timestamps in MKV

What are Timestamps in MKV? Is it for syncing audio and video?
Atlantis is offline   Reply With Quote
Old 26th July 2021, 01:22   #2  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 7,769
they are for VFR.

a VFR file without it would run Async.

https://mkvtoolnix.download/doc/mkvm...imestamp_files
huhn is offline   Reply With Quote
Old 23rd September 2021, 15:40   #3  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 529
There are no timestamps in mkv. DTS is not used, like in mp4 or mpeg-ts and instead of PTS durations are used with JUST millisecond precision (last thing is fixable at least).
Balling is offline   Reply With Quote
Old 23rd September 2021, 22:50   #4  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 7,769
there are literally 4 "different" types of timestamps just press on the link...

and why would a judder in the nanosecond range matter...
huhn is offline   Reply With Quote
Old 24th September 2021, 07:23   #5  |  Link
Liisachan
李姗倩 Lǐ Shān Qin
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,337
Timestamps also decide on which video frame a specific subtitle starts, and on which video frame it vanishes. A small difference of timing, measured in nanoseconds, could actually cause a macroscopic difference in some cases.
Example. Suppose you have an SSA subtitle "Hi!" that starts at 0:11:22.89, i.e.
S = 682 890 000 000 nanoseconds.

This sub is supposed to start at Frame 16373 of a 24000/1001 fps video, i.e.
V = 682 890 541 666.666... nanoseconds.
Since the previous Frame #16372 is at V' = 682 848 833 333.333... nanoseconds, "Hi!" is not on V' but on V (assuming that subtitle events only occur on Video-frame-change).

What if you assume one video frame is 41 708 300 nanoseconds, instead of the theoretically correct value 41 708 333.333... nanoseconds? That is, what if about 33 nanoseconds too small? Intuitively, a 33-nanosec difference doesn't seem to be a problem at all. However, in this slightly difference scale, Frame 16373 will start at:
U = 682 889 995 900 nanoseconds.
Since S is later than U, our "Hi!" will no longer appear on the intended frame #16373, breaking the subtitle-video sync.

FPS is rational in AVI, expressed with two parameters dwScale and dwRate (a denominator and a nominator), hence AVI time stamps can be rational. Timestamps in Matroska, on the other hand, are always integers: multiples of TimestampScale, which is typically 1 millisecond (1 000 000 nanoseconds). Although this could potentially cause several difficult problems (e.g. audiophiles may want sample-accurateness with 44100 Hz audio, but generally a multiple of 1/44100 can't be expressed as an integer), in practice, everything works fine afaik - Matroska has developed its own (non-trivial) methods to overcome such issues.

One interesting point is, you can't create a 24000/1001-fps Matroska video as CFR! It's technically VFR, the length of one frame being variable (typically between 41 ms and 42 ms). Although I believe MKVToolnix will automatically handle everything right anyway, the fact remains that the length of one video frame in MKV may be 1 ms shorter or 1 ms longer, which could potentially cause unexpected behaviors. To be extra safe, one might want to avoid a subtitle whose start- or end-time is within 1 ms of a time stamp of a video frame, so that every event may be well-ordered. In the example above, 0:11:22.88 and 0:11:22.89 in SSA/ASS are basically the same thing, of which using 0:11:22.88 is safer. 0:11:22.89 is too close to a (theoretial) video-frame change, with a very small margin (V-S = ~0.5 ms).

That said, in reality, softsubs are not always frame-accurate anyway, depending on which renderer/settings you use...
Liisachan is offline   Reply With Quote
Old 2nd March 2022, 16:14   #6  |  Link
shae
Registered User
 
Join Date: Jun 2006
Posts: 394
Quote:
Originally Posted by Liisachan View Post
in practice, everything works fine afaik - Matroska has developed its own (non-trivial) methods to overcome such issues.
What are these methods?
shae is offline   Reply With Quote
Old 5th March 2022, 18:19   #7  |  Link
Liisachan
李姗倩 Lǐ Shān Qin
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,337
https://matroska.org/technical/notes...scale-rounding

Spec being that, MkvToolNix is not yet perfect, though.
https://forum.doom9.org/showthread.p...34#post1965234

Please share your thoughts...
Liisachan is offline   Reply With Quote
Old 6th March 2022, 00:46   #8  |  Link
shae
Registered User
 
Join Date: Jun 2006
Posts: 394
Thanks. Was just curious.
shae is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:13.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.