I have something where you just have to mark the video files and drag them to the batch. But Windows says after 200 files it won't work anymore. But I have 50,000 files.
Code: Select all
@echo off
cls & color 0B
Mode con cols=60 lines=13
cd /d "%~dp0"
set "xMkvMerge=C:\Program Files\MKVToolNix\mkvmerge.exe"
set "xFFmpeg=C:\ffmpeg\bin\ffmpeg.exe"
if "%~1"=="" goto :loop_end
:loop
"%xFFmpeg%" -i "%~1" -filter_complex "[0:a]loudnorm=I=-16:TP=-1.5:LRA=11:print_format=summary" -f null x 2> "%~1.txt"
for /f "tokens=3" %%a IN ('findstr /C:"Input Integrated" "%~1.txt" ') DO (set "xII=%%a")
echo %xII% is the Input Integrated
for /f "tokens=4" %%a IN ('findstr /C:"Input True Peak" "%~1.txt" ') DO (set "xITP=%%a")
echo %xITP% is the Input True Peak
for /f "tokens=3" %%a IN ('findstr /C:"Input LRA" "%~1.txt" ') DO (set "xILRA=%%a")
echo %xILRA% is the Input LRA
for /f "tokens=3" %%a IN ('findstr /C:"Input Threshold" "%~1.txt" ') DO (set "xIT=%%a")
echo %xIT% is the Input Threshold
for /f "tokens=3" %%a IN ('findstr /C:"Output Integrated" "%~1.txt" ') DO (set "xOI=%%a")
echo %xOI% is the Output Integrated
::not used
for /f "tokens=4" %%a IN ('findstr /C:"Output True Peak" "%~1.txt" ') DO (set "xOTP=%%a")
echo %xOTP% is the Output True Peak
::not used
for /f "tokens=3" %%a IN ('findstr /C:"Output LRA" "%~1.txt" ') DO (set "xOLRA=%%a")
echo %xOLRA% is the Output LRA
::not used
for /f "tokens=3" %%a IN ('findstr /C:"Output Threshold" "%~1.txt" ') DO (set "xOT=%%a")
echo %xOT% is the Output Threshold
::not used
for /f "tokens=3" %%a IN ('findstr /C:"Target Offset" "%~1.txt" ') DO (set "xTO=%%a")
echo %xTO% is the Target Offset
md "../%~dp1../original" "%~dp1../old"
"%xFFmpeg%" -i "%~1" -af loudnorm=linear=true:I=-16:tp=-1.5:lra=11:measured_I=%xII%:measured_LRA=%xILRA%:measured_tp=%xITP%:measured_thresh=%xIT%:offset=%xTO%:print_format=summary -b:a 128k "%~dpn1.ac3"
if exist "%~dpn1.ac3" ( "%xMkvMerge%" -o "%~dp1../original\%~n1.mkv" -a !1 "%~1" "%~dpn1.ac3" ) else ( "%xMkvMerge%" -o "%~dp1../original\%~n1.mkv" -a !1 "%~1" )
del "%~1.txt"
del "%~dpn1.ac3"
shift
if not "%~1"=="" goto :loop
:loop_end
but need what does it all at once but that doesn't work
Code: Select all
for %~1 in (*.mp4) do (
)
Code: Select all
@echo off
cls & color 0B
Mode con cols=60 lines=13
cd /d "%~dp0"
set "xMkvMerge=C:\Program Files\MKVToolNix\mkvmerge.exe"
set "xFFmpeg=C:\ffmpeg\bin\ffmpeg.exe"
for %~1 in (*.mp4) do (
"%xFFmpeg%" -i "%~1" -filter_complex "[0:a]loudnorm=I=-16:TP=-1.5:LRA=11:print_format=summary" -f null x 2> "%~1.txt"
for /f "tokens=3" %%a IN ('findstr /C:"Input Integrated" "%~1.txt" ') DO (set "xII=%%a")
echo %xII% is the Input Integrated
for /f "tokens=4" %%a IN ('findstr /C:"Input True Peak" "%~1.txt" ') DO (set "xITP=%%a")
echo %xITP% is the Input True Peak
for /f "tokens=3" %%a IN ('findstr /C:"Input LRA" "%~1.txt" ') DO (set "xILRA=%%a")
echo %xILRA% is the Input LRA
for /f "tokens=3" %%a IN ('findstr /C:"Input Threshold" "%~1.txt" ') DO (set "xIT=%%a")
echo %xIT% is the Input Threshold
for /f "tokens=3" %%a IN ('findstr /C:"Output Integrated" "%~1.txt" ') DO (set "xOI=%%a")
echo %xOI% is the Output Integrated
::not used
for /f "tokens=4" %%a IN ('findstr /C:"Output True Peak" "%~1.txt" ') DO (set "xOTP=%%a")
echo %xOTP% is the Output True Peak
::not used
for /f "tokens=3" %%a IN ('findstr /C:"Output LRA" "%~1.txt" ') DO (set "xOLRA=%%a")
echo %xOLRA% is the Output LRA
::not used
for /f "tokens=3" %%a IN ('findstr /C:"Output Threshold" "%~1.txt" ') DO (set "xOT=%%a")
echo %xOT% is the Output Threshold
::not used
for /f "tokens=3" %%a IN ('findstr /C:"Target Offset" "%~1.txt" ') DO (set "xTO=%%a")
echo %xTO% is the Target Offset
md "../%~dp1../original" "%~dp1../old"
"%xFFmpeg%" -i "%~1" -af loudnorm=linear=true:I=-16:tp=-1.5:lra=11:measured_I=%xII%:measured_LRA=%xILRA%:measured_tp=%xITP%:measured_thresh=%xIT%:offset=%xTO%:print_format=summary -b:a 128k "%~dpn1.ac3"
if exist "%~dpn1.ac3" ( "%xMkvMerge%" -o "%~dp1../original\%~n1.mkv" -a !1 "%~1" "%~dpn1.ac3" ) else ( "%xMkvMerge%" -o "%~dp1../original\%~n1.mkv" -a !1 "%~1" )
del "%~1.txt"
del "%~dpn1.ac3"
)