Repository navigation
Correct frame_from_ms and ms_from_frame semantics - #12
Open
CoffeeFlux wants to merge 1 commit into
Open
CoffeeFlux wants to merge 1 commit into
CoffeeFlux wants to merge 1 commit into
Conversation
Both use Aegisub's START conversion: frame_from_ms rounds up to the first frame a line starting at that time is displayed on, and ms_from_frame returns the midpoint between the previous frame and the requested one, not the frame's beginning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
|
Thanks! I find the "A time at which a line starting there is first displayed on
The rest LGTM. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Misc. APIs page describes
aegisub.frame_from_msandaegisub.ms_from_frameas exact frame-boundary conversions, but they don't work that way. Insrc/auto4_lua.cppboth call the video controller withagi::vfr::START, so:frame_from_ms(ms)returns the first frame that begins at or afterms, which is the first frame a line starting atmsis shown on. A time in the middle of a frame rounds up, not down as the docs say.ms_from_frame(frame)returnsprev + (cur - prev + 1) / 2(Framerate::TimeAtFrameinlibaegisub/common/vfr.cpp), the midpoint between the previous frame's start and this frame's start. It is not the first millisecond inside the frame. At 23.976 fps, frame 24 begins at 1001 ms andms_from_frame(24)returns 980.This has been the case since at least the 2019 Aegisub/Aegisub master, so this updates both the latest and the 3.5 docs. It also adds a short paragraph explaining that these are subtitle times, and why the midpoint is useful (it survives centisecond rounding and round-trips with
frame_from_ms).I checked the claims against a Python port of
FrameAtTime/TimeAtFrame:The zh-cn translation and the old 3.0–3.2 pages aren't changed.
🤖 Generated with Claude Code