Giter Site home page Giter Site logo

Length about musicmetadata HOT 26 CLOSED

leetreveil avatar leetreveil commented on July 20, 2024
Length

from musicmetadata.

Comments (26)

leetreveil avatar leetreveil commented on July 20, 2024

There are plans yes, I just need to find the time to do it.

Your player looks good!

On Fri, Jan 17, 2014 at 3:44 AM, Benjamin Kaiser [email protected]
wrote:

It is not necessarily included in the ID3 tags, but having the duration of a song would be really useful. Are there any plans to add duration detection? (my music player is coming along nicely and I would like to display a duration attribute on the list)

music-player

Reply to this email directly or view it on GitHub:
#40

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

Okay awesome, thanks for letting me know.

BTW here is a link to the repo to my music player in case you want to check it out or list it as something using musicmetadata. https://github.com/benkaiser/node-music-player

from musicmetadata.

leetreveil avatar leetreveil commented on July 20, 2024

Version 0.3.0 now reads duration for mp3, ogg and mp4 files. Other containers coming soon.

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

Thanks a bunch @leetreveil ! You're a legened!

I updated my npm repos and made some changes as well as filtering for displaying and I am noticing that a large, maybe 50% number of songs have 0 as their duration (despite being mp3, my entire library is mp3, also my library is not all legit and so quality isn't assured I guess). I can give you any samples if you want. Are you just fetching the TLE/TLEN tag for the duration? If so, maybe I should just fix up the data in my library by scanning them all for actual length and applying it to their TLE/TLEN tags.

BTW here is a screenshot of my library with duration's in action (right-most column):

murdoch-results1

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

I have found another node.js library called taglib that does similar things to musicmetadata (but does not do cover art) but does do durations on tracks (not just pulled from id3, I was able to pull the length of a song I wasn't able to pull with your implementation). Let me know how you go with this bug, or if I should just try some alternative way.

Thanks once again for your awesome help @leetreveil !

from musicmetadata.

leetreveil avatar leetreveil commented on July 20, 2024

Would be great if you could send me a couple of those tracks.

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

Here is a link to a couple of tracks that returned 0: https://copy.com/uSPc1z2XUCJH

from musicmetadata.

nickdesaulniers avatar nickdesaulniers commented on July 20, 2024

Also seeing a few mp3's with a duration of zero. Also, calculating the duration seems to be very time prohibitive.

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

I am wondering is there a reason taglib can do it so fast? Is it because it is simply bindings for a C library? Maybe if it is too time-intensive it could be an optional parameter.

from musicmetadata.

the-eater avatar the-eater commented on July 20, 2024

It's sorta a pain that it is that slow, I was able to scan my library (1045 songs) in less then a minute, now I have to wait about an hour D:

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

@Eaterofcode @leetreveil hmm if it is very time prohibitive then maybe you could just add taglib as a dependency and using that if the duration option is flagged. Because from my benchmarks it was incredibly fast, here is the testing repo if you want to run them yourself. Let me know what your thoughts are on this @leetreveil

from musicmetadata.

the-eater avatar the-eater commented on July 20, 2024

the point is I don't want taglib, I want mm. Im gonna try to optimize this

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

@Eaterofcode okay give it a shot, @leetreveil might accept a pull-request speeding it up. But I think taglib seemed to do it the best. Taglib just didn't offer cover art so it was a no-go for me :) However it did have writing metadata... @leetreveil nudge nudge, editing...

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

Wow the duration calculation slows it down. Thanks for implementing it @leetreveil but it is pretty unusable with the speed costs.

Might try use taglib for durations so that it keeps it's high speed. Any update on working something out @Eaterofcode ?

from musicmetadata.

the-eater avatar the-eater commented on July 20, 2024

Im sorry I dont have any update. :( Im not too familiar with the code and things used. Im just living without duration now.

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

Okay fair enough. In the mean time I will pass off duration fetching to taglib (it is so fast there isn't much overhead at all using it and musicmetadata simultaneously). Will update here if I run into any issues.

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

I have implemented taglib for duration fetching after musicmetadata gathers all the other attributes and damn is it fast. Here is my commit updating my code to use taglib for durations.

from musicmetadata.

the-eater avatar the-eater commented on July 20, 2024

Okay, I dont know the code for this (if I knew I would do it) my idea is the following:

Check for TLE/TLEN tags if so return duration from that, end stream.
if thats not present check if it is VBR or CBR if CBR use the formula to calculate it, if it's VBR use the slow streaming method.

this should be a solid fix for now since most people have CBR mp3 files

from musicmetadata.

leetreveil avatar leetreveil commented on July 20, 2024

Parsing CBR files should be much faster now. ⚡

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

Just did a quick look and it appears most (~95%) of my songs are VBR. Will switch back to testing durations with musicmetadata and report my findings.
Thanks for the research @Eaterofcode and thanks for the fast implementation @leetreveil!

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

I just did a test. Although it is much faster, scanning of CBR files in musicmetadata than it was before, it is still maybe 10-30x slower than it is with taglib. As such because I am opting for user experience I will still use taglib for duration reading. Thanks anyway for implementing it @leetreveil

from musicmetadata.

the-eater avatar the-eater commented on July 20, 2024

I don't think this fixes it? just a quick fix for most files. the real problem is still there

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

@Eaterofcode yes of course. But even for the 'most files' it is slower than using taglib.

from musicmetadata.

the-eater avatar the-eater commented on July 20, 2024

Yeah but I meant that this issue shouldn't be closed because its still slow for VBR. and the TLE/TLEN check isnt their either

from musicmetadata.

the-eater avatar the-eater commented on July 20, 2024

and btw it will probably be slower then taglib because taglib is C++ afaik

from musicmetadata.

benkaiser avatar benkaiser commented on July 20, 2024

@Eaterofcode imho it should be marked as closed. @leetreveil has done a lot of work to fix this. and with CBR working moderately fast it should be okay.

You are right that taglib is C++, but that is the reason why this project won't match taglibs speed. So as far as I am concerned @leetreveil has done an excellent job and the issue should be marked as closed.

from musicmetadata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.