Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

function GetMP3Len


  • Please log in to reply
30 replies to this topic
AGermanUser
  • Members
  • 82 posts
  • Last active: Apr 07 2010 06:06 PM
  • Joined: 12 Feb 2005
A user in the german forum asked for a way to determine the length of an MP3 file. I pointed him to winmm.dll. Thalon was so kind to finish it up.

I thought it might be good to share the solution, just in case someone is interested. I took Thalons code and created a function from it. :mrgreen:
GetMP3Len(In_PathFile)
  {
    ; In_PathFile: Absolute path to your mp3 file - e.g. C:\Music\test.mp3

    ; Set variable capacities for dllcalls
    VarSetCapacity(ShortName, 255)
    VarSetCapacity(Length   , 255)

    ; Transforms FilePath into it's 8.3-Value
    RetValue := DllCall("kernel32.dll\GetShortPathNameA"
                       , "Str", In_PathFile
                       , "Str", ShortName
                       , "UInt", 255)
    ; Open MP3
    RetValue := DllCall("winmm.dll\mciSendStringA"
                       , "Str", "open " . ShortName . " type MPEGVideo alias mp3audio"
                       , "Str", 0
                       , "UInt", 0
                       , "UInt", 0)

    ; Read Length
    RetValue := DllCall("winmm.dll\mciSendStringA"
                       , "Str", "status mp3audio length"
                       , "Str", Length
                       , "UInt", 255
                       , "UInt", 0)

    ; Close MP3
    RetValue := DllCall("winmm.dll\mciSendStringA"
                       , "Str", "close mp3audio"
                       , "Str", 0
                       , "UInt", 0
                       , "UInt", 0)

    ; Trim milliseconds -> just seconds needed
    StringTrimRight, Length, Length, 3      

    ; Convert the specified number of seconds to hh:mm:ss format.
    time = 19990101  ; *Midnight* of an arbitrary date.
    time += %Length%, seconds
    FormatTime, mmss, %time%, mm:ss
    Return mmss ; This method is used to support more than 24 hours worth of sections.
  }

You can use it in your scripts e.g. in a File Loop:

Loop, C:\MyMP3s\*.mp3
  {
    MP3Len := GetMP3Len(A_LoopFileFullPath)
    MsgBox, Title:`t%A_LoopFileFullPath%`nLength:`t%MP3Len%
  }
...


SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
:O

Thanks for sharing this. Thanks to Thalon too.
I guess this will be slightly slower than the header parsing method, but a very elegant solution.

Regards, :)
kWo4Lk1.png

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005

A user in the german forum asked for a way to determine the length of an MP3 file. I pointed him to winmm.dll.

winmm.dll returns invalid values for VBR tracks. It always has AFAIK. Anyone know of an alternative program/DLL? Thanks.

Them be my thoughts...

AGU
  • Guests
  • Last active:
  • Joined: --
During a Google Search I found this:
http://www.willwap.c...rams/vbrfix.php

Maybe it's of help and you can read the information from the header after fixing it. Otherwise try googling for mp3 vbr length.
__________________________
Cheers
AGU

Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

Used this and it generally worked but it returned 0 (zero length) for a few MP3 files. Don't know why?



garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

here an example from SKAN

( for test select a folder with a few MP3-files )

;---------- selectfolder with MP3-files -------------------
PRESELECT=C:\M_MUSIC\               ;--- search MP3 from here
FileSelectFolder,MF,%PRESELECT%,,Select a folder with MP3
if MF=
  return
SplitPath,MF, name, dir, ext, name_no_ext, drive
F1=%name_no_ext%.txt
ifexist,%f1%
  filedelete,%f1%
Splashimage,,b w600 h80 x100 Y400 CWteal m9 b fs10 zh0,Read folder=`n%mf%`n write MP3-file_time to text-file=`n%f1%
Loop, %mf%\*.mp3, 0, 1
     {
     aa=
     aa:=GetAudioDuration7(a_loopfilefullpath)
     stringsplit,b,aa,`;
     SplitPath,a_loopfilefullpath, name, dir, ext, name_no_ext2, drive
     c .= name    "=" b1 "`r`n"
     }
Splashimage,off
Fileappend,%c%`r`n,%f1%
run,%f1%
return


;---------- function MP3 duration SKAN ----------------
GetAudioDuration7(mFile) {
 VarSetCapacity( Durn,16,32 )
 DllCall( "winmm.dll\mciSendStringA", Str,"open " """" mFile """" " Alias MP3"	, UInt,0, UInt,0, UInt,0 )
 DllCall( "winmm.dll\mciSendStringA", Str,"status MP3 length", Str,Durn, UInt,16, UInt,0 )
 DllCall( "winmm.dll\mciSendStringA", Str,"close MP3", UInt,0, UInt,0, UInt,0 )
 StringTrimRight,st,durn, 3
 tt:=st
 Time := 1601
 Time += %st%,S
 FormatTime, mmss, %time%, mm:ss
 Return Round( st//3600 ) ":" mmss  ";" tt
}
return
;=============================================

 

this creates a formatted text and a m3u-file at desktop

modified=20121124
;------- AHK_Basic XP ---
;------- tagx MP3x datecalculationx datex timex M3ux mp3durationx linepaddingx ----------

;-- it needs time to read mm:ss from MP3-files so don't select folder with to many MP3-files
;-- select folder with MP3-files , creates a formatted text-file ,show nr/filename/h:mm:ss
;-- create also M3u-file at desktop if needed -------

;=======================================================
#SingleInstance, Force
SetWorkingDir %A_ScriptDir%
transform,P,chr,32      ;-- space
transform,k,chr,45	;-- line > ---

maxchar:=80             ;-- maximal filename lenght

PRESELECT=C:\M_MUSIC\               ;--- search MP3 from here
FileSelectFolder,MF,%PRESELECT%,,Select a folder with MP3
if MF=
  return
SplitPath,MF, name, dir, ext, name_no_ext, drive
F1=%A_desktop%\%name_no_ext%.txt
ifexist,%f1%
  filedelete,%f1%
t1=5
t2:=0
t3=8
i=0

;-- check maximal length of filename
Splashimage,,b w600 h50 x100 Y400 CWsilver m9 b fs10 zh0,Searching for MP3-files in folder=`n%mf%
Loop, %mf%\*.mp3, 0, 1
     {
     i++
     stringlen,L2,a_loopfilename
        if (T2<L2)
            T2:=(L2)
     }
if (T2=0)
   {
   Splashimage,off
   msgbox, 262208,MP3-Info, No MP3-Files found
   exitapp
   }

if (i>100)
   {
   Splashimage,off
   msgbox, 262436,MP3-Info,To many songs ( %i% ) selected`nIt has %i% songs which needs time`nWant you continue ?
   IfMsgBox, No
      return
   }

;--- maximal lenght from filename-no-ext --
T2:=(T2-3)       ;-- minus extension
if (T2>maxchar)
   T2:=maxchar

b2:=0
b3:=0

Splashimage,off
sleep,500
Splashimage,,b w600 h80 x100 Y400 CWteal m9 b fs10 zh0,Read folder=`n%mf%`n write MP3-file_time to text-file=`n%f1%
Loop, %mf%\*.mp3, 0, 1
     {
     aa=
     a1=
     a2=
     a3=
     b2=
     aa:=GetAudioDuration7(a_loopfilefullpath)
     stringsplit,b,aa,`;
     SplitPath,a_loopfilefullpath, name, dir, ext, name_no_ext2, drive
     a1:= LP(a_index,t1,P,"R")
     a2:= LP(name_no_ext2,t2,P,"L")
          stringmid,a2,a2,1,maxchar
     a3:= LP(b1,t3,P,"R")
     c .= a1 "| " a2 "|" a3 "`r`n"
     b3:=(b2+b3)
     }
sleep,1000
Splashimage,off


;-- line lenght >  ------------
y=
z:=(t1+t2+t3+3)
Loop,%z%
  y .= k         ;< line ------


;--- total-time ---------------
 Time := 1601
 Time += %b3%,S
 FormatTime, b3x, %time%, mm:ss
 bx:=Round( b3//3600 ) ":" b3x
 t4:=(t2+t3+2)
 bx:=LP(bx,t4,P,"R")

fileappend,%name_no_ext%`r`n%y%`r`n%c%%y%`r`n%a1% %bx%,%f1%
run,%f1%
c=

;--- create also M3u at desktop (?) if needed -----------
F2=%A_desktop%\%name_no_ext%.m3u
ifexist,%f2%
   filedelete,%f2%
setworkingdir,%MF%
runwait,%comspec% /c dir /b /s *.mp3 >"%F2%",,hide
;run,%f2%
exitapp


;---------- function MP3 duration SKAN ----------------
GetAudioDuration7(mFile) {
 VarSetCapacity( Durn,16,32 )
 DllCall( "winmm.dll\mciSendStringA", Str,"open " """" mFile """" " Alias MP3"	, UInt,0, UInt,0, UInt,0 )
 DllCall( "winmm.dll\mciSendStringA", Str,"status MP3 length", Str,Durn, UInt,16, UInt,0 )
 DllCall( "winmm.dll\mciSendStringA", Str,"close MP3", UInt,0, UInt,0, UInt,0 )
 StringTrimRight,st,durn, 3
 tt:=st
 Time := 1601
 Time += %st%,S
 FormatTime, mmss, %time%, mm:ss
 Return Round( st//3600 ) ":" mmss  ";" tt
}

;---- function linepadding from user bobo -------
LP(String,FieldLen,ToAppend,Justification)
 {
   StringLen, StringLen, String
   LCnt := FieldLen-StringLen
   Loop, % LCnt
     Appended := (Appended . ToAppend)
   If Justification = R
      Return (Appended . String)
   If Justification = L
         Return (String . Appended)
 }
return
;=================== end script ==================



Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

Thanks, garry! Great script. Ran and got same 0:00:00 for same (several) files as before (most/majority of files return correct lengths, though). Don't know why?

 

Space Race 2.0.mp3=0:00:00

Skeptic Check - Climate Clamor.mp3=0:00:00

Seth's Garage.mp3=0:00:00

...



garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

found MediaInfo.dll which works

some MP3-files also not worked for me before

it was a difference between General Duration  (52mn 7s ) and Audio Duration ( 52mn 22s )

download mediainfo.dll ( 772kB )

http://www.paehl.com...iaInfo_DLL_only

 

see also other interesting freeware

http://www.paehl.com.../?Convert_Tools

;-- download MediaInfo.dll 772kB
;-- http://www.paehl.com/open_source/?Convert_Tools:MediaInfo_DLL_only

SetWorkingDir, %A_ScriptDir%
DllCall( "LoadLibrary", Str,"MediaInfo.dll" )

;FD:="C:\Test\A_Linz.mp3"
FD:="C:\Test\test.mp3"
AA:=MediaInfo_DumpInfo(FD)
MsgBox,%aa%
return

MediaInfo_DumpInfo( MediaFile="" ) {
 hnd := DllCall( "mediainfo\MediaInfoA_New" )
 DllCall( "mediainfo.dll\MediaInfoA_Open", UInt,hnd, Str,MediaFile )
 Info := DllCall( "mediainfo\MediaInfoA_Inform", UInt,hnd, UInt,0, Str )
 DllCall( "mediainfo\MediaInfoA_Delete", UInt,hnd )
Return Info
}



garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

example with mediainfo.dll

 

MODIFIED=20130218
;-- mp3-Duration

;-- needs MediaInfo.dll=
;-- http://www.paehl.com/open_source/?Convert_Tools:MediaInfo_DLL_only


;---------- selectfolder with MP3-files -------------------
;-- 1h 49mn 10s    ( seconds are missing when hour exist )
;----------------------------------------------------------
;- TEST  with 83 songs  XP netbook :
;- MediaInfo.dll =  6546 ms
;----------------------------------------------------------


DllCall( "LoadLibrary", Str,"MediaInfo.dll" )

PRESELECT=C:\M_MUSIC\               ;--- search MP3 from here
FileSelectFolder,MF,%PRESELECT%,,Select a folder with MP3
if MF=
  return
SplitPath,MF, name, dir, ext, name_no_ext, drive
F1=%name_no_ext%.txt
ifexist,%f1%
  filedelete,%f1%
Splashimage,,b w600 h80 x100 Y400 CWteal m9 b fs10 zh0,Read folder=`n%mf%`n write MP3-file_time to text-file=`n%f1%

begin:=a_tickcount
Loop, %mf%\*.mp3, 0, 1
     {
       ab=
       AB:=MediaInfo_DumpInfo(a_loopfilefullpath)
       Loop,parse,ab,`n,
         {
         if A_loopfield contains Duration
            {
            ;-- 1h 49mn 7s    ( seconds are missing when hour exist )
            stringsplit,d,a_loopfield,`:
            if d2 contains h
               d2=%d2% 0s
            n:= RegexReplace(d2, "\d+\K\D*", "," ) ;- keep only digits
            stringsplit,c,n,`,
            tot:=(c0)
            c1=%c1%
            c2=%c2%
            c3=%c3%
            c1 := SubStr("00" . c1, -1)
            c2 := SubStr("00" . c2, -1)
            c3 := SubStr("00" . c3, -1)
            if (tot=4)
               b1=%c1%:%c2%:%c3%
            if (tot=3)
               b1=00:%c1%:%c2%
            if (tot=2)
               b1=00:00:%c1%
            break
            }
          }
     SplitPath,a_loopfilefullpath, name, dir, ext, name_no_ext2, drive
     c .= name    "=" b1 "`r`n"
     }
Splashimage,off
delta:=a_tickcount - begin
msgbox,Delta=%delta% ms
Fileappend,%c%`r`n,%f1%
run,%f1%
return


MediaInfo_DumpInfo( MediaFile="" ) {
 hnd := DllCall( "mediainfo\MediaInfoA_New" )
 DllCall( "mediainfo.dll\MediaInfoA_Open", UInt,hnd, Str,MediaFile )
 Info := DllCall( "mediainfo\MediaInfoA_Inform", UInt,hnd, UInt,0, Str )
 DllCall( "mediainfo\MediaInfoA_Delete", UInt,hnd )
Return Info
}
;=========================================================================



Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

Thanks! I'll download MediaInfo.dll and test.



Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

can i download MediaInfo.dll from this site instead?:

http://mediainfo.sou...ownload/Windows (v0.7.62 (without installer)). does this work, too?

also, after having downloaded, the file does not have the .dll extension. should i add the .dll extension to the downloaded file (downloaded file has no extension at all)? and finally, should this downloaded file (after adding .dll extension) be moved into system32 folder (Windows XP)?

 

edit: i downloaded from paehl.com (DLL only), put the MediaInfo.dll from the zip file in the script directory, and ran the following script, but all the values in the generated text (list) are blank:

for example, Early Life.mp3=

MODIFIED=20130218
;-- mp3-Duration

;-- needs MediaInfo.dll=
;-- http://www.paehl.com/open_source/?Convert_Tools:MediaInfo_DLL_only


;---------- selectfolder with MP3-files -------------------
;-- 1h 49mn 10s    ( seconds are missing when hour exist )
;----------------------------------------------------------
;- TEST  with 83 songs  XP netbook :
;- MediaInfo.dll =  6546 ms
;----------------------------------------------------------


DllCall( "LoadLibrary", Str,"MediaInfo.dll" )

PRESELECT=C:\M_MUSIC\               ;--- search MP3 from here
FileSelectFolder,MF,%PRESELECT%,,Select a folder with MP3
if MF=
  return
SplitPath,MF, name, dir, ext, name_no_ext, drive
F1=%name_no_ext%.txt
ifexist,%f1%
  filedelete,%f1%
Splashimage,,b w600 h80 x100 Y400 CWteal m9 b fs10 zh0,Read folder=`n%mf%`n write MP3-file_time to text-file=`n%f1%

begin:=a_tickcount
Loop, %mf%\*.mp3, 0, 1
     {
       ab=
       AB:=MediaInfo_DumpInfo(a_loopfilefullpath)
       Loop,parse,ab,`n,
         {
         if A_loopfield contains Duration
            {
            ;-- 1h 49mn 7s    ( seconds are missing when hour exist )
            stringsplit,d,a_loopfield,`:
            if d2 contains h
               d2=%d2% 0s
            n:= RegexReplace(d2, "\d+\K\D*", "," ) ;- keep only digits
            stringsplit,c,n,`,
            tot:=(c0)
            c1=%c1%
            c2=%c2%
            c3=%c3%
            c1 := SubStr("00" . c1, -1)
            c2 := SubStr("00" . c2, -1)
            c3 := SubStr("00" . c3, -1)
            if (tot=4)
               b1=%c1%:%c2%:%c3%
            if (tot=3)
               b1=00:%c1%:%c2%
            if (tot=2)
               b1=00:00:%c1%
            break
            }
          }
     SplitPath,a_loopfilefullpath, name, dir, ext, name_no_ext2, drive
     c .= name    "=" b1 "`r`n"
     }
Splashimage,off
delta:=a_tickcount - begin
msgbox,Delta=%delta% ms
Fileappend,%c%`r`n,%f1%
run,%f1%
return


MediaInfo_DumpInfo( MediaFile="" ) {
 hnd := DllCall( "mediainfo\MediaInfoA_New" )
 DllCall( "mediainfo.dll\MediaInfoA_Open", UInt,hnd, Str,MediaFile )
 Info := DllCall( "mediainfo\MediaInfoA_Inform", UInt,hnd, UInt,0, Str )
 DllCall( "mediainfo\MediaInfoA_Delete", UInt,hnd )
Return Info
}


garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

I tried this ( 32-bit without installer ) , worked also

http://mediaarea.net...outInstaller.7z

 

mediainfo.dll is in a_scriptdir ( same folder as script  , size 3MB )

maybe you don't see the extension in windows , see folder options , show extension

;-- mp3-Duration

;-- needs MediaInfo.dll=
;-----------------------------------------------------------------------
;-- http://www.paehl.com/open_source/?Convert_Tools:MediaInfo_DLL_only
;-- or
;-- http://mediaarea.net/download/binary/libmediainfo0/0.7.62/MediaInfo_DLL_0.7.62_Windows_i386_WithoutInstaller.7z

;-- test  ..\asia\goa  =
/*
Aicat mozo tavo_Lorna.mp3=00:04:39
Calangute_lorna.mp3=00:04:19
Konkani SongBook 12 Lisboa_fcarod_Hu1A-WqGVxk_35.mp3=00:03:32
LISBOA_GOA_Melque.mp3=00:02:04
Molbavello Dhou - movie.mp3=00:22:13
*/



Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

I noticed these are 7 Zip files. i have only Classic Zip. so maybe that is why i cannot open them! anyway, i used the zipped file with .dll extension from http://www.paehl.com/open_source/?Convert_Tools:MediaInfo_DLL_only but still i get blanks for mp3= in the generated text list using the following code:

 

aaa.mp3=
bbb.mp3=
ccc.mp3=

...

MODIFIED=20130218
;-- mp3-Duration

;-- needs MediaInfo.dll=
;-- http://www.paehl.com/open_source/?Convert_Tools:MediaInfo_DLL_only

;---------- selectfolder with MP3-files -------------------
;-- 1h 49mn 10s    ( seconds are missing when hour exist )
;----------------------------------------------------------
;- TEST  with 83 songs  XP netbook :
;- MediaInfo.dll =  6546 ms
;----------------------------------------------------------

DllCall( "LoadLibrary", Str,"MediaInfo.dll" )

PRESELECT=M:\ ; Search MP3 from here
FileSelectFolder,MF,%PRESELECT%,,Select a folder with MP3
if MF=
  return
SplitPath,MF, name, dir, ext, name_no_ext, drive
F1=%name_no_ext%.txt
ifexist,%f1%
  filedelete,%f1%
Splashimage,,b w600 h80 x100 Y400 CWteal m9 b fs10 zh0,Read folder=`n%mf%`n write MP3-file_time to text-file=`n%f1%

begin:=a_tickcount
Loop, %mf%\*.mp3, 0, 1
     {
       ab=
       AB:=MediaInfo_DumpInfo(a_loopfilefullpath)
       Loop,parse,ab,`n,
         {
         if A_loopfield contains Duration
            {
            ;-- 1h 49mn 7s    ( seconds are missing when hour exist )
            stringsplit,d,a_loopfield,`:
            if d2 contains h
               d2=%d2% 0s
            n:= RegexReplace(d2, "\d+\K\D*", "," ) ;- keep only digits
            stringsplit,c,n,`,
            tot:=(c0)
            c1=%c1%
            c2=%c2%
            c3=%c3%
            c1 := SubStr("00" . c1, -1)
            c2 := SubStr("00" . c2, -1)
            c3 := SubStr("00" . c3, -1)
            if (tot=4)
               b1=%c1%:%c2%:%c3%
            if (tot=3)
               b1=00:%c1%:%c2%
            if (tot=2)
               b1=00:00:%c1%
            break
            }
          }
     SplitPath,a_loopfilefullpath, name, dir, ext, name_no_ext2, drive
     c .= name    "=" b1 "`r`n"
     }
Splashimage,off
delta:=a_tickcount - begin
msgbox,Delta=%delta% ms
Fileappend,%c%`r`n,%f1%
run,%f1%
return


MediaInfo_DumpInfo( MediaFile="" ) {
 hnd := DllCall( "mediainfo\MediaInfoA_New" )
 DllCall( "mediainfo.dll\MediaInfoA_Open", UInt,hnd, Str,MediaFile )
 Info := DllCall( "mediainfo\MediaInfoA_Inform", UInt,hnd, UInt,0, Str )
 DllCall( "mediainfo\MediaInfoA_Delete", UInt,hnd )
Return Info
}


garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

for me works  ahk_basic and ahk_L ( XP netbook )

remove variable preselect if you don't need serch from here

try with  msgbox to search missing variables , example

msgbox, 262208,MP3_TAG MediaInfo, %mf%

 

example MP3-info with mediainfo

;-- download MediaInfo.dll 772kB
;-- http://www.paehl.com/open_source/?Convert_Tools:MediaInfo_DLL_only

;-- get MP3 Info TAG ------------------

SetWorkingDir, %A_ScriptDir%
DllCall( "LoadLibrary", Str,"MediaInfo.dll" )

;-- example :
MF=C:\M_USB_Drives\iAudio_G3\Dolores Duran - ASSIM COMO O RIO - 10.03.53a.mp3

SplitPath,MF, name, dir, ext, name_no_ext, drive
F1=%name_no_ext%.txt
ifexist,%f1%
  filedelete,%f1%

AA:=MediaInfo_DumpInfo(MF)
msgbox, 262208,MP3_TAG MediaInfo,%aa%
fileappend,%aa%,%f1%
run,%f1%
return
;-----------------------------------------
MediaInfo_DumpInfo( MediaFile="" ) {
 hnd := DllCall( "mediainfo\MediaInfoA_New" )
 DllCall( "mediainfo.dll\MediaInfoA_Open", UInt,hnd, Str,MediaFile )
 Info := DllCall( "mediainfo\MediaInfoA_Inform", UInt,hnd, UInt,0, Str )
 DllCall( "mediainfo\MediaInfoA_Delete", UInt,hnd )
Return Info
}
;-----------------------------------------

/*
General
Complete name                            : C:\M_USB_Drives\iAudio_G3\Dolores Duran - ASSIM COMO O RIO - 10.03.53a.mp3
Format                                   : MPEG Audio
File size                                : 577 KiB
Duration                                 : 3mn 16s
Overall bit rate mode                    : Constant
Overall bit rate                         : 24.0 Kbps
Track name                               : ASSIM COMO O RIO - 10.03.53
Performer                                : Dolores Duran

Audio
Format                                   : MPEG Audio
Format version                           : Version 2
Format profile                           : Layer 3
Duration                                 : 3mn 17s
Bit rate mode                            : Constant
Bit rate                                 : 24.0 Kbps
Channel(s)                               : 1 channel
Sampling rate                            : 22.05 KHz
Compression mode                         : Lossy
Replay gain                              : -9.36 dB
Replay gain peak                         : 1.247525
Stream size                              : 577 KiB (100%)
MP3Gain, Min/Max                         : 056,212
MP3Gain, Undo                            : -002,-002,N
*/



Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

i tried the above script (the most recent one). strangely enough (i run AHK 1.1.9.2 on XP), i always get this for AA (or aa): Ȁ?

i get this with the previous scripts and the latest one posted above. always.

SetWorkingDir, %A_ScriptDir%
DllCall( "LoadLibrary", Str,"MediaInfo.dll" )

;-- example :
;MF=C:\M_USB_Drives\iAudio_G3\Dolores Duran - ASSIM COMO O RIO - 0.03.53a.mp3
MF=M:\example.mp3

SplitPath,MF, name, dir, ext, name_no_ext, drive
F1=%name_no_ext%.txt
ifexist,%f1%
  filedelete,%f1%

AA:=MediaInfo_DumpInfo(MF)
msgbox, 262208,MP3_TAG MediaInfo,%aa%
fileappend,%aa%,%f1%
Clipboard := aa
run,%f1%
return