WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sound and Media

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

MP3 Bitrate Version and Layer Codes.wbt

Keywords: 	 MP3 Bitrate Version and Layer Codes

file=AskFileName("Select MP3", "C:\", "MP3 files|*.mp3", "*.mp3", 1)
buf=binaryalloc(1024)
BinaryReadEx(buf,0,file,0,1024)

pos=BinaryIndexEx(buf,0,num2char(255),@fwdscan,@true)

;Message("pos",pos)
layer     =  (BinaryPeek( buf, pos+1)   >> 3) & 3
ver       =  (BinaryPeek( buf, pos+1)   >> 1) & 3
bitratecode =  (BinaryPeek( buf, pos+2 )  >> 4) & 15 ; 15 is gratuitious here
;Message("BitRate Code",bitratecode)

;Assuming  Ver 1 Layer 3 here
V1L1="free 32 64 96 128 160 192 224 256 288 320 352 384 416 448 bad"
V1L2="free 32 48 56 64 80 96 112 128 160 192 224 256 320 384 bad"
V1L3="free 32 40 48 56 64 80 96 112 128 160 192 224 256 320 bad"
V2L1="free 32 64 96 128 160 192 224 256 288 320 352 384 416 448 bad"
V2L2="free 32 48 56 64 80 96 112 128 160 192 224 256 320 384 bad"
V2L3="free 8 16 24 32 64 80 56 64 128 160 112 128 256 320 bad"

bitrate="??not found??"
if ver ==1 ; MPEG Ver 1
   if layer==1 then bitrate=ItemExtract(bitratecode+1, V1L1, " ")
   if layer==2 then bitrate=ItemExtract(bitratecode+1, V1L2, " ")
   if layer==3 then bitrate=ItemExtract(bitratecode+1, V1L3, " ")
else       ; MPEG Ver 2 or 2.5
   if layer==1 then bitrate=ItemExtract(bitratecode+1, V2L1, " ")
   if layer==2 then bitrate=ItemExtract(bitratecode+1, V2L2, " ")
   if layer==3 then bitrate=ItemExtract(bitratecode+1, V2L3, " ")
endif
Message("Ver=%ver% Layer=%layer%",bitrate)


See Also:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP+Get~Audio~File~Information.txt


Article ID:   W14969
File Created: 2014:07:18:09:51:40
Last Updated: 2014:07:18:09:51:40