[FFmpeg-user] How to create error log file ffmpeg Loudnorm?

CMG DiGiTaL cmarciog at gmail.com
Wed Apr 24 01:57:58 EEST 2024


Em sáb., 24 de fev. de 2024 às 17:25, Carl Zwanzig <cpz at 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


More information about the ffmpeg-user mailing list