0
0

Well, I use FMOD Stream* functions to play all the mp3s, and thats all good – even if the displays are wrong, the file still plays to completion, whether or not you use the MPEGACCURATE flag, just don’t try to seek or get time, as it will be wrong for VBR :smile:

I’d still like to know if theres a way to tell a VBR mp3 apart from a CBR (certain bytes of the file signaling the bitrate changes). This way, the MPEGACCURATE flag could be set automatically only for the few VBR mp3s, and the rest load quickly as usual.

See, I have an mp3 class module that can parse ID3 and such from CBR files, but its inaccurate for VBR. I display the bitrate and length in the playlists as each file is parsed. Having this VBR detection would give the playlist accurate VBR results, and the usual speedy CBR parsing. I’m thinking of having the VBR files preload into a hidden channel with MPEGACCURATE, to get the correct attributes for just those files.

Calling all geniuses :smile:

<font size=-1>[ This Message was edited by: K6Deux on 2002-03-07 15:48 ]</font>

  • You must to post comments
0
0

Thats not what I meant brett, I was referring to VBR without mpegaccurate and using my class module. You and I both know Fmod kicks ass :smile:

I’m just looking for a “smarter” way to tell if a file is VBR before having to open streams with mpegaccurate, so the CBR files will still load quickly, and the VBR will load accurately, and all the displays and seeking will be perfect.

Assuming I find a solution here (with help) I will no longer rely on the mp3 class module for bitrate and run length, as Fmod indeed does a better job :smile:

  • You must to post comments
0
0

Is it difficult to just read the start of the file and search the mp3 header?
You would have to read the first part of the mp3 anyway to read the id3v2 tag…
Or doesn’t the header say it is vbr?

  • You must to post comments
0
0

Maybe reading the first ten/twenty/thirty frame headers could be useful. If the bitrate is the same in all headers, probably they are CBR, else they are surely VBR.
Frames can be also analized in the middle or at the end of the file…
Can it work?

  • You must to post comments
0
0

Here is a cut/past of my function from my player :

Private Function IsVBR(ByVal Filename As String) As Boolean
Dim XingH As String * 4
Dim FileSize As Long
Dim i As Long
Dim x As Byte

FIO% = FreeFile

Open Filename For Binary Access Read As FIO%
FileSize = LOF(FIO%): If FileSize &lt; 256 Then Close FIO%: Return

‘check l’entete
For i = 1 To 5000 ‘check out first 5000 bytes
Get #FIO%, i, x
If x = 255 Then ‘ header must begin with 255 then followed by 250 or 251
Get #FIO%, i + 1, x
If x > 249 And x < 252 Then
Headstart = i ‘ Inititialize the position of the header
Exit For
End If
End If
Next i

'Check for XingHeader
Get #FIO%, Headstart + 36, XingH
If XingH = "Xing" Then
    IsVBR = True
Else
    IsVBR = False
End If

Close FIO%

End Function

‘n’joy ๐Ÿ˜‰

  • You must to post comments
0
0

So, if I understand your code, you look for the mp3 header in the first 5000 bytes, and 36 bytes into header for the string “Xing” and that means its VBR.

What about VBR mp3s not encoded with a Xing derivative (Blade, LAME, etc), have you tested this, or do they all have Xing signatures? I did look at a couple of my existing VBR mp3s and indeed Xing appears around byte 36 (header at 0), so I guess you’re right.

If its really this easy and I’m not dreaming, wow, perfect and thanks! ๐Ÿ˜€

  • You must to post comments
0
0

It s always “Xing” because VBR encoding was found by Xing Technology ๐Ÿ˜‰

<font size=-1>[ This Message was edited by: KarLKoX on 2002-03-10 07:53 ]</font>

  • You must to post comments
0
0

I think with Lame you can specify wether the Xing header should be included or not.
This means you can have VBR mp3’s withouth the Xing header.
Maybe they are very rare, but it is possible.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.