Atlantis
26th July 2021, 00:07
What are Timestamps in MKV? Is it for syncing audio and video?
huhn
26th July 2021, 01:22
they are for VFR.
a VFR file without it would run Async.
https://mkvtoolnix.download/doc/mkvmerge.html#mkvmerge.external_timestamp_files
Balling
23rd September 2021, 15:40
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).
huhn
23rd September 2021, 22:50
there are literally 4 "different" types of timestamps just press on the link...
and why would a judder in the nanosecond range matter...
Liisachan
24th September 2021, 07:23
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...
shae
2nd March 2022, 16:14
in practice, everything works fine afaik - Matroska has developed its own (non-trivial) methods to overcome such issues.
What are these methods?
Liisachan
5th March 2022, 18:19
https://matroska.org/technical/notes.html#timestampscale-rounding
Spec being that, MkvToolNix is not yet perfect, though.
https://forum.doom9.org/showthread.php?p=1965234#post1965234
Please share your thoughts...
shae
6th March 2022, 00:46
Thanks. Was just curious.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.