[Batch] LoudNorm one pass

Announcements made by users.
Post Reply
Posts: 1
Joined: Sat Apr 20, 2019 11:11 pm

[Batch] LoudNorm one pass

Post by overdrive80 » Mon Apr 22, 2019 9:51 am

Hi all folks, I created script for windows users and execute loudnorm in one pass, read stats of file generates for ffmpeg. I hope that enjoy it.

Code: Select all

@echo off

	set "ffmpeg=C:\Users\Isra-PC\Desktop\ffmpeg-20190420-3a07aec-win32-static\bin\ffmpeg.exe"
	set "input=C:\Users\Isra-PC\Desktop\Nueva carpeta (3)\16.wav"

	"%ffmpeg%" -hide_banner -nostdin -y -channel_layout stereo -i "%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 "%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 salida.wav
	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 

Post Reply