[FFmpeg-devel] [PATCH] als in mp4

Jai Menon jmenon86
Sat Mar 21 07:16:49 CET 2009


On Sat, Mar 21, 2009 at 11:24 AM, Baptiste Coudurier
<baptiste.coudurier at gmail.com> wrote:
> Hi Jai,
>
> Jai Menon wrote:
>> Hi,
>>
>> Attached :
>>
>> 1) demux als streams from mp4, als codec id and minor lavc version bump
>> 2) mux als in to mp4, add isomedia type
>>
>>
>> [...]
>>
>> ? ? ?/* subtitle codecs */
>> ? ? ?CODEC_ID_DVD_SUBTITLE= 0x17000,
>> Index: libavformat/mov.c
>> ===================================================================
>> --- libavformat/mov.c (revision 18065)
>> +++ libavformat/mov.c (working copy)
>> @@ -426,6 +426,11 @@
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? st->codec->extradata_size);
>> ? ? ? ? ? ? ? ? ?if (cfg.chan_config > 7)
>> ? ? ? ? ? ? ? ? ? ? ?return -1;
>> + ? ? ? ? ? ? ? ?if(cfg.object_type == 36) {
>> + ? ? ? ? ? ? ? ? ? ?st->codec->codec_id = CODEC_ID_MP4ALS;
>> + ? ? ? ? ? ? ? ? ? ?st->codec->codec_type = CODEC_TYPE_AUDIO;
>> + ? ? ? ? ? ? ? ? ? ?return 0;
>> + ? ? ? ? ? ? ? ?}
>> ? ? ? ? ? ? ? ? ?st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config];
>> ? ? ? ? ? ? ? ? ?if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
>> ? ? ? ? ? ? ? ? ? ? ?st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];
>
> see mp4_audio_types table above.

yeah, that must have been added recently, changed locally.

>> ------------------------------------------------------------------------
>>
>> Index: libavformat/isom.c
>> ===================================================================
>> --- libavformat/isom.c ? ? ? ?(revision 18065)
>> +++ libavformat/isom.c ? ? ? ?(working copy)
>> @@ -32,6 +32,7 @@
>> ? ? ?{ CODEC_ID_MPEG4 ? ? , 0x20 },
>> ? ? ?{ CODEC_ID_H264 ? ? ?, 0x21 },
>> ? ? ?{ CODEC_ID_AAC ? ? ? , 0x40 },
>> + ? ?{ CODEC_ID_MP4ALS ? ?, 0x40 },
>> ? ? ?{ CODEC_ID_MPEG2VIDEO, 0x61 }, /* MPEG2 Main */
>> ? ? ?{ CODEC_ID_MPEG2VIDEO, 0x60 }, /* MPEG2 Simple */
>> ? ? ?{ CODEC_ID_MPEG2VIDEO, 0x62 }, /* MPEG2 SNR */
>> Index: libavformat/movenc.c
>> ===================================================================
>> --- libavformat/movenc.c ? ? ?(revision 18065)
>> +++ libavformat/movenc.c ? ? ?(working copy)
>> @@ -928,7 +928,11 @@
>> ? ? ? ? ? ? ?descr = "VideoHandler";
>> ? ? ? ? ?} else if (track->enc->codec_type == CODEC_TYPE_AUDIO) {
>> ? ? ? ? ? ? ?hdlr_type = "soun";
>> - ? ? ? ? ? ?descr = "SoundHandler";
>> + ? ? ? ? ? ?if(track->enc->codec_id == CODEC_ID_MP4ALS) {
>> + ? ? ? ? ? ? ? ?descr = "";
>> + ? ? ? ? ? ?} else {
>> + ? ? ? ? ? ? ? ?descr = "SoundHandler";
>> +
>
> Hummm, why do you need this ? This should not be needed at all.

yes seems like a hack, the reference codec requires empty handler description.

>> ? ? ? ? ?} else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE) {
>> ? ? ? ? ? ? ?if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl";
>> ? ? ? ? ? ? ?else ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?hdlr_type = "text";
>> @@ -1381,7 +1385,8 @@
>> ? ? ?uint8_t *buf;
>>
>> ? ? ?for (i = 0; i < s->nb_streams; i++)
>> - ? ? ? ?if (mov->tracks[i].enc->flags & CODEC_FLAG_BITEXACT) {
>> + ? ? ? ?if (mov->tracks[i].enc->flags & CODEC_FLAG_BITEXACT ||
>> + ? ? ? ? ? ?mov->tracks[i].enc->codec_id == CODEC_ID_MP4ALS) {
>> ? ? ? ? ? ? ?return 0;
>> ? ? ? ? ?}
>>
>
> ???? Please explain :>

ok :)
the muxer currently writes out a userdata box, with a meta box inside
(mp4 mode).
The meta box has a itunes hdlr tag which again leads to problems. So the patch
skips writing a udta box. maybe instead of this, we could write mov style udta.
what do you suggest?

btw, very sorry most of this looks like a hack, the reference codec
mp4 parser has
limitations.

-- 
Regards,

Jai




More information about the ffmpeg-devel mailing list