tinytag icon indicating copy to clipboard operation
tinytag copied to clipboard

[BUG] Wrong duration using TinyTag.get

Open tangkk opened this issue 1 year ago • 1 comments

I get a wrong duration with TinyTag.get(myMP3path)

To Reproduce under mac or centos 8, tinytag==1.10.1, python 3.11 or 3.12

Expected behavior The returned duration is 1.176 instead of 4.65

Sample File test1.zip

tangkk avatar Mar 21 '24 08:03 tangkk

Also getting this error on version 2.0.0 224acb1, using python 3.10.10

princelySid avatar Apr 10 '24 23:04 princelySid

In addition to wrong duration, sometimes I get values ​​that are too large and even negative! For example: -46332413.64897959 and 36934167.48408163 seconds. The files have no problem and the durations are calculated correctly with Librosa.

mohsenoon avatar Jun 16 '24 15:06 mohsenoon

In addition to wrong duration, sometimes I get values ​​that are too large and even negative! For example: -46332413.64897959 and 36934167.48408163 seconds. The files have no problem and the durations are calculated correctly with Librosa.

Please attach a sample file.

mathiascode avatar Jun 16 '24 15:06 mathiascode

In addition to wrong duration, sometimes I get values ​​that are too large and even negative! For example: -46332413.64897959 and 36934167.48408163 seconds. The files have no problem and the durations are calculated correctly with Librosa.

Please attach a sample file.

52a6r.zip

tinytag.TinyTag.get('52a6r.mp3').duration --> 47583839.895510204

librosa.get_duration('52a6r.mp3') --> 2632.2140589569162

$ soxi 52a6r.mp3
Input File     : '52a6r.mp3'
Channels       : 1     
Sample Rate    : 44100                                                                                
Precision      : 16-bit
Duration       : 00:43:52.25 = 116082401 samples = 197419 CDDA sectors
File Size      : 21.1M                          
Bit Rate       : 64.0k
Sample Encoding: MPEG audio (layer I, II or III)

mohsenoon avatar Jun 18 '24 08:06 mohsenoon

Should be fixed now. Please try the master branch and see if you still have files that tinytag can't parse properly.

Something's not quite right with the sample file in the original post. Other libraries estimate a duration anywhere from 3 to 5 seconds. tinytag currently reports a duration of 4 seconds, which is close enough in my opinion.

mathiascode avatar Jun 20 '24 21:06 mathiascode