[FFmpeg-user] Fwd: Get sample rate in mp3 files

Reino Wijnsma rwijnsma at xs4all.nl
Wed Feb 23 01:43:10 EET 2022


Hello Clamarc,

Please do not top-post. On this mailinglist it's against the rules, to which you agreed upon subscribing.

On 2022-02-22T07:32:05+0100, CMG DiGiTaL <cmarciog at gmail.com> wrote:
>> FOR *%G* IN (*.mp3) DO (
>    it was because I took part of the sample rate command that you sent me
> to be able to use it in my batch file that I already had here, you know?...

I'm not sure you understand. I meant the strong / bold font layout, the two asterisks surrounding %G.

> the problem that is driving me crazy, is that as some audio files have the
> exclamation mark in the name, using the ENABLEDELAYEDEXPANSION, the batch
> cancels because it
> doesn't recognize the files with the exclamation mark

Try this:

@ECHO off
SET vluf=-10.0
SET vpeak=-0.0
FOR %%A IN (*.mp3) DO (
  SET "filename=%%~nA"
  ffmpeg -hide_banner -i "%%A" -af "loudnorm=I=-15:TP=-1.5:LRA=11: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
  ECHO !II! is the Input Integrated
  ECHO !ITP! is the Input True Peak
  ECHO !ILRA! is the Input LRA
  ECHO !IT! is the Input Threshold
  ECHO !TO! is the Target Offset
  FOR /F "delims=" %%B IN ('ffprobe -v 0 -show_entries stream^=bit_rate -of default^=nk^=1:nw^=1 "!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:a libmp3lame -b:a %%B "..\Áudios LUFS ORI\!filename!_LUFS_CONVERTED.mp3"
  ENDLOCAL
)

-- 
Reino



More information about the ffmpeg-user mailing list