-
Notifications
You must be signed in to change notification settings - Fork 309
Open
Labels
Description
Describe the bug
Currently the FPS value is calculated using the stts box.
Lines 1172 to 1173 in d17cfb6
| xmpData_["Xmp.video.FrameRate"] = | |
| static_cast<double>(totalframes) * static_cast<double>(timeScale_) / static_cast<double>(timeOfFrames); |
And timeScale_ is set in movieHeaderDecoder, reading from the mvhd box.
Lines 1555 to 1561 in d17cfb6
| break; | |
| case TimeScale: | |
| xmpData_["Xmp.video.TimeScale"] = buf.read_uint32(0, bigEndian); | |
| timeScale_ = buf.read_uint32(0, bigEndian); | |
| if (timeScale_ <= 0) | |
| timeScale_ = 1; | |
| break; |
However the time scale value from mvhd is not supposed to be used here. Instead, each track contains a mdia box that defines a time scale value specific for this media in the mdhd box. The stts box belonging to this media should use the mdhd value and not the one from mvhd box.
Currently some mp4 files may work if the two values are identical, but not all files are so.