[FFmpeg-devel] [PATCH] movenc.c Quicktime audio selection and language code
Martin Tessarek
mt
Tue Jan 11 20:36:09 CET 2011
movenc.c sets some values in a way that the audio tracks are not
selectable in Quicktime Player. iPad/iPhone are also affected, but the
patch doesn't fix that. Maybe some more work is needed.
Also Quicktime Player seems to want ISO-639-2T language codes instead of
ISO-639-2B, e.g. "ger" won't work but "deu" does.
Here's my proposed patch:
--- movenc.c 2011-01-07 20:56:31.000000000 +0100
+++ movenc.c 2011-01-08 22:13:14.000000000 +0100
@@ -31,6 +31,7 @@
#include "libavcodec/put_bits.h"
#include "internal.h"
#include "libavutil/avstring.h"
+#include "libavformat/avlanguage.h"
#undef NDEBUG
#include <assert.h>
@@ -1176,7 +1177,11 @@
put_be32(pb, 0); /* reserved */
put_be32(pb, 0); /* reserved */
- put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */
+ /* Put the audio tracks in a group for Quicktime audio selection */
+ if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
+ put_be32(pb, 0x1); /* reserved (Layer & Alternate group) */
+ else
+ put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */
/* Volume, only for audio */
if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
put_be16(pb, 0x0100);
@@ -2074,7 +2079,8 @@
AVMetadataTag *lang = av_metadata_get(st->metadata, "language",
NULL,0);
track->enc = st->codec;
- track->language = ff_mov_iso639_to_lang(lang?lang->value:"und",
mov->mode!=MODE_MOV);
+ /* Quicktime uses ISO-639-2T */
+ track->language = ff_mov_iso639_to_lang(lang?
av_convert_lang_to(lang->value, AV_LANG_ISO639_2_TERM):"und", mov-
>mode!=MODE_MOV);
if (track->language < 0)
track->language = 0;
track->mode = mov->mode;
More information about the ffmpeg-devel
mailing list