Page MenuHomePhabricator

Midi files with duration 0 due to not having tempo events
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
which all run into the dividebyzero problem. It seems this is because getID3 doesnt support calculating the duration for files that have no tempo events. I think we can create some fallback logic for this.

What should have happened instead?:
The files should have a duration

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

TheDJ renamed this task from Midi files without to Midi files with duration 0 due to not having tempo events.Jan 14 2026, 11:17 PM

Change #1226975 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/TimedMediaHandler@master] Fix duration of midi files without tempo events

https://gerrit.wikimedia.org/r/1226975

Change #1226975 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Fix duration of midi files without tempo events

https://gerrit.wikimedia.org/r/1226975

TheDJ moved this task from Inbox to For-review on the User-TheDJ board.
TheDJ moved this task from Backlog to Patch proposed upstream on the Upstream board.

The files mentioned in the OP are very short. However, there are many much longer files that also show a zero duration e.g. https://commons.wikimedia.org/wiki/File:Erik_Satie_-_Ogive_No.2.mid – strangely, https://commons.wikimedia.org/wiki/File:Erik_Satie_-_Ogive_No.1.mid shows the correct time of 1:30. Many others, like https://commons.wikimedia.org/wiki/File:Ludwig_van_Beethoven_-_Bagatelles_Op._126.mid , show a drastically shorter time than they should, 2:50 instead of 18:58.

The files mentioned in the OP are very short. However, there are many much longer files that also show a zero duration

Yes this is known, there is a patch in the works for most of these. but that will still take a bit to land, and then we need to run a script to find and update the database entries for all those files.

e.g. https://commons.wikimedia.org/wiki/File:Erik_Satie_-_Ogive_No.2.mid – strangely, https://commons.wikimedia.org/wiki/File:Erik_Satie_-_Ogive_No.1.mid shows the correct time of 1:30. Many others, like https://commons.wikimedia.org/wiki/File:Ludwig_van_Beethoven_-_Bagatelles_Op._126.mid , show a drastically shorter time than they should, 2:50 instead of 18:58.

This might be a different issue, or it might simply be that the duration information in the file itself is incorrect. When I have time, I'll take a look.