Skip to content

Instantly share code, notes, and snippets.

@milnak
Last active November 16, 2022 17:14
Show Gist options
  • Save milnak/5f70a865a8645199663a3be746c4d237 to your computer and use it in GitHub Desktop.
Save milnak/5f70a865a8645199663a3be746c4d237 to your computer and use it in GitHub Desktop.
Normalize mp3 and flac files in currently directory using ffmpeg-normalize
@echo off
REM Normalize mp3 and flac files in currently directory using ffmpeg-normalize
REM https://github.com/slhck/ffmpeg-normalize/
setlocal
goto :main
:normalize_file
setlocal
REM ~x includes the dot. We don't want that.
set _var1=%~x1
set ext=%_var1:~1%
REM Why -c:a ext ?
REM See https://github.com/slhck/ffmpeg-normalize#could-not-write-header-for-output-file-error
REM The conversion does not work and I get a cryptic ffmpeg error!
ffmpeg-normalize.exe --output-folder NORMALIZED --normalization-type rms --target-level -13 --force -c:a %ext% --extension %ext% "%~1"
endlocal
goto :eof
:main
for %%f in (*.mp3 *.flac) do (
echo %%~f
call :normalize_file "%%~f"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment