Skip to content

Use average frame rate for video metadata - #1628

Open
mavenlin wants to merge 1 commit into
meta-pytorch:mainfrom
mavenlin:agent/use-average-frame-rate
Open

Use average frame rate for video metadata#1628
mavenlin wants to merge 1 commit into
meta-pytorch:mainfrom
mavenlin:agent/use-average-frame-rate

Conversation

@mavenlin

@mavenlin mavenlin commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • populate video average_fps_from_header from FFmpeg’s AVStream::avg_frame_rate instead of r_frame_rate
  • add a 29 KB variable-frame-rate regression fixture derived from the repository’s existing NASA video

Why

r_frame_rate is FFmpeg’s estimate of the lowest-frequency regular grid that can represent all frame timestamps accurately, the coarsest sufficient grid.

The regression test first asserts that ffprobe reports different values for the two fields, then compares TorchCodec against ffprobe’s avg_frame_rate and away from its r_frame_rate.

Fixture generation

The fixture uses the 480×270 stream from test/resources/nasa_13013.mp4, preserving source timestamps while selecting every second frame for the first 60 source frames and every third frame afterward.

ffmpeg -i test/resources/nasa_13013.mp4 -map 0:v:1 -t 4 \
  -vf "select=if(lt(n\,60)\,not(mod(n\,2))\,not(mod(n\,3)))" \
  -fps_mode vfr -c:v libx264 -pix_fmt yuv420p -an \
  test/resources/nasa_13013_vfr.mp4

@pytorch-bot

pytorch-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1628

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 14, 2026
@mavenlin
mavenlin force-pushed the agent/use-average-frame-rate branch from 4692b7d to 518a2fd Compare August 14, 2026 05:48
@mavenlin
mavenlin force-pushed the agent/use-average-frame-rate branch from 518a2fd to 1a4e2f7 Compare August 14, 2026 06:02
@mavenlin
mavenlin marked this pull request as ready for review August 14, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant