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

Draft: Proposal to add some rational number in timestamps #425

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robUx4
Copy link
Contributor

@robUx4 robUx4 commented Oct 11, 2020

As discussed in #422 there are some cases where proper timing and backward compatibility is possible.

Wherever TimestampScale was used, if the new fraction is found, it should be used instead.

The fraction cannot just be in each track as the Cluster timestamp is also involved in the equation. So the precision has to be kept there as well.

If we had a fraction type in EBML we could use that type to store the whole fraction.

@robUx4
Copy link
Contributor Author

robUx4 commented Oct 11, 2020

There could be a fraction in each track as well that is not dependent on the other tracks clock. In the end we would use this fraction rather than the global one (which would mostly be for Cluster timestamps) given more range per Blocks for each track. But the value would not be close to what old parsers would understand. In that case that means using a Matroska v5 and marking it unreadable by v4 parsers.

I could live with that. After all MP4 CMAF didn't exist a few years back and now everyone switched to it.

ebml_matroska.xml Outdated Show resolved Hide resolved
TimestampScale When combined with <a href="https://www.matroska.org/technical/elements.html#TimestampScaleDenominator">TimestampScaleDenominator</a> the Timestamp scale is given by the fraction TimestampScale/TimestampScaleDenominator in seconds.-->

<element name="TimestampNumerator" path="\Segment\Tracks\TrackEntry\TimestampNumerator" id="0x2AF6A9" type="uinteger" range="not 0" maxOccurs="1" minver="4">
<documentation lang="en" purpose="definition">Timestamp numerator to apply instead of the TimestampScale, when the TimestampDenominator is present as well.</documentation>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If TrackTimestampScale is revived it should be mentioned its value MUST be the rounded value in nanoseconds of this fraction.

b = `Cluster`'s Timestamp
c = `TimestampScale`

For compatibility with older readers that don't understand these elements, the `TimestampScale` value *MUST*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

More info about the TrackTimestampScale should be added.

@robUx4
Copy link
Contributor Author

robUx4 commented Nov 1, 2020

This might be an addition to #437 but less prioritary. A fraction for the global TimestampScale would give better result as the precision of the nanosecond is the most limiting factor. The floating TrackTimestampScale with a lot of precision even for odd fractions and guidelines on how to interpret the rounding (nearest, floor or top) should be enough.

@robUx4 robUx4 added the spec_main Main Matroska spec document target label Nov 29, 2020
@mcr mcr added the format extension elements that may not merge in the main DocType label Dec 1, 2020
@robUx4
Copy link
Contributor Author

robUx4 commented Apr 4, 2021

Marked as v5.

It may also wait for EBML rationale values to be supported.

…TimestampScale

This allows sample precision of each timestamp is some cases, mostly single track files.

Wherever TimestampScale was used, if this fraction is found, it should be used
instead.
@hubblec4
Copy link
Contributor

hubblec4 commented Apr 4, 2021

Maybe it is better to use the new Rational element type(which is not implemented yet in EBML) .

Nothing is more precise as a rational number.

@robUx4 robUx4 changed the title Proposal to add some rational number in timestamps Draft: Proposal to add some rational number in timestamps Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format addition format extension elements that may not merge in the main DocType matroska-v5 spec_main Main Matroska spec document target
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants