[FFmpeg-user] RE : Sound level

jacky renaux.jacky at orange.fr
Thu Feb 16 16:09:38 CET 2012

Great , thanks a lot Dennis and John 

I will jump on second solution as it has to be 
Automated : files are already on the red5 server 
(100 files about 1:30 each) and will be done using
PHP programs


-----Message d'origine-----
De : ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-bounces at ffmpeg.org]
De la part de John Saturday
Envoyé : jeudi 16 février 2012 15:45
À : ffmpeg-user at ffmpeg.org
Objet : Re: [FFmpeg-user] Sound level

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

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
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user

More information about the ffmpeg-user mailing list