Created
December 3, 2024 09:09
-
-
Save lightsongjs/8e50cf6d1ce55ceef9a24c83d30fe888 to your computer and use it in GitHub Desktop.
converts all .wav files in the current directory to .mp3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Enable delayed expansion for dynamic variable handling | |
setlocal enabledelayedexpansion | |
:: Loop through all .wav files in the current directory | |
for %%f in (*.wav) do ( | |
:: Extract the base name without extension | |
set "basename=%%~nf" | |
echo Converting "%%f" to "!basename!.mp3" | |
:: Use `ffmpeg` to convert the file, with overwrite enabled | |
ffmpeg -y -i "%%f" -codec:a libmp3lame -q:a 2 "!basename!.mp3" | |
:: Verify file conversion and output the converted file name | |
if exist "!basename!.mp3" ( | |
echo Converted file: "!basename!.mp3" | |
) else ( | |
echo Failed to convert "%%f" | |
) | |
) | |
echo All conversions are complete | |
.you | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment