Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > General > Audio encoding

Thread Tools Search this Thread Display Modes
Old 23rd April 2019, 21:29   #1  |  Link
Anime addict
Overdrive80's Avatar
Join Date: Feb 2009
Location: Spain
Posts: 646
[Batch] Normalize using LoudNorm of FFmpeg

I had create script for windows user, that let drag'n'drop, for normalization in one pass using FFmpeg.

TITLE Normalize audio using LoudNorm

	::Set ffmpeg path
	SET "ffmpeg=%~dp0ffmpeg-4.1.1-win32-static\bin\ffmpeg.exe"
	ECHO FFmpeg is set in path: '%ffmpeg:~0,-11%' & ECHO.

	SET "iPath=%~dp1"
	SET "input=%~nx1"

	::Set file path to normalize
	IF [%input%] == [] (
		SET "iPath=C:\Users\Isra-PC\Desktop\Nueva carpeta\"
		SET "input=Opening_BA.wav"

	ECHO The file source to normalize is: '%input%' & ECHO.


	ECHO The process has begin...&ECHO.

	"%ffmpeg%" -hide_banner -nostdin -y -channel_layout stereo -i "%iPath%%input%" -af loudnorm=-16:TP=-1.5:LRA=11:print_format=json -c:a pcm_f32le -f null -y nul 2> volStats.txt	 

	call :find "input_i"
	set "measured_I=%ganancy%"
	::echo %measured_I%

	call :find "input_tp"
	set "measured_TP=%ganancy%"
	::echo %measured_TP%

	call :find "input_lra"
	set "measured_LRA=%ganancy%"
	::echo %measured_LRA%
	call :find "input_thresh"
	set "measured_thresh=%ganancy%"
	::echo %measured_thresh%
	call :find "target_offset"
	set "offset=%ganancy%"
	::echo %offset%
	goto normalization

	"%ffmpeg%" -hide_banner -nostdin -y -channel_layout stereo -i "%iPath%%input%" -af loudnorm=-16:TP=-1.5:LRA=11:measured_I=%measured_I%:measured_LRA=%measured_LRA%:measured_TP=%measured_TP%:measured_thresh=%measured_thresh%:offset=%offset%:linear=true:print_format=summary -c:a pcm_f32le -ar 48k %input:~0,-4%_normalized.wav
	ECHO The process has ended. Press any key for exit. & pause>nul & exit
	set "paramSearch=%1"

	for /F "tokens=3,* delims= " %%a in ('findstr "%paramSearch%" "%~dp0volStats.txt"') do (
		 set ganancy=%%a

	set ganancy=%ganancy:,=%
	set ganancy=%ganancy:~1,-1%

	goto :eof
I hope that be useful. Enjoy!!
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Nvidia GTX750 2GB DDR5 + SSD Vertex 4 256 GB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 07:04.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.