wapmorgan / Mp3Info

The fastest PHP library to extract mp3 meta information (duration, bitrate, samplerate and so on) and tags (id3v1, id3v2).
https://wapmorgan.github.io/Mp3Info/
GNU Lesser General Public License v3.0
139 stars 41 forks source link

Should be first frame header? #7

Closed jpmurray closed 6 years ago

jpmurray commented 6 years ago

Hello,

Currently building myself a tool in my spare time, and I've been using Mp3Info for about a week now and, two days ago, I started to get, coming from readFirstFrame(): At 0(0) should be the first frame header!.

Now, the thing that changed: I formatted my laptop ! I'm wondering if there is any dependencies outside of PHP that I might have missed that influence this?

wapmorgan commented 6 years ago

Ok, @jpmurray check it now with latest updates (0.0.3).

wizwizcao commented 6 years ago

Get a similar alert At 4121(1019) should be the first frame header! There could be some noise data at the header. One suggestion is to update the code from

if (array_unique($headerBytes) === [0]) {

to

if (($headerBytes[0] & 0xFF) != 0xFF || array_unique($headerBytes) === [0]) {

Located in Mp3Info.php, line 245. I am ok now.

wapmorgan commented 6 years ago

Updated dev-master, check it out.

wapmorgan commented 6 years ago

@wizwizcao check out dev-master branch

wizwizcao commented 6 years ago

It works.

wapmorgan commented 6 years ago

OK, I'll release soon.