[Ffmpeg-devel] ac3enc.c modifications
Simone Karin Lehmann
Tue May 17 23:45:42 CEST 2005
On Tuesday, 17. May 2005 16:05, Justin Ruggles wrote:
> Briefly, some of the things I like.
> -adjusting the bandwidth to the bitrate (much needed!)
> -zeroing out the data above used bandwidth
> -the 8kHz filter for the transient detect
> -dialog normalization
aah, dialog normalisation .... the never ending story...
For dialnorm support I had to patch liba52. All of my patches should still
result in a binary compatible lib so that it can be used as a drop-in
Also I've patched a52dec to support dialnorm, rf mode drc, specifying output
volume in dbSPL (sound pressure level). The player is called act.
Another thing was the encoder frontend. Therefore I did some small changes to
the ffmeg binary (cvs 20041227). I just added some new command line option
and named it face.
Finally I hacked on wavgain to get the dialog normalisation value out of a 2
channel wav file.
I've uploaded all sources to my site. You can find it on
The files are:
Makefile, face.c: needed for the encoder frontend. Place it in the top source
dir of ffmeg and recompile it.
a new option was added:
-ac3_norm set AC3 dialnorm (in dbFS)
the bitrate defaults to 192 kbps now.
this is the patched liba52 to support dialnorm. There's a file
liba52/ChangeLog where you can find some more information about dialnorm.
ac3 player supporting dialnorm, rf mode, output levels in db
default settings have been changed, so simply call
to play ac3file using dialnorm, disable drc, use automatic downmix
adjustment, no db level output control
wavgain outputs 3 values for each wav file
1. replay gain (reference level of 89 dbFS)
2. peak ratio
3. dialog normalisation to be used with face
Some notes on dialnorm
The RMS level can be used to calculate the dialog normalisation.
Dialnorm has a reference value of -31 dbFS (full scale).
Replay gain (http://replaygain.hydrogenaudio.org/) uses RMS to calculate
it's 'replaygain'. The reference value is 83 dbSPL (sound pressure level)
where 83 dbSPL is -20 dbFS.
wavgain (as mp3gain and lame) uses a reference value of 89 dbSPL, meaning -14
dbFS. If wavgain gives yuu, say, -3 db as replay gain for your wav file, your
wav file has a RMS value of -11 db, and therefor a dialnorm setting of 11. So
dialnorm = (int) abs(-14 - wavgain)
This is work in progress, so there's still enough to be done. Currently it
just fits my needs.
BTW, take a look at
Just select ---Encoding/Decoding--- Dolby Digital (AC3) and you get some
really good documentation about ac3, especially the Dolby Digital
Professional Encoding Guidelines.
More information about the ffmpeg-devel