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

Handle properly m2ts fps #3

Open
moi15moi opened this issue Aug 21, 2024 · 0 comments
Open

Handle properly m2ts fps #3

moi15moi opened this issue Aug 21, 2024 · 0 comments

Comments

@moi15moi
Copy link
Owner

moi15moi commented Aug 21, 2024

Currently, the TimestampsFactory.from_fps method always assume that the fps is perfectly constant.
In reality, with some format like m2ts, a "constant" fps isn't actually constant.

Currently, we do all the calculation in ms, but in ns, the equivalent would be: $ns = frame \times {1\over fps} \times 10^9$

But, for m2ts file, it is:

$$\begin{gather} ticks = {90000 \over fps} \\\ ns = \lfloor frame \times ticks \rfloor \times {1\over 90000} \times 10^9 \\\ ns = \lfloor frame \times {90000 \over fps} \rfloor \times {1\over 90000} \times 10^9 \end{gather}$$

For a example, see the end of the message here.

So, to properly handle this situation, we would need to add a time_scale parameter to from_fps: def from_fps(fps: Union[int, float, Fraction, Decimal], rounding_method: RoundingMethod, time_scale: Optional[int] = None) -> Timestamps.

But, by default, mkv round the timestamps to milliseconds, so I guess we may need another from_fps method where we could precise the timestamps precision (ex: ms) and if we round them or not.

@moi15moi moi15moi mentioned this issue Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant