daily pastebin goal
94%
SHARE
TWEET

Convert WMA to MP3

anonit Jun 10th, 2013 (edited) 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. :: Batch converts WMA files to MP3
  4. ::
  5. ::
  6. :: Requires:
  7. :: Lame - http://lame.sourceforge.net/index.php
  8. :: MPlayer - http://www.mplayerhq.hu
  9. ::
  10. :: Usage:
  11. :: convertWMA.bat %%LOCATION_OF_WMA_FILES%%
  12. ::
  13. :: eg:
  14. :: convertWMA.bat c:\WMA
  15. :: convertWMA.bat %%USERPROFILE%%\desktop\wma
  16. ::
  17.  
  18.  
  19.  
  20. :: Set the MPLAYER file path below
  21. ::
  22.  
  23. set MPLAYERPROGRAM="c:\program files (x86)\mplayer\mplayer.exe"
  24.  
  25. ::
  26. :: set the LAME file path below
  27. ::
  28.  
  29. set LAMEPROGRAM="c:\program files (x86)\lame for audacity\lame.exe"
  30.  
  31. ::
  32. :: +-----------------------------+
  33. :: | DO NOT EDIT BELOW THIS LINE |
  34. :: +-----------------------------+
  35. ::
  36.  
  37.  
  38. if [%1]==[] goto :VARNOTDEFINIED
  39. if [%1] NEQ [] set SOURCEPATH=%1
  40.  
  41.  
  42. if not exist %MPLAYERPROGRAM% goto :MPLAYERNOTFOUND
  43. if not exist %LAMEPROGRAM% goto :LAMENOTFOUND
  44.  
  45. set CURRENTLOCATION=%CD%
  46. set TEMPFILE=%TEMP%\wma_convert_%random%.tmp
  47. cd /d %SOURCEPATH%
  48.  
  49.  
  50. dir/b %SOURCEPATH%\*.wma > %TEMPFILE%
  51. for /f "delims=*" %%G in (%TEMPFILE%) do call %MPLAYERPROGRAM% -vo null -vc dummy -af resample=44100 -ao pcm:file="%%G.wav" "%%G"
  52.  
  53. dir/b %SOURCEPATH%\*.wav > %TEMPFILE%
  54. for /f "delims=*" %%G in (%TEMPFILE%) do call %LAMEPROGRAM% "%%G"
  55.  
  56. goto :FINISHED
  57.  
  58.  
  59. :VARNOTDEFINIED
  60. echo.
  61. echo Batch convert wma to mp3
  62. echo.
  63. echo Requires:
  64. echo Lame - http://lame.sourceforge.net/index.php
  65. echo MPlayer - http://www.mplayerhq.hu
  66. echo.
  67. echo Usage:
  68. echo convertWMA.bat %%LOCATION_OF_WMA_FILES%%
  69. echo.
  70. echo eg:
  71. echo convertWMA.bat c:\wma
  72. echo convertWMA.bat %%USERPROFILE%%\desktop\wma
  73. echo.
  74.  
  75. goto :FINISHED
  76.  
  77. :MPLAYERNOTFOUND
  78. echo.
  79. echo ERROR MPLAYER NOT FOUND
  80. echo.
  81. echo MPLAYER was expected at %MPLAYERPROGRAM%
  82. echo MPLAYER can be downloaded at http://www.mplayerhq.hu
  83. echo Download and install MPLAYER.
  84. echo Edit the batch file and update the path.
  85. echo.
  86.  
  87. goto :FINISHED
  88.  
  89. :LAMENOTFOUND
  90. echo.
  91. echo ERROR LAME NOT FOUND
  92. echo.
  93. echo LAME was expected at %LAMEPROGRAM%
  94. echo LAME can be downloaded at http://lame.sourceforge.net/index.php
  95. echo Download and install LAME.
  96. echo Edit the batch file and update the path.
  97. echo.
  98.  
  99. goto :FINISHED
  100.  
  101. :FINISHED
  102. erase %TEMPFILE%
  103. cd /d %CURRENTLOCATION%
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top