Open ghost opened 2 years ago
Provide sample file
Hello, I fear I am experiencing the same issue.
I have personally tested with files from there : https://samplelib.com/sample-mp3.html (the 3s and 9s samples).
For the 9s file, I get a duration of 19s, for the 3s file, I get 6s.
However, the 700KB audio file from this other source works fine, I get the correct duration of 27s.
Any chance you're still maintaining this project ? 😄
I checked Duration param on below sample file (PHP 8.1) and value was "187" but correct answer is "93". https://file.io/4oLhqewhW6nJ
It seems package is abandoned.
To @greenreptile and anyone who might see this in the future: I have since found an alternative to this issue by using : https://github.com/PHP-FFMpeg/PHP-FFMpeg. It works like a charm and even works for video files.
I hate to advertise someone else's package here, but I feel like other devs might find it useful, so as to not go through the same process I have after I posted this initial comment.
@Nispeon Yes. I tested it right now and seems satisficing.
@Nispeon @greenreptile
Fixed in 0.1.0: if does not work, increase \wapmorgan\Mp3Info\Mp3Info::$framesCountRead
from 2 to 3 or 4.
File name | dur. | bitrate | sample | song | artist | track | time
sample-12s.mp3 | 0:12 | 128kbps | 44.1 | | | | 3.504753112793E-5
sample-3s.mp3 | 0:03 | 128kbps | 44.1 | | | | 1.5974044799805E-5
sample-6s.mp3 | 0:06 | 128kbps | 44.1 | | | | 1.5974044799805E-5
sample-9s.mp3 | 0:09 | 128kbps | 44.1 | | | | 1.5020370483398E-5
Total duration: 0:51 | Total parsing time: 0.0001
I have tested two mp3 files with the code provided as example, one was ok, but the other, it should be 3.13 min. but it shows 6.24 min.