Last active
August 12, 2024 02:34
-
-
Save Sarjuuk/d77b203f7b71d191509afddabad5fc9f to your computer and use it in GitHub Desktop.
[WIN] audio file conversion using ffmpeg - deletes after conversion
This file contains 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 | |
echo ****************************************************************************************** | |
echo This uses FFMPEG to convert and rename all of the files required for AoWoW sounds and | |
echo music. FFMPEG will loop indefinitely if we output a file of the same extension (MP3 to | |
echo MP3), so we just append an underscore there. | |
echo ****************************************************************************************** | |
echo USE: Place this convert.cmd and ffmpeg.exe in the <localeCode>\Sound folder and run. | |
echo ****************************************************************************************** | |
pause | |
REM ** converting music files | |
FOR /r %%f in (*.mp3) DO ( | |
ffmpeg.exe -hide_banner -y -i "%%f" -f mp3 -acodec libmp3lame "%~d0%%~pf%%~nf.mp3_" | |
if not errorlevel 1 if exist "%~d0%%~pf%%~nf.mp3_" del /q /f "%~d0%%~pf%%~nf.mp3" | |
) | |
REM ** converting sound files | |
FOR /r %%f in (*.wav) DO ( | |
ffmpeg.exe -hide_banner -y -i "%%f" -acodec libvorbis "%~d0%%~pf%%~nf.wav_" | |
if not errorlevel 1 if exist "%~d0%%~pf%%~nf.wav_" del /q /f "%~d0%%~pf%%~nf.wav" | |
) |
%~d0%%~pf%%~nf
what on earth is that variable....
whatever..
since i don't like reusing common file extensions (even if it shouldn't matter), lets just add an underscore.
and also, update the install script.
my version:
@echo off
echo ******************************************************************************************
echo This uses FFMPEG to convert and rename all of the files required for AoWoW sounds and
echo music. FFMPEG will loop indefinitely if we output a file of the same extension (MP3 to
echo MP3), so we just append an underscore there.
echo ******************************************************************************************
echo USE: Place this convert.cmd and ffmpeg.exe in the <localeCode>\Sound folder and run.
echo ******************************************************************************************
pause
REM ** converting music files
FOR /r %%f in (*.mp3) DO (
ffmpeg.exe -hide_banner -y -i "%%f" -f mp3 -acodec libmp3lame "%~d0%%~pf%%~nf.mp3_"
if not errorlevel 1 if exist "%~d0%%~pf%%~nf.mp3_" del /q /f "%~d0%%~pf%%~nf.mp3"
)
REM ** converting sound files
FOR /r %%f in (*.wav) DO (
ffmpeg.exe -hide_banner -y -i "%%f" -acodec libvorbis "%~d0%%~pf%%~nf.ogg"
rename "%~d0%%~pf%%~nf.ogg" *.wav_
if not errorlevel 1 if exist "%~d0%%~pf%%~nf.wav_" del /q /f "%~d0%%~pf%%~nf.wav"
)
if use version 4.x ffmpeg ,suggest fix:
@echo off
echo ******************************************************************************************
echo This uses FFMPEG to convert and rename all of the files required for AoWoW sounds and
echo music. FFMPEG will loop indefinitely if we output a file of the same extension (MP3 to
echo MP3), so we just append an underscore there.
echo ******************************************************************************************
echo USE: Place this convert.cmd and ffmpeg.exe in the <localeCode>\Sound folder and run.
echo ******************************************************************************************
pause
REM ** converting music files
FOR /r %%f in (*.mp3) DO (
ffmpeg.exe -hide_banner -y -i "%%f" -f mp3 -acodec libmp3lame "%~d0%%~pf%%~nf.mp3_"
if not errorlevel 1 if exist "%~d0%%~pf%%~nf.mp3_" del /q /f "%~d0%%~pf%%~nf.mp3"
)
REM ** converting sound files
FOR /r %%f in (*.wav) DO (
ffmpeg.exe -hide_banner -y -i "%%f" -f ogg -acodec libvorbis "%~d0%%~pf%%~nf.wav_"
if not errorlevel 1 if exist "%~d0%%~pf%%~nf.wav_" del /q /f "%~d0%%~pf%%~nf.wav"
)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The install script looks for filepattern like : *.wav.ogg and *.mp3.mp3
So the converter script by @electricmessiah must be like that: