Closed tumbelin closed 4 years ago
I'm getting double duration, Anyone can help about this issue.
@tumbelin Can you provide a sample of this file or this happens with any file with 64 kb/s bitrate? @sachin-imark Please, provide a sample.
Hello @tumbelin
$audio = new Mp3Info($request->file('song'), true); $duration = ($audio->duration)*1000; //duration in milliseconds
File Bit Rate from file property: 124kbps
Audio bitrate using below code : 64 kb/s echo 'Audio bitrate: '.($audio->bitRate / 1000).' kb/s'.PHP_EOL;
Sometimes it's getting the right duration of a song, But sometimes I'm getting double duration,
Please provide me a better solution for this.
@wapmorgan @sachin-imark yes, this happens with any file below 128kb/s, What I had to do is put a condition to work with only 128kb/s files
$audio = new Mp3Info($audio); if($audio->bitRate/1000 >= 128){ ........ }else{ //message your file doesn't have the minimum bitrate quality }
Hi @wapmorgan @tumbelin ,
As per requirements, I need to upload a file less than 128kbps bitrate quality as well, In that case, it's giving the issue, So please let me know about the solution which I can implement.
Thanks
hahaha @sachin-imark, I'm not the developer of this library, I opened the issue, text to @wapmorgan for solutions
Hi @wapmorgan ,
Please have a look at this issue. and please provide a solution.
Thanks
@tumbelin Please, if you have files with 64k bitrate, upload here to make some tests. I have only two files with 64k bitrate, and only one is scanned with invalid duration.
Discovered problem. That file, really, is not 64kbps. It has VBR (first frame is 64kbps, but next ones is 128kbps), which leads to invalid duration. This library reads only first frame to minimize parsing time and make calculations based on it. Usually, audio with variable-bitrate has a special mark "Xing", which makes calculations work in another way. But this file does not have this tag. I don't know, which the best way to fix this problem. The simplies way it to read 2 first frames and if they are different, read all frames and calculate or make predictions on second frame.
Hi @wapmorgan ,I use this link (https://audio.online-convert.com/convert-to-mp3) to convert files I need into mp3, there you can specify the bit rate
Hello @tumbelin
$audio = new Mp3Info($request->file('song'), true); $duration = ($audio->duration)*1000; //duration in milliseconds
File Bit Rate from file property: 124kbps
Audio bitrate using below code : 64 kb/s echo 'Audio bitrate: '.($audio->bitRate / 1000).' kb/s'.PHP_EOL;
Sometimes it's getting the right duration of a song, But sometimes I'm getting double duration,
Please provide me a better solution for this.
@wapmorgan Please have a look into this.
Thanks
Need a file sample to fix.
Adjusted calculation for VBR files. Check out dev-master
and try again.
Closing due to oldness
Hi, Thanks for this, it could be help but and getting some weirds results, When I tried to get duration from a file I got the double of duration, but I noticed this depends on the bit rate of the file. Files with bit rate like 64 kbit/s I have to divide by 2 to get the right answer, and for mp3's with bit rate 128 or 192 kbps the info is right without any manipulation