Fix FPS truncated to integer in multiple locations#203
Open
Conversation
Remove int() casts and fix type annotations that truncated non-integer framerates (e.g. 29.97, 23.976 fps) to integers, causing audio/video sync drift. Fixes #201 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Fixes #201 —
PoseBody.fpsis typed asfloat(since v0.2), but several locations cast it toint, silently losing precision for non-integer framerates like 29.97 fps (NTSC standard).Changes:
utils/openpose.py: Removeint(fps)cast inload_openpose()— pass fps through as-isutils/generic.py: Fixfake_pose()signature fromfps: int=25tofps: float=25.0, removeint(fps)casttensorflow/pose_body.py: Change TFRecord field fromtf.int64totf.float32, serialize asFloatListinstead ofInt64List, remove unnecessarytf.caston deserializationutils/holistic.py: Fixload_mediapipe_directory()type annotation fromfps: inttofps: floatnumpy/pose_body.py: Fixinterpolate()type annotation fromnew_fps: inttonew_fps: floatTest plan
fake_pose(10, fps=29.97)now preserves29.97instead of truncating to29Note
Breaking change for TFRecord: Existing TFRecords serialized with
int64fps will not be compatible with the updatedfloat32schema. This is intentional — the old format was lossy.🤖 Generated with Claude Code