[FFmpeg-devel] [PATCH] audio dialog level

Michael Niedermayer michaelni
Sun Dec 16 23:27:47 CET 2007


On Sun, Dec 16, 2007 at 03:30:07PM -0500, Justin Ruggles wrote:
> Hello,
> Here is a more generic patch to handle the dialog level.  I've tried to
> make it not AC3-specific.
> I've changed the default value to 1.0.  Positive numbers are not valid
> for actual values because having dialog above the maximum audio level is
> not possible.  Really 0 doesn't make sense in practice, but in theory
> the audio could just be really loud dialog at or near 0 dB.  Picking an
> arbitrary default or using the one from AC3 isn't ideal either.  So I've
> made positive values indicate that the dialog level is not specified.
> If that's ok.  If not, I guess I could use the one from AC3 (-31.0 dB).
> The patch does not do anything with the value from the decoder in
> ffmpeg.c.  The only logical things I can think of that could be done are
> to have the user specify a target dialog level and apply gain
> accordingly, or pass the value along to the encoder.  I think the first
> one is outside the normal scope of ffmpeg...  The 2nd option would be a
> mess to implement cleanly when you take into account having to know
> whether the user specified the dialog level or if it should be copied
> >from the decoder (which could change mid-stream).  Also, if the audio
> volume is changed in ffmpeg.c, the dialog level will no longer be correct.

there is no mess at all, its only a mess if its implemented like you did
1. the dialog level should be exported in the AVFrame (yes this needs an
   API change so that decoders output AVFrames)
2. these AVFrames are just passed to the encoder (again little API change
3. all encoders supporting dialog level have a CODEC_CAP_DIALOG_LEVEL flag
   set in the AVCodec struct
4. if the encoder doesnt have CODEC_CAP_DIALOG_LEVEL set than the audio is
   "scaled" to match the user specified volume at an appropriate place in
   ffmpeg.c (later this could be moved into an audio filter)

ffplay would then always rescale to what the user wants

(and the user should at least be able to specify to honor as well as ignore
 the dialog level and for each of these 2 be able to change the volume)

this can be done in several patches
1. AVFrame used in decoders
2. AVFrame used in encoders
3. export dialog_level from decoders
4. import dialog_level for encoders
5. ffmpeg.c rescaling to user specified level
6. ffplay.c rescaling to user specified leve

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071216/223c7584/attachment.pgp>

More information about the ffmpeg-devel mailing list