Posted By

shadevampire on 08/25/11


file windows files directory music in convert ffmpeg

Versions (?)

Convert every music file into 192kbps mp3 in a given "targetdir" folder with ffmpeg on Windows

 / Published in: Windows PowerShell

  1. @ECHO OFF
  3. REM usage: put files to targetdir (default is named "put_files_here") folder and change the convert formats in the for loop to match what you want to do if you need a different format. Then you simply run this script and it will convert them all.
  5. REM Based on:
  6. REM Update: if the directory contains files with space in the names, you need to change the delimiter the for /f command is using. for example, you can use the pipe char.
  8. REM %~dp0 is the directory of this bat file
  10. SET targetdir=put_files_here
  12. FOR /f "delims=|" %%f IN ('dir /b "%~dp0/%targetdir%"') DO (
  13. echo Converting: %%f
  14. %~dp1ffmpeg.exe -i "%targetdir%/%%f" -vn -ar 48000 -ab 192000 -ac 2 "%targetdir%/%%f.mp3"
  15. )
  17. echo Finished
  19. PAUSE

Report this snippet  

You need to login to post a comment.