Found some odd video entries on Commons that have no duration in the metadata, but it shows immediately when playback starts. Example:
https://commons.wikimedia.org/wiki/File:The_Sea_Beast_(1926).webm
and
https://commons.wikimedia.org/w/api.php?action=query&format=json&prop=imageinfo&iiprop=metadata&&titles=File:The%20Sea%20Beast%20(1926).webm
Other file metadata has duration encoded as playtime_seconds, length, or duration, which is not ideal but solvable. But those like the example above are hard to tackle.