Skip to content

Fix pts <-> seconds conversions #682

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

Merged
merged 2 commits into from
May 15, 2025
Merged

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented May 15, 2025

🥶

We weren't multiplying by timeBase.num. All the videos we've been testing on so far had a timebase.num == 1, so the bug went unnoticed.

@NicolasHug NicolasHug added the bug Something isn't working label May 15, 2025
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label May 15, 2025
containerMetadata_.durationSeconds =
ptsToSeconds(formatContext_->duration, AV_TIME_BASE);
ptsToSeconds(formatContext_->duration, defaultTimeBase);
Copy link
Member Author

Choose a reason for hiding this comment

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

Drive-by: I've been annoyed by the existence of double ptsToSeconds(int64_t pts, int den), so I'm removing it.

defaultTimeBase corresponds to FFmpeg's AV_TIME_BASE_Q, which we can't use due to a C++ pendantic compilation error.

Copy link
Contributor

@scotts scotts left a comment

Choose a reason for hiding this comment

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

Good catch!

@NicolasHug NicolasHug merged commit 5013118 into pytorch:main May 15, 2025
46 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants