[FFmpeg-user] Sound level

John Saturday stozher at gmail.com
Thu Feb 16 15:44:47 CET 2012

Hi jacky,

I have use this command for normalization of sound level at 89 dB.

1. First extract sound from FLV at WAV format:

ffmpeg -i file.flv -f wav -c:a pcm_s16le -ac:a 2 file.wav

(change "-c:a pcm_s16le" with "-acodec  pcm_s16le" and "-ac:a 2" with
"-ac 2" for old version of FFMPEG)

2. Commpress to FLAC and view needed replaygain:

flac --replay-gain file.wav
metaflac --show-tag=REPLAYGAIN_TRACK_GAIN file.flac

Otput from METAFLAC is a like this:


3. Open calculator in advanced mode and calculate FFMPEG volume:

volume=256*10^(<gain in dB>/20)=256*10^(20.91/20)=2842.76 ~ 2843

(I'm not sure how to write this in English: 2^2=2x2=4, 2^3=2x2x2=8.
Other example with negative gain: volume=256*10^(-2.57/20)=190.4 ~

4. Reencode only audio stream with FFMPEG:

ffmpeg -i file.flv -f mp4 -c:v copy -c:a libfaac -vol:a 2843 -b:a 128k

(old format: ffmpeg -i file.flv -f mp4 -vcodec copy -acodec libfaac
-vol 2843 -ab 128k output.mp4)

For movies I have use 128k (64k bitrate per channel) for stereo and
320k for 5.1 (LFE channel isn't calculated) and for music
256k for stereo and 640k for 5.1... also a good idea is to archive at
MKV container with AC-3 audio codec:

ffmpeg -i input.flv -f matroska -c:v copy -c:a ac3 -vol:a <volume>
-b:a <bitrate> output.mkv

For Matroska see this: http://matroska.org/technical/whatis/index.html

More information about the ffmpeg-user mailing list