[FFmpeg-devel] Handling dual language mono audio encoded as stereo

Michael Niedermayer michaelni
Sat Feb 20 02:00:20 CET 2010


On Tue, Feb 16, 2010 at 12:35:02AM +0200, Anssi Hannula wrote:
> On maanantai 15 helmikuu 2010 03:32:17 Michael Niedermayer wrote:
> > On Sun, Feb 14, 2010 at 07:32:08PM +0200, Anssi Hannula wrote:
> > > Hi all!
> > > 
> > > Some nordic DVB channels encode e.g. four mono tracks with different
> > > languages into two stereo tracks (mpeg layer 2). The ISO639 language
> > > descriptor then has both language codes, separated by a null byte. This
> > > is probably a remnant from pre-DVB era, but we should somehow handle it
> > > nevertheless.
> > > 
> > > How should we handle this, what do you think?
> > 
> > i can think of many ways, i like none though
> > 
> > > Attached is a patch which simply sets language tag to e.g. "nor+fin" for
> > > dual- language stereo tracks. Seems to show up correctly in ffplay
> > > (though of course there doesn't seem to be a way to choose a single
> > > channel from stereo track in ffplay).
> > > 
> > >  mpegts.c |   12 ++++++++++--
> > >  1 file changed, 10 insertions(+), 2 deletions(-)
> > > 
> > > 412b28b45b3015d83d776f95a4c2abdaca9b5c88 
> > > mpegts-dual-language-stereo-tracks.patch Index: libavformat/mpegts.c
> > > ===================================================================
> > > --- libavformat/mpegts.c	(revision 21821)
> > > +++ libavformat/mpegts.c	(working copy)
> > > @@ -848,7 +848,7 @@
> > > 
> > >      int program_info_length, pcr_pid, pid, stream_type;
> > >      int desc_list_len, desc_len, desc_tag;
> > >      int comp_page, anc_page;
> > > 
> > > -    char language[4];
> > > +    char language[8];
> > > 
> > >      uint32_t prog_reg_desc = 0; /* registration descriptor */
> > >  
> > >  #ifdef DEBUG
> > > 
> > > @@ -977,7 +977,15 @@
> > > 
> > >                  language[0] = get8(&p, desc_end);
> > >                  language[1] = get8(&p, desc_end);
> > >                  language[2] = get8(&p, desc_end);
> > > 
> > > -                language[3] = 0;
> > > +                if (desc_len >= 8) {
> > > 
> > > +                    p++;
> > 
> > if this is some kind of code then it should be checked
> 
> It you mean the 'p++', it is the audio type code of the first track, which is 
> always present but is ignored by ffmpeg even without this patch. There's 
> another audio type code for the second channel after the second ISO639 
> language code.
> 
> The possible values are:
> 00 Undefined
> 01 Clean effects
> 02 Hearing impaired
> 03 Visual impaired commentary
> 04-FF Reserved
> 
> I guess we should somehow add this in metadata. Then of course there's also 
> the case where audio type differs between channels :)

this really is a mess :(
why do all these comitees always come up with doing everything in the most
painfull and backwardly hacked in way.
I guess simply setting the AVStream metadata to things like
Channel0/Language="eng"
Channel1/Language="jpn"
Channel0/Disposition="comment"
Channel0/TargetAudience="visually impaired"

is the least annoying way to handle this


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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- 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/20100220/a2214ea5/attachment.pgp>



More information about the ffmpeg-devel mailing list