|
-
May 9th, 2002, 11:41 PM
#1
MP3 bitrate and duration
I can already read an MP3's ID3 tags. I need to know how to calculate the bitrate and duration as it is not included in ID3 tags. If anyone can give examples or point me in the right direction that would be most helpful.
-
May 10th, 2002, 12:08 AM
#2
http://www.wotsit.org/ will have a documentation on an MP3 file for sure, hopefully one of them will give you information about the header of an MP3.
-
May 10th, 2002, 12:18 AM
#3
-
May 10th, 2002, 12:32 AM
#4
Fanatic Member
hey how do you open a file with winamp? like your mp3 thing???
-
May 10th, 2002, 12:34 AM
#5
Need-a-life Member
Originally posted by Vanguard-MnC
hey how do you open a file with winamp? like your mp3 thing???
Do you mean how I get it played with Winamp?
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 10th, 2002, 01:55 PM
#6
I would rather not use winamp. I am writing a dll that will read ID3 tags, duration and bitrate (for use in an asp script). It would be a lame dll if it depended on winamp, you know?
I know that there is a way that duration and bitrate can be calculated.
-
May 10th, 2002, 02:31 PM
#7
Lively Member
You can easily calculate the bitrate. I've never tried to calcualate the duration but I'm sure its possible. But you do need the duration before you can calculate the bitrate. You would need to find it in the mp3 header. Well, here is the mp3 bitrate calculation. When you have the length of the mp3 in seconds.
VB Code:
Dim ThePath As String
Dim TheSize As Long
Dim DurationInSec as Long
Dim GetMP3Bitrate as Long
ThePath = "c:\yourfile.mp3"
TheSize = FileLen(ThePath)
TheSize = TheSize * 8
GetMP3Bitrate = TheSize \ DurationInSec
-
May 10th, 2002, 02:36 PM
#8
Addicted Member
You can use the mciSendString API
-
May 10th, 2002, 02:54 PM
#9
Lively Member
I and he knows that(I'm assuming he does). He was wanting to calculate it.
-
May 10th, 2002, 03:21 PM
#10
hey thanks formulav8 for the formula, useful. I will try it out tonight.
So I can find the duration in the MP3 header?
-
May 10th, 2002, 04:10 PM
#11
Lively Member
I thought you wanted to be able to calculate it. You can get the freq., bitrate, ect. from the header file.
-
May 10th, 2002, 05:23 PM
#12
I was under the impression that it had to be calculated. I was not aware that it could be read from the header. Do you have any resources? Thanks for your help.
-
May 10th, 2002, 05:57 PM
#13
-
May 11th, 2002, 01:29 PM
#14
Need-a-life Member
Help?
Here's what I "saved" (from a bigger project -the one on my signature-) ...
VB Code:
Option Explicit
Private Type MP3Header
Lenght As Long
Position As Long
ID As String
Layer As String
Frequency As String
Mode As String
Emphasis As String
Padding As Boolean
FrameSize As Long
CopyRighted As Boolean
Original As Boolean
BitRate As String
End Type
Public Version As Byte
Private Sub ReadFile(strFilename As String, mHeader As MP3Header)
Static BitRate(11 To 23, 1 To 14) As String
Dim fn As Integer
Dim lngHeaderPosition As Long
Dim lngFilesize As Long
Dim BitLine As Integer
Dim i As Byte
Dim Tag2 As String
Dim TagSize As String * 4
Dim ID3Tag As String * 3
Dim sHeader As String * 4
'BitRate MPEG-1, MPEG-1, MPEG-1, MPEG-2, MPEG-2, MPEG-2,
'Value layer I layer II layer III layer I layer II Layer III
'0 0 0 0
'0 0 0 1 32 32 32 32 32 8
'0 0 1 0 64 48 40 64 48 16
'0 0 1 1 96 56 48 96 56 24
'0 1 0 0 128 64 56 128 64 32
'0 1 0 1 160 80 64 160 80 64
'0 1 1 0 192 96 80 192 96 80
'0 1 1 1 224 112 96 224 112 56
'1 0 0 0 256 128 112 256 128 64
'1 0 0 1 288 160 128 288 160 128
'1 0 1 0 320 192 160 320 192 160
'1 0 1 1 352 224 192 352 224 112
'1 1 0 0 384 256 224 384 256 128
'1 1 0 1 416 320 256 416 320 256
'1 1 1 0 448 384 320 448 384 320
'1 1 1 1
If BitRate(11, 1) = "" Then
BitRate(11, 1) = "32"
BitRate(11, 2) = "64"
BitRate(11, 3) = "96"
BitRate(11, 4) = "128"
BitRate(11, 5) = "160"
BitRate(11, 6) = "192"
BitRate(11, 7) = "224"
BitRate(11, 8) = "256"
BitRate(11, 9) = "288"
BitRate(11, 10) = "320"
BitRate(11, 11) = "352"
BitRate(11, 12) = "384"
BitRate(11, 13) = "416"
BitRate(11, 14) = "448"
BitRate(12, 1) = "32"
BitRate(12, 2) = "48"
BitRate(12, 3) = "56"
BitRate(12, 4) = "64"
BitRate(12, 5) = "80"
BitRate(12, 6) = "96"
BitRate(12, 7) = "112"
BitRate(12, 8) = "128"
BitRate(12, 9) = "160"
BitRate(12, 10) = "192"
BitRate(12, 11) = "224"
BitRate(12, 12) = "256"
BitRate(12, 13) = "320"
BitRate(12, 14) = "384"
BitRate(13, 1) = "32"
BitRate(13, 2) = "40"
BitRate(13, 3) = "48"
BitRate(13, 4) = "56"
BitRate(13, 5) = "64"
BitRate(13, 6) = "80"
BitRate(13, 7) = "96"
BitRate(13, 8) = "112"
BitRate(13, 9) = "128"
BitRate(13, 10) = "160"
BitRate(13, 11) = "192"
BitRate(13, 12) = "224"
BitRate(13, 13) = "256"
BitRate(13, 14) = "320"
BitRate(21, 1) = "32"
BitRate(21, 2) = "64"
BitRate(21, 3) = "96"
BitRate(21, 4) = "128"
BitRate(21, 5) = "160"
BitRate(21, 6) = "192"
BitRate(21, 7) = "224"
BitRate(21, 8) = "256"
BitRate(21, 9) = "288"
BitRate(21, 10) = "320"
BitRate(21, 11) = "352"
BitRate(21, 12) = "384"
BitRate(21, 13) = "416"
BitRate(21, 14) = "448"
BitRate(22, 1) = "32"
BitRate(22, 2) = "48"
BitRate(22, 3) = "56"
BitRate(22, 4) = "64"
BitRate(22, 5) = "80"
BitRate(22, 6) = "96"
BitRate(22, 7) = "112"
BitRate(22, 8) = "128"
BitRate(22, 9) = "160"
BitRate(22, 10) = "192"
BitRate(22, 11) = "224"
BitRate(22, 12) = "256"
BitRate(22, 13) = "320"
BitRate(22, 14) = "384"
BitRate(23, 1) = "8"
BitRate(23, 2) = "16"
BitRate(23, 3) = "24"
BitRate(23, 4) = "32"
BitRate(23, 5) = "64"
BitRate(23, 6) = "80"
BitRate(23, 7) = "56"
BitRate(23, 8) = "64"
BitRate(23, 9) = "128"
BitRate(23, 10) = "160"
BitRate(23, 11) = "112"
BitRate(23, 12) = "128"
BitRate(23, 13) = "256"
BitRate(23, 14) = "320"
End If
fn = FreeFile
Open strFilename For Binary As #
lngFilesize = LOF(fn)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Check for a Header
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Get #fn, 1, ID3Tag
If ID3Tag = "ID3" Then
lngHeaderPosition = 1
Dim R As Long
Get #fn, 4, Version
Get #fn, 7, TagSize
R = CVL(TagSize, 128)
If R > lngFilesize Or R > 2147483647 Then
Exit Sub
End If
Tag2 = Space$(R)
Get #fn, 11, Tag2
lngHeaderPosition = R + 11
End If
Get #fn, 11 + Len(Tag2), sHeader
Close
With mHeader
.Lenght = FileLen(strFilename)
.Position = 10 + Len(Tag2)
'Second Byte
sHeader = Mid$(sHeader, 2)
i = (Asc(sHeader) And 8) / 8
.ID = IIf(i = 0, "MPEG-2", "MPEG-1")
BitLine = 10 * i
i = (Asc(sHeader) And 6) / 2
.Layer = IIf(i = 0, "Not defined", IIf(i = 1, "Layer 3", IIf(i = 2, _
"Layer 2", "Layer 1")))
BitLine = BitLine + (4 - i)
'Third Byte
sHeader = Mid$(sHeader, 2)
i = (Asc(sHeader) And 240) / 16
On Error Resume Next
.BitRate = "Not defined"
.BitRate = BitRate(BitLine, i) & "kbit"
On Error GoTo 0
i = (Asc(sHeader) And 12) / 4
If .ID = "MPEG-1" Then
.Frequency = IIf(i = 0, "44100 Hz", IIf(i = 1, "48000 Hz", _
"32000 Hz"))
Else
.Frequency = IIf(i = 0, "22050 Hz", IIf(i = 1, "24000 Hz", _
"16000 Hz"))
End If
i = (Asc(sHeader) And 2) / 2
.Padding = i
'Forth Byte
sHeader = Mid$(sHeader, 2)
i = (Asc(sHeader) And 192) / 64
.Mode = IIf(i = 0, "Stereo", IIf(i = 1, "Joint Stereo", IIf(i = 2, _
"Dual channel", "Mono")))
i = (Asc(sHeader) And 8) / 8
.CopyRighted = i
i = (Asc(sHeader) And 4) / 4
.Original = i
i = (Asc(sHeader) And 3)
.Emphasis = IIf(i = 0, "None", IIf(i = 1, "50/15ms", IIf(i = 2, _
"", "CCITT j.17")))
.FrameSize = (144 * Val(.BitRate) * 1000 / Val(.Frequency)) - .Padding
End With
End Sub
Public Function CVL(ByVal Cadena As String, Optional Valor As Integer = 256) _
As Long
Dim i As Integer
CVL = 0
For i = 3 To 0 Step -1
CVL = CVL + (Valor ^ i) * Asc(Cadena)
Cadena = Mid$(Cadena, 2)
Next i
End Function
Private Sub Form_Load()
Dim mHeader As MP3Header
ReadFile "D:\Downloaded Files\MP3\4 Non Blondes - What's Up.mp3", mHeader
With mHeader
lblMPEGInfo.Caption = "Size: " & .Lenght & " bytes"
lblMPEGInfo.Caption = lblMPEGInfo.Caption & vbCr & _
"Header found at: " & .Position
lblMPEGInfo.Caption = lblMPEGInfo.Caption & vbCr & .ID & _
" " & .Layer & vbCr & .BitRate & vbCr & .Frequency & " " _
& .Mode
lblMPEGInfo.Caption = lblMPEGInfo.Caption & vbCr _
& "Copyrihted: " & IIf(.CopyRighted, "Yes", "No")
lblMPEGInfo.Caption = lblMPEGInfo.Caption & vbCr _
& "Original: " & IIf(.Original, "Yes", "No")
lblMPEGInfo.Caption = lblMPEGInfo.Caption & vbCr _
& "Emphasis: " & .Emphasis
End With
End Sub
However, it's not working 10 points.... some MP3s are not showing the right ID or layer (according to WinAmp). Is there anything I'm missing. Besides... I can get the FrameSize, how do you get the number of frames?? What's "CRCs"? And, how do you get the lenght of the song?
Last edited by Mc Brain; May 11th, 2002 at 01:35 PM.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 11th, 2002, 01:45 PM
#15
-
May 11th, 2002, 08:25 PM
#16
-
May 11th, 2002, 08:52 PM
#17
Lively Member
Probably because it is a vbr mp3 file.
-
May 12th, 2002, 02:25 AM
#18
-
May 12th, 2002, 09:50 AM
#19
Addicted Member
He means its a variable bitrate MP3. Every MP3 is made up of frames, and the frames have the bitrate encoded into them. VBR MP3's have frames which have different bitrates. This had the advantage of being able to use lower bitrates for lower quality sound in the song. In most cases it can make the MP3 a fair bit smaller. The reason you cant read the info properly from a VBR MP3 is becuase you are only readin the first frame.
Who needs rhetorical questions anyway?
Bazza NET - The place you want to be!

-
May 12th, 2002, 09:53 AM
#20
-
May 12th, 2002, 02:42 PM
#21
-
May 12th, 2002, 05:18 PM
#22
Addicted Member
This may help:
1st frame is encoded at 128kbps
2nd frame 256kbps
3rd frame 128kbps
4th frame 96kbps
.
.
.
15890th frame 192kbps
15891st frame 128kbps
You read the first frame and take it that the MP3 = 128kbps. But most of the other frames are not. Therefore you calculate the mp3 length bu useing the kbps in the 1st frame, when in fact it should be the average of all the frames kbps. Understand now? Thats why Winamp gets it right becuase it reads ALL the frames then displays the length!
Who needs rhetorical questions anyway?
Bazza NET - The place you want to be!

-
May 12th, 2002, 05:24 PM
#23
-
May 12th, 2002, 06:23 PM
#24
-
May 12th, 2002, 06:40 PM
#25
Need-a-life Member
-
May 13th, 2002, 10:45 AM
#26
-
May 13th, 2002, 04:10 PM
#27
Lively Member
A mp3 has more then one header file. It has a header for each frame. If it is a variable bitrate mp3 then certain frames will be encoded at a different bitrate. Of course I could be wrong
Jason
-
May 13th, 2002, 04:45 PM
#28
Need-a-life Member
-
May 13th, 2002, 05:38 PM
#29
Lively Member
The thing is that if the mp3 is a vbr mp3 then each frame will be encoded at a different bitrate. How could just the first frame header have the correct bitrate for all of the frames if it is a vbr mp3?
Jason
-
May 13th, 2002, 05:45 PM
#30
-
May 14th, 2002, 06:43 AM
#31
Addicted Member
Ok, I have the solution. While I was kaing VBAMP I stumbled accross the same problem. Basically, your looking for the header by checking the sync. If ID2 is pesent then the sync frame is going to be some way down the file e.g. 2306 bytes into the file. Now, the ID2 information will probably have a few bytes that represent the same information as a sync header. It makes it look like you've found a sync header when you havent, your just milling around in the ID2 tag. What you have to do is extract all the ID2 information and record where the end of the ID2 tag is in the file, then start your sync header checking after the ID2 tag. Hope this helps!
From the looks of your pic, you apparently found the first header a little bit before Winamp did, this is why I think you are looking in the ID2 tag still.
Who needs rhetorical questions anyway?
Bazza NET - The place you want to be!

-
May 14th, 2002, 09:13 AM
#32
Need-a-life Member
Ok... If I force the program to check at 2339 (I wonder why it didn't work in 2338) I get the right values. However, how can I detect if I'm not reading the right value. Anyway, I don't know why I would be reading over the ID3v2's Tag. I'm getting the 4 bytes just after it.
VB Code:
Get #fn, 11 + Len(Tag2), sHeader
So, what could be between the ID3v2's tag and the header? What are those 32 bytes extra in the middle?
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 14th, 2002, 10:08 AM
#33
-
May 14th, 2002, 02:38 PM
#34
Need-a-life Member
This is the code I'm using:
VB Code:
Option Explicit
Public Type MP3Header
MP3Length As Long
Position As Long
Duration As Integer
ID As String
Layer As String
SampleRate As String
Mode As String
Emphasis As String
Padding As Boolean
FrameSize As Long
FrameCount As Long
CopyRighted As Boolean
Original As Boolean
BitRate As String
CRC As Boolean
End Type
Public Version As Byte
Private Sub ReadFile(strFilename As String, mHeader As MP3Header)
Static BitRate(11 To 23, 1 To 14) As String
Dim fn As Integer
Dim lngHeaderPosition As Long
Dim lngFilesize As Long
Dim BitLine As Integer
Dim i As Byte
Dim Tag2 As String
Dim TagSize As String * 4
Dim ID3Tag As String * 3
Dim sHeader As String * 4
If BitRate(11, 1) = "" Then
BitRate(11, 1) = "32"
BitRate(11, 2) = "64"
BitRate(11, 3) = "96"
BitRate(11, 4) = "128"
BitRate(11, 5) = "160"
BitRate(11, 6) = "192"
BitRate(11, 7) = "224"
BitRate(11, 8) = "256"
BitRate(11, 9) = "288"
BitRate(11, 10) = "320"
BitRate(11, 11) = "352"
BitRate(11, 12) = "384"
BitRate(11, 13) = "416"
BitRate(11, 14) = "448"
BitRate(12, 1) = "32"
BitRate(12, 2) = "48"
BitRate(12, 3) = "56"
BitRate(12, 4) = "64"
BitRate(12, 5) = "80"
BitRate(12, 6) = "96"
BitRate(12, 7) = "112"
BitRate(12, 8) = "128"
BitRate(12, 9) = "160"
BitRate(12, 10) = "192"
BitRate(12, 11) = "224"
BitRate(12, 12) = "256"
BitRate(12, 13) = "320"
BitRate(12, 14) = "384"
BitRate(13, 1) = "32"
BitRate(13, 2) = "40"
BitRate(13, 3) = "48"
BitRate(13, 4) = "56"
BitRate(13, 5) = "64"
BitRate(13, 6) = "80"
BitRate(13, 7) = "96"
BitRate(13, 8) = "112"
BitRate(13, 9) = "128"
BitRate(13, 10) = "160"
BitRate(13, 11) = "192"
BitRate(13, 12) = "224"
BitRate(13, 13) = "256"
BitRate(13, 14) = "320"
BitRate(21, 1) = "32"
BitRate(21, 2) = "64"
BitRate(21, 3) = "96"
BitRate(21, 4) = "128"
BitRate(21, 5) = "160"
BitRate(21, 6) = "192"
BitRate(21, 7) = "224"
BitRate(21, 8) = "256"
BitRate(21, 9) = "288"
BitRate(21, 10) = "320"
BitRate(21, 11) = "352"
BitRate(21, 12) = "384"
BitRate(21, 13) = "416"
BitRate(21, 14) = "448"
BitRate(22, 1) = "32"
BitRate(22, 2) = "48"
BitRate(22, 3) = "56"
BitRate(22, 4) = "64"
BitRate(22, 5) = "80"
BitRate(22, 6) = "96"
BitRate(22, 7) = "112"
BitRate(22, 8) = "128"
BitRate(22, 9) = "160"
BitRate(22, 10) = "192"
BitRate(22, 11) = "224"
BitRate(22, 12) = "256"
BitRate(22, 13) = "320"
BitRate(22, 14) = "384"
BitRate(23, 1) = "8"
BitRate(23, 2) = "16"
BitRate(23, 3) = "24"
BitRate(23, 4) = "32"
BitRate(23, 5) = "64"
BitRate(23, 6) = "80"
BitRate(23, 7) = "56"
BitRate(23, 8) = "64"
BitRate(23, 9) = "128"
BitRate(23, 10) = "160"
BitRate(23, 11) = "112"
BitRate(23, 12) = "128"
BitRate(23, 13) = "256"
BitRate(23, 14) = "320"
End If
fn = FreeFile
Open strFilename For Binary As #
lngFilesize = LOF(fn)
Get #fn, 1, ID3Tag
If ID3Tag = "ID3" Then
lngHeaderPosition = 1
Dim R As Long
Get #fn, 4, Version
Get #fn, 7, TagSize
R = CVL(TagSize, 128)
If R > lngFilesize Or R > 2147483647 Then
Exit Sub
End If
Tag2 = Space$(R)
Get #fn, 11, Tag2
lngHeaderPosition = R + 11
End If
Get #fn, 11 + Len(Tag2), sHeader
With mHeader
.MP3Length = FileLen(strFilename)
.Position = 11 + Len(Tag2)
'*** Second Byte ***
sHeader = Mid$(sHeader, 2)
'MPEG Audio version ID
'00 - MPEG Version 2.5
'01 - reserved
'10 - MPEG Version 2 (ISO/IEC 13818-3)
'11 - MPEG Version 1 (ISO/IEC 11172-3)
i = (Asc(sHeader) And 24) / 8
.ID = IIf(i = 0, "MPEG-2.5", IIf(i = 1, "reserved", _
IIf(i = 2, "MPEG-2", "MPEG-1")))
BitLine = IIf(i = 3, 10, 20)
'Layer description
'0 0 Not defined
'0 1 Layer III
'1 0 Layer II
'1 1 Layer I
i = (Asc(sHeader) And 6) / 2
.Layer = IIf(i = 0, "Not defined", IIf(i = 1, "Layer 3", _
IIf(i = 2, "Layer 2", "Layer 1")))
BitLine = BitLine + (4 - i)
'CRC
'0 = No
'1 = Yes
i = (Asc(sHeader) And 1)
.CRC = Not (-i)
' *** Third Byte ***
sHeader = Mid$(sHeader, 2)
i = (Asc(sHeader) And 240) / 16
On Error Resume Next
.BitRate = "Not defined"
.BitRate = BitRate(BitLine, i) & "kbit"
On Error GoTo errorhandler
'Frequency
'value MPEG-1 MPEG-2
'0 0 44100 Hz 22050 Hz
'0 1 48000 Hz 24000 Hz
'1 0 32000 Hz 16000 Hz
'1 1
i = (Asc(sHeader) And 12) / 4
If .ID = "MPEG-1" Then
.SampleRate = IIf(i = 0, "44100 Hz", _
IIf(i = 1, "48000 Hz", "32000 Hz"))
Else
.SampleRate = IIf(i = 0, "22050 Hz", _
IIf(i = 1, "24000 Hz", "16000 Hz"))
End If
'Padding Bit
'0 - frame is not padded
'1 - frame is padded with one extra slot
i = (Asc(sHeader) And 2) / 2
.Padding = i
' *** Forth Byte ***
sHeader = Mid$(sHeader, 2)
'Mode value mode
'0 0 Stereo
'0 1 Joint stereo
'1 0 Dual channel
'1 1 Mono
i = (Asc(sHeader) And 192) / 64
.Mode = IIf(i = 0, "Stereo", IIf(i = 1, "Joint Stereo", _
IIf(i = 2, "Dual channel", "Mono")))
'Copyright
'0 - Audio is not copyrighted
'1 - Audio is copyrighted
i = (Asc(sHeader) And 8) / 8
.CopyRighted = i
'Original
'0 - Copy of original media
'1 - Original media
i = (Asc(sHeader) And 4) / 4
.Original = i
'Emphasis value Emphasis method
'0 0 none
'0 1 50/15ms
'1 0
'1 1 CCITT j.17
i = (Asc(sHeader) And 3)
.Emphasis = IIf(i = 0, "None", IIf(i = 1, "50/15ms", _
IIf(i = 2, "reserved", "CCITT j.17")))
.FrameSize = IIf(.Layer = "Layer 1", _
12 * Val(.BitRate) * 1000 \ Val(.SampleRate) - .Padding, _
144 * Val(.BitRate) * 1000 \ Val(.SampleRate) - .Padding)
.FrameCount = (.MP3Length - .Position - 4) \ .FrameSize
.Duration = ((.MP3Length - .Position - 4) * 8 \ Val(.BitRate)) / 1000
End With
Close
End Sub
Public Function CVL(ByVal Cadena As String, Optional Valor As Integer = 256) _
As Long
Dim i As Integer
CVL = 0
For i = 3 To 0 Step -1
CVL = CVL + (Valor ^ i) * Asc(Cadena)
Cadena = Mid$(Cadena, 2)
Next i
End Function
Private Sub Form_Load()
Dim mHeader As MP3Header
ReadFile "D:\Downloaded Files\MP3\4 Non Blondes - What's Up.mp3", mHeader
With mHeader
lblMPEGInfo.Caption = "Size: " & .MP3Length & " bytes" & _
vbCr & "Header found at: " & .Position & " bytes" & _
vbCr & "Length: " & .Duration & " seconds" & _
vbCr & .ID & " " & .Layer & _
vbCr & .BitRate & ", " & .FrameCount & " frames" & _
vbCr & .SampleRate & " " & .Mode & _
vbCr & "CRCs: " & IIf(.CRC, "Yes", "No") & _
vbCr & "Copyrighted: " & IIf(.CopyRighted, "Yes", "No") & _
vbCr & "Original: " & IIf(.Original, "Yes", "No") & _
vbCr & "Emphasis: " & .Emphasis
End With
End Sub
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 14th, 2002, 04:02 PM
#35
Addicted Member
This is the code I use and it works very well...
VB Code:
For lCount = 1 To 5000
Get #1, lCount, bHead(0)
If bHead(0) = 255 Then
Get #1, lCount + 1, bHead(1)
If bHead(1) = 250 Or bHead(1) = 251 Then
FirstFrame = lCount
Exit For
End If
End If
Next lCount
I can alter that little loop to make it search from wherever I want, so mabey if you could use it to search for the say first 5 headers
Who needs rhetorical questions anyway?
Bazza NET - The place you want to be!

-
May 14th, 2002, 04:36 PM
#36
Need-a-life Member
-
May 14th, 2002, 07:01 PM
#37
-
May 14th, 2002, 07:02 PM
#38
-
May 14th, 2002, 10:38 PM
#39
-
May 15th, 2002, 05:55 PM
#40
Lively Member
Hello, Can you tell me how you're writing the ID3v2 Tag at the begining of the file without overwriting.
I need to write tag but i don't know how :
- not to overwrite existing data if it's not a id3v2 tag
- Erase the previous id3v2 Tag
Thank you for your answer.
BTW, the 250 or 251 behind the 255 byte in the header is only for mpeg1 layer3. If you want to have the info for other mpeg format, or other layer, it will not work (I see you're searching the layer and mpeg format in your code)
Last edited by matt3011; May 15th, 2002 at 05:59 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|