View Single Post
Old 24th April 2021, 00:59   #4  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
Quote:
Originally Posted by videoh View Post
The frame rate can be calculated from the number of samples and the duration:

Code:
u_int32_t mp4_numSamples = MP4GetTrackNumberOfSamples(mp4File, trackId);
MP4Duration duration = MP4GetTrackDuration(mp4File, trackId);
double msDuration = (double)(MP4ConvertFromTrackDuration(mp4File, trackId, duration, MP4_MSECS_TIME_SCALE));
double mp4_Frame_Rate = mp4_numSamples * 1000LL / msDuration;
It may also be specified in the video ES.
And that's the problem. It can be specified in multiple places, and there's no enforcement mechanism to make sure they even match.

The ES is generally what players go by, so it'd go for that. The MP4 headers can be wrong, and often give the average fps for variable frame rate content, which isn't that helpful.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote