On 24-04-2024 00:57, CMG DiGiTaL wrote:
Em sáb., 24 de fev. de 2024 às 17:25, Carl Zwanzig<c...@tuunq.com> escreveu:
Always start by posting the complete ffmpeg command and unedited output,
that way we don't have to guess about what the script is doing.
z!
_______________________________________________
My bat file will read several mp3 audios in a folder and normalize the
LUFS, saving the files in another folder. I wanted to save loglevel 16 of
these files in another folder on my desktop called Logs
My code:
md "C:\Users\%username%\Desktop\Normalizando_lufs"
pushd "%Userprofile%\Desktop\µudios LUFS"
FOR /F "delims=" %%a in ('where .:*.mp3 ^|findstr /vi "_LOUDNORM _EBU"')
DO (
SET "filename=%%~na"
ffmpeg -hide_banner -i "%%a" -af "[0:a]loudnorm=print_format=summary" -f
null NUL 2> "%%~na.log"
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input Integrated" "%%~na.log"')
DO (SET II=%%b)
@FOR /F "tokens=4" %%b IN ('FINDSTR /C:"Input True Peak" "%%~na.log"') DO
(SET ITP=%%b)
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input LRA" "%%~na.log"') DO (SET
ILRA=%%b)
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input Threshold" "%%~na.log"') DO
(SET IT=%%b)
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Target Offset" "%%~na.log"') DO
(SET TO=%%b)
DEL "%%~na.log"
SETLOCAL ENABLEDELAYEDEXPANSION
REM ECHO !II! Input Integrated
REM ECHO !ITP! Input True Peak
REM ECHO !ILRA! Input LRA
REM ECHO !IT! Input Threshold
REM ECHO !TO! Target Offset
FOR /F "tokens=1,2 delims=," %%b IN ('ffprobe -v 0 -select_streams a
-show_entries "stream=bit_rate,sample_rate" -of "csv=p=0"
"!filename!.mp3"') DO (
ffmpeg -hide_banner *-report file=test.log:level=16* -i "!filename!.mp3"
-af
"loudnorm=linear=true:I=!_vLUF!:LRA=11:tp=!_vPEAK!:measured_I=!II!:measured_LRA=!ILRA!:measured_tp=!ITP!:measured_thresh=!IT!:offset=!TO!:print_format=summary"
-c:v copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v
comment="Cover (front)" -acodec mp3 -b:a %%c -ar:a %%b
"C:\Users\%username%\Desktop\Normalizando_lufs\!filename!.mp3"
)
ENDLOCAL
)
Using the -report command, the bat is canceled and a log is generated in
the folder in the current directory, see the -report command message in the
log:
Successfully opened the file.
Parsing a group of options: output url file=test.log:level=16.
Successfully parsed a group of options.
Opening an output file: file=test.log:level=16.
[NULL @ 000001bcd0518640] Unable to find a suitable output format for
'file=test.log:level=16'
file=test.log:level=16: Invalid argument
thanks
_______________________________________________
*-report file=test.log:level=16* the character * on the commandline
causes ffmpeg to look at this as a outputfile specification to put
decoded results in, as nothing is specified about how to decode it it
tries to guess what codecs to use on the extension. Naturally this does
not work. Easiest way to get your desired result is to set the logfile
creation as an environment variable in the beginning of your script your
script and remove it from the ffmpeg commandline like this:
FFREPORT=file=test.log:level=16 md
"C:\Users\%username%\Desktop\Normalizando_lufs"
pushd "%Userprofile%\Desktop\µudios LUFS"
FOR /F "delims=" %%a in ('where .:*.mp3 ^|findstr /vi "_LOUDNORM _EBU"')
DO (
SET "filename=%%~na"
ffmpeg -hide_banner -i "%%a" -af "[0:a]loudnorm=print_format=summary" -f
null NUL 2> "%%~na.log"
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input Integrated" "%%~na.log"')
DO (SET II=%%b)
@FOR /F "tokens=4" %%b IN ('FINDSTR /C:"Input True Peak" "%%~na.log"') DO
(SET ITP=%%b)
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input LRA" "%%~na.log"') DO (SET
ILRA=%%b)
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input Threshold" "%%~na.log"') DO
(SET IT=%%b)
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Target Offset" "%%~na.log"') DO
(SET TO=%%b)
DEL "%%~na.log"
SETLOCAL ENABLEDELAYEDEXPANSION
REM ECHO !II! Input Integrated
REM ECHO !ITP! Input True Peak
REM ECHO !ILRA! Input LRA
REM ECHO !IT! Input Threshold
REM ECHO !TO! Target Offset
FOR /F "tokens=1,2 delims=," %%b IN ('ffprobe -v 0 -select_streams a
-show_entries "stream=bit_rate,sample_rate" -of "csv=p=0"
"!filename!.mp3"') DO (
ffmpeg -hide_banner -i "!filename!.mp3"
-af
"loudnorm=linear=true:I=!_vLUF!:LRA=11:tp=!_vPEAK!:measured_I=!II!:measured_LRA=!ILRA!:measured_tp=!ITP!:measured_thresh=!IT!:offset=!TO!:print_format=summary"
-c:v copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v
comment="Cover (front)" -acodec mp3 -b:a %%c -ar:a %%b
"C:\Users\%username%\Desktop\Normalizando_lufs\!filename!.mp3"
)
ENDLOCAL
)
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".