tag icon indicating copy to clipboard operation
tag copied to clipboard

Feature Request: expose Duration() for each audio type

Open delucks opened this issue 6 years ago • 3 comments

Hello! I'm using your library to parse out information from a variety of different audio files for storage in a database. I'd like to store the duration of each track as well, but it looks like this library doesn't have support for getting each track's duration from the metadata headers yet. To confirm this is possible, I looked through the specs of all the formats currently supported- there are fields in all for retrieving the duration (or length as it's sometimes called). As an example, here's a python library which appears to parse all of them. I would appreciate support for this field! If you are short on time, I will start work on implementing this.

delucks avatar Dec 23 '18 00:12 delucks

Yes, we don't currently have duration because that's digging into the audio format itself, rather than the ID3/equiv layer of metadata. I think that there was an attempt to expose bitrates in a previous pull request (see #7), which might be of some help.

dhowden avatar Dec 23 '18 02:12 dhowden

I see, the approach in #7 looks similar for the specific codec they're working with. Would you mind elaborating more on your comment on issue 7 about moving the code into a sub-package? If I start working on code that works with formats rather than the metadata layer, would you like me to create a codecs/formats package and keep the implementation there separate from the main package?

delucks avatar Dec 23 '18 04:12 delucks

Bumping up this thread — I need this feature as well and would love to help landing it, happy to take cues from you @dhowden on how to organize the code since that seemed to be a concern with the previous PR.

jsilland avatar Aug 20 '22 02:08 jsilland