[FFmpeg-user] Encoding Warnings

Jim Ruler2112 at charter.net
Tue Jun 30 16:41:35 EEST 2020

On 06/29/20 11:18, Moritz Barsnick wrote:
> On Mon, Jun 29, 2020 at 10:44:04 -0400, Jim wrote:
>> AFAIK, ffmpeg does not have the ability to analyze the volume of every
>> sample throughout an audio file, find the greatest amplitude, calculate
>> the adjustment needed to make the loudest part of the file the maximum,
> It does.
>> and then apply that scaled volume adjustment to the entire file.
> This makes this a two-pass operation, which your external tool probably
> also does. ffmpeg can analyze first:
> $ ffmpeg -i INPUT -map 0:a -af volumedetect -f null -
> and will find the absolute maximum of the first audio channel. Take the
> max value from the log (something like "max_volume: -18.1 dB"[*]), and
> use that value for an additionally inserted "volume" audio filter in
> your conversion.
> $ ffmpeg -i INPUT [...] -af volume="18.1 dB",otherfilters OUTPUT
> You thus only have an additional input analysis step.
> [*] Documentation says this will not cause any clipping, though I don't
> know what the behaviour is, if the volume is massively different across
> channels. I *believe* the maximum is safe to use (while the average is
> also an average across channels, by some kind of mixdown).
>> same question in my searching for a solution to this same message - this
>> is the first time I've read this.
> (I personally find this confusing as well.)
>> (Assuming I don't run into anything weird when processing different
>> video formats in the future of course. ;) )  I'm happy, happy, happy
>> about that! :) :) :)
> We like happy people. :-)
> Cheers,
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

> On 29 Jun 2020, at 15:44, Jim<Ruler2112 at charter.net>  wrote:
>   (While this doesn't equalize the volume or eliminate all volume-related inconsistencies, it does make the loudest part of each video the same and is the best solution I've found;

I think you would like the loudnorm filter that incorporates ebur-128 adjustments.
It can run as two pass or one pass (useful for live streaming) and adjusts the audio levels to maintain the specified levels.
An example would be -af loudnorm=I=-23:TP=-1.0:LRA=11
This sets the average loudness at -23LUFS (this is pretty standard for UK TV) the True Peak value as -1.0dBfs and the loudness range shows the distribution of loudness throughout the programme.

LUFS is great because it is based on perceptual loudness and not just sample values.

Have fun

I would like to say that the progress this project has made since I 
initially wrote this script is absolutely amazing!  When I first wrote 
my processing script, I wanted to simply down-sample the audio from n 
channels to stereo and transcode to MP3 - no volume manipulation at 
all.  (The DVR I had at the time would totally freak if I threw audio at 
it with more than 2 channels.)  There were many people complaining about 
it at the time, but no real solutions.  I had to use a 2-step process - 
dump to stereo wave and then encode to MP3 - because ffmpeg refused to 
reduce the number of channels in an audio stream.  (Having to do this 
2-step process combined with my continual frustration with the volume of 
various files is what led me to work out the maximization of the volume 
throughout each file.)  Now, ffmpeg has the ability to do everything 
itself!  I know it's been several years, but still... excellent work 
guys - very impressive. :)


More information about the ffmpeg-user mailing list