[FFmpeg-devel] [PATCH] write AC-3 metadata

Michael Niedermayer michaelni
Fri Dec 31 03:46:53 CET 2010


On Wed, Dec 29, 2010 at 05:20:36PM -0500, Justin Ruggles wrote:
> Hi,
> 
> On 12/25/2010 03:05 PM, Michael Niedermayer wrote:
> 
> > On Wed, Dec 22, 2010 at 01:26:13PM -0500, Justin Ruggles wrote:
> >> +    {"ME", "Music and Effects",        0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "bsmode"},
> >> +    {"VI", "Assoc: Visually Impaired", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "bsmode"},
> >> +    {"HI", "Assoc: Hearing Impaired",  0, FF_OPT_TYPE_CONST, 3, INT_MIN, INT_MAX, AC3ENC_PARAM, "bsmode"},
> >> +    {"D",  "Assoc: Dialogue",          0, FF_OPT_TYPE_CONST, 4, INT_MIN, INT_MAX, AC3ENC_PARAM, "bsmode"},
> >> +    {"C",  "Assoc: Commentary",        0, FF_OPT_TYPE_CONST, 5, INT_MIN, INT_MAX, AC3ENC_PARAM, "bsmode"},
> > 
> > these exist in mp3 too, and ideally converting ac3<->mp3 should preserve them
> 
> I couldn't find this info for mp3. Do you have a reference?

Sorry, its written in H.222 (mpeg2-systems)
 ISO/IEC 13818-1:2007 (E)
2.6.18    ISO 639 language descriptor
The language descriptor is used to specify the language of the associated program element (see Table 2-59).
                                          Table 2-59 ? ISO 639 language descriptor
                                               Syntax                           No. of bits Mnemonic
                   ISO_639_language_descriptor() {
                             descriptor_tag                                          8       uimsbf
                             descriptor_length                                       8       uimsbf
                             for (i = 0; i < N; i++) {
                                         ISO_639_language_code                      24        bslbf
                                         audio_type                                  8        bslbf
                             }
                   }
2.6.19    Semantic definition of fields in ISO 639 language descriptor
ISO_639_language_code ? Identifies the language or languages used by the associated program element. The
ISO_639_language_code contains a 3-character code as specified by ISO 639, Part 2. Each character is coded into 8 bits
according to ISO 8859-1 and inserted in order into this 24-bit field. In the case of multilingual audio streams the
sequence of ISO_639_language_code fields shall reflect the content of the audio stream.
audio_type ? The audio_type is an 8-bit field which specifies the type of stream defined in Table 2-60.
                                                 Table 2-60 ? Audio type values
                            Value                                     Description
                            0x00              Undefined
                            0x01              Clean effects
                            0x02              Hearing impaired
                            0x03              Visual impaired commentary
                         0x04-0x7F            User Private
                         0x80-0xFF            Reserved
clean effects ? This field indicates that the referenced program element has no language.
hearing impaired ? This field indicates that the referenced program element is prepared for the hearing impaired.
visual_impaired_commentary ? This field indicates that the referenced program element is prepared for the visually
impaired viewer.
[...]

> 
> >> +    {"E",  "Assoc: Emergency",         0, FF_OPT_TYPE_CONST, 6, INT_MIN, INT_MAX, AC3ENC_PARAM, "bsmode"},
> >> +    {"VO", "Assoc: Voice Over (1 ch)", 0, FF_OPT_TYPE_CONST, 7, INT_MIN, INT_MAX, AC3ENC_PARAM, "bsmode"},
> >> +    {"K",  "Karaoke (2 ch or more)",   0, FF_OPT_TYPE_CONST, 7, INT_MIN, INT_MAX, AC3ENC_PARAM, "bsmode"},
> >> +{"cmixlev", "Center Mix Level", offsetof(AC3EncodeContext, options.center_mix_level), FF_OPT_TYPE_INT, 1, 0, 2, AC3ENC_PARAM, "cmixlev"},
> >> +    {"0", "-3.0 dB (0.707)",           0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "cmixlev"},
> >> +    {"1", "-4.5 dB (0.595) (default)", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "cmixlev"},
> >> +    {"2", "-6.0 dB (0.500)",           0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "cmixlev"},
> >> +{"surmixlev", "Surround Mix Level", offsetof(AC3EncodeContext, options.surround_mix_level), FF_OPT_TYPE_INT, 1, 0, 2, AC3ENC_PARAM, "surmixlev"},
> >> +    {"0", "-3.0 dB (0.707)",           0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "surmixlev"},
> >> +    {"1", "-6.0 dB (0.500) (default)", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "surmixlev"},
> >> +    {"2", "-inf dB (0.000)",           0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "surmixlev"},
> >> +{"dsurmode", "Dolby Surround Mode", offsetof(AC3EncodeContext, options.dolby_surround_mode), FF_OPT_TYPE_INT, 0, 0, 2, AC3ENC_PARAM, "dsurmode"},
> >> +    {"notindicated", "Not Indicated (default)",    0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurmode"},
> >> +    {"on",           "Dolby Surround Encoded",     0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurmode"},
> >> +    {"off",          "Not Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurmode"},
> >> +{"mixlevel", "Mixing Level", offsetof(AC3EncodeContext, options.mixing_level), FF_OPT_TYPE_INT, -1, -1, 31, AC3ENC_PARAM},
> >> +{"roomtype", "Room Type", offsetof(AC3EncodeContext, options.room_type), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "roomtype"},
> >> +    {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "roomtype"},
> >> +    {"large",        "Large Room",              0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "roomtype"},
> >> +    {"small",        "Small Room",              0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "roomtype"},
> >> +{"copyright", "Copyright Bit", offsetof(AC3EncodeContext, options.copyright), FF_OPT_TYPE_INT, 0, 0, 1, AC3ENC_PARAM},
> >> +{"original", "Original Bit Stream", offsetof(AC3EncodeContext, options.original), FF_OPT_TYPE_INT, 1, 0, 1, AC3ENC_PARAM},
> >> +{"dmixmode", "Preferred Stereo Downmix Mode", offsetof(AC3EncodeContext, options.preferred_stereo_downmix), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "dmixmode"},
> >> +    {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmixmode"},
> >> +    {"ltrt", "Lt/Rt Downmix Preferred",         0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmixmode"},
> >> +    {"loro", "Lo/Ro Downmix Preferred",         0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmixmode"},
> >> +{"ltrtcmixlev", "Lt/Rt Center Mix Level", offsetof(AC3EncodeContext, options.lt_rt_center_mix_level), FF_OPT_TYPE_INT, -1, -1, 7, AC3ENC_PARAM, "ltrtcmixlev"},
> > 
> >> +    {"0", "+3.0 dB (1.414)",           0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtcmixlev"},
> >> +    {"1", "+1.5 dB (1.189)",           0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtcmixlev"},
> >> +    {"2", "+0.0 dB (1.000)",           0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtcmixlev"},
> >> +    {"3", "-1.5 dB (0.841)",           0, FF_OPT_TYPE_CONST, 3, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtcmixlev"},
> >> +    {"4", "-3.0 dB (0.707)",           0, FF_OPT_TYPE_CONST, 4, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtcmixlev"},
> >> +    {"5", "-4.5 dB (0.595) (default)", 0, FF_OPT_TYPE_CONST, 5, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtcmixlev"},
> >> +    {"6", "-6.0 dB (0.500)",           0, FF_OPT_TYPE_CONST, 6, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtcmixlev"},
> >> +    {"7", "-inf dB (0.000)",           0, FF_OPT_TYPE_CONST, 7, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtcmixlev"},
> >> +{"ltrtsurmixlev", "Lt/Rt Surround Mix Level", offsetof(AC3EncodeContext, options.lt_rt_surround_mix_level), FF_OPT_TYPE_INT, -1, -1, 7, AC3ENC_PARAM, "ltrtsurmixlev"},
> >> +    {"3", "-1.5 dB (0.841)",           0, FF_OPT_TYPE_CONST, 3, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtsurmixlev"},
> >> +    {"4", "-3.0 dB (0.707)",           0, FF_OPT_TYPE_CONST, 4, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtsurmixlev"},
> >> +    {"5", "-4.5 dB (0.595)",           0, FF_OPT_TYPE_CONST, 5, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtsurmixlev"},
> >> +    {"6", "-6.0 dB (0.500) (default)", 0, FF_OPT_TYPE_CONST, 6, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtsurmixlev"},
> >> +    {"7", "-inf dB (0.000)",           0, FF_OPT_TYPE_CONST, 7, INT_MIN, INT_MAX, AC3ENC_PARAM, "ltrtsurmixlev"},
> >> +{"lorocmixlev", "Lo/Ro Center Mix Level", offsetof(AC3EncodeContext, options.lo_ro_center_mix_level), FF_OPT_TYPE_INT, -1, -1, 7, AC3ENC_PARAM, "lorocmixlev"},
> >> +    {"0", "+3.0 dB (1.414)",           0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorocmixlev"},
> >> +    {"1", "+1.5 dB (1.189)",           0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorocmixlev"},
> >> +    {"2", "+0.0 dB (1.000)",           0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorocmixlev"},
> >> +    {"3", "-1.5 dB (0.841)",           0, FF_OPT_TYPE_CONST, 3, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorocmixlev"},
> >> +    {"4", "-3.0 dB (0.707)",           0, FF_OPT_TYPE_CONST, 4, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorocmixlev"},
> >> +    {"5", "-4.5 dB (0.595) (default)", 0, FF_OPT_TYPE_CONST, 5, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorocmixlev"},
> >> +    {"6", "-6.0 dB (0.500)",           0, FF_OPT_TYPE_CONST, 6, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorocmixlev"},
> >> +    {"7", "-inf dB (0.000)",           0, FF_OPT_TYPE_CONST, 7, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorocmixlev"},
> >> +{"lorosurmixlev", "Lo/Ro Surround Mix Level", offsetof(AC3EncodeContext, options.lo_ro_surround_mix_level), FF_OPT_TYPE_INT, -1, -1, 7, AC3ENC_PARAM, "lorosurmixlev"},
> >> +    {"3", "-1.5 dB (0.841)",           0, FF_OPT_TYPE_CONST, 3, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorosurmixlev"},
> >> +    {"4", "-3.0 dB (0.707)",           0, FF_OPT_TYPE_CONST, 4, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorosurmixlev"},
> >> +    {"5", "-4.5 dB (0.595)",           0, FF_OPT_TYPE_CONST, 5, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorosurmixlev"},
> >> +    {"6", "-6.0 dB (0.500) (default)", 0, FF_OPT_TYPE_CONST, 6, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorosurmixlev"},
> >> +    {"7", "-inf dB (0.000)",           0, FF_OPT_TYPE_CONST, 7, INT_MIN, INT_MAX, AC3ENC_PARAM, "lorosurmixlev"},
> > 
> > dont float/double make more sense here?
> 
> 
> Well, I thought it would be better this way so that the valid option
> values could be listed to the user and validated by AVOption.  But if
> you prefer floats, I have an alternative implemented that checks the
> value against a list of valid values with a tolerance of +/-0.01.  If
> the value is not in the list, a warning is printed and a default value
> is used instead.  Does that sound like a better option?

with names like lorosurmixlev it doesnt matter ;)
noone will ever use it except you and members of the standard comittee ;)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101231/3e68f3c9/attachment.pgp>



More information about the ffmpeg-devel mailing list