Support calculating approximate duration
See original GitHub issueGiving the duration: true
option makes all media files be fully scanned to calculate their accurate duration, but when a large number of files should be handled, it is enough to get approximate duration of songs; most clients to play them do not trust what the server gives anyway.
How about adding an option like approximate: true
to duration: true
for approximate duration? As I recall, an old version of musicmetadata
did that by assuming CBR when the first three frames have the same bit-rate; I ported that to mp3-duration
(https://github.com/mycoboco/mp3-duration/commit/abdb1bca7d9739dbff1b99479b84c811d2bc6f12).
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Approximate modified duration (ApproxModDur) - PrepNuggets
Modified duration of a bond that is calculated using the approximate method by calculating the change in prices for a small change in ......
Read more >Duration Formula (Excel Examples) | Calculate Duration of Bond
The formula for the duration is a measure of a bond's sensitivity to changes in the interest rate, and it is calculated by...
Read more >Duration Definition and Its Use in Fixed Income Investing
Duration indicates the years it takes to receive a bond's true cost, weighing in the present value of all future coupon and principal...
Read more >DURATION function - Microsoft Support
Duration is defined as the weighted average of the present value of cash flows, and is used as a measure of a bond...
Read more >Bond Duration Calculator - Exploring Finance
The Bond Duration Calculator can be used to derive the duration of a bond: Number of Years to Maturity: Yield or Market Rate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That could very well be the reason.
On a good quality (using a recent Lame encoder) MP3 encoded file, it will do the duration calculation on the VBR/Xing/Info header. That header specifies the number of frames.
I just removed a silly rounding from that calculation. It is pretty accurate only thing what is missing is subtracting the “empty” space in the very last frame.
@mycoboco, thanks for your reply and promising the benchmark.
Feel free to open an issue for the remaining 6 files or re-open this one.