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

Michael Niedermayer michaelni
Mon Feb 15 02:32:17 CET 2010


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).
> 
> -- 
> Anssi Hannula

>  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

also we need some way for ffmpeg/ffplay to select the source channel for
converting to mono unles we already support this somehow.

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

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- 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/20100215/9bfc8b04/attachment.pgp>



More information about the ffmpeg-devel mailing list