[FFmpeg-user] LUFS Normalization of WAV files

CMG DiGiTaL cmarciog at gmail.com
Wed Mar 30 01:43:26 EEST 2022

loudnorm changes the sample rate of the output file to 192000 Hz. I use the
tokens to select the value of the sample rate of the input file to generate
the output file correctly, however, the command is giving an error.


FOR /F "tokens=1,2 delims=," %%b IN ('ffprobe -v 0 -select_streams a
-show_entries "stream=sample_fmt,sample_rate" -of "csv=p=0"
"!filename!.wav"') DO (
ffmpeg -hide_banner -i "!filename!.wav" -af
-c:a -sample_rate:a %%c

error message:

Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'Genesis - I Can't Dance.wav':
  Duration: 00:04:05.67, bitrate: 1411 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo,
s16, 1411 kb/s
[NULL @ 00000233ad2957c0] Unable to find a suitable output format for
44100: Invalid argument

Note: I tried two other ways:
 1 Run the command without any output parameters, there is no error, but
the file is 179 MB in size, the original is only 41.3 MB. This is precisely
because the sample rate is 192000 Hz.

 2 Run with the parameter -af aformat=s%%b:%%c  only a warning message
appears, but the file is not normalized. see message below:

   Multiple -filter, -af or -vf options specified for stream 0, only the
last option '-filter:a aformat=s16:44100' will be used.

What is the correct parameter to be able to get the sample rate value
coming from the tokens and generate the output file correctly?

More information about the ffmpeg-user mailing list