[FFmpeg-devel] [PATCH] Add support for muxing timed text in mov/mp4/3gp

David Conrad lessen42
Sun Jan 11 09:37:43 CET 2009


On Jan 11, 2009, at 3:05 AM, Baptiste Coudurier wrote:

> David Conrad wrote:
>> Hi,
>>
>> This adds support for muxing timed text in mov/mp4/3gp. For the iPod
>> mode it works slightly different ("sbtl" rather than "text" for the
>> media type) which is the only way iPods recognize it, also causing
>> QuickTime to treat it very differently than standard timed text  
>> (mainly
>> ignoring most style elements and requiring different dimensions.) I
>> don't think it's worth making a new CODEC_ID for this variant though.
>>
>> Also, 3GPP TS 26.245 says to use a null media handler (nmhd) but that
>> doesn't work for .mov for QuickTime, thus the generic media handler
>> (gmhd) for .mov.
>>
>> [...]
>>
>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
>> index 6ddbed1..e26a130 100644
>> --- a/libavformat/movenc.c
>> +++ b/libavformat/movenc.c
>> [...]
>> @@ -871,9 +917,15 @@ static int mov_write_hdlr_tag(ByteIOContext  
>> *pb, MOVTrack *track)
>>         if (track->enc->codec_type == CODEC_TYPE_VIDEO) {
>>             hdlr_type = "vide";
>>             descr = "VideoHandler";
>> -        } else {
>> +        } else if (track->enc->codec_type == CODEC_TYPE_AUDIO){
>>             hdlr_type = "soun";
>>             descr = "SoundHandler";
>> +        } else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE){
>> +            if (track->mode == MODE_IPOD)
>> +                hdlr_type = "sbtl";
>> +            else
>> +                hdlr_type = "text";
>> +            descr = "SubtitleHandler";
>
> Nitpick:
>
> if (track->mode == MODE_IPOD) hdlr_type = "sbtl";
> else                          hdlr_type = "text";

With closed captioning muxing (CEA-608), hdlr_type has to be clcp, but  
we can worry about that later.

>>         }
>>     }
>>
>> @@ -897,8 +949,12 @@ static int mov_write_minf_tag(ByteIOContext  
>> *pb, MOVTrack *track)
>>     put_tag(pb, "minf");
>>     if(track->enc->codec_type == CODEC_TYPE_VIDEO)
>>         mov_write_vmhd_tag(pb);
>> -    else
>> +    else if (track->enc->codec_type == CODEC_TYPE_AUDIO)
>>         mov_write_smhd_tag(pb);
>> +    else if (track->mode == MODE_MOV)
>> +        mov_write_gmhd_tag(pb);
>> +    else
>> +        mov_write_nmhd_tag(pb);
>
> Missing codec_type == CODEC_TYPE_SUBTITLE

In a sense, gmhd/nmhd aren't really specific to subtitles; gmhd at  
least is used by QuickTime for a lot of different obscure track types.  
Still, fixed since none of them are supported.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ttxt-mux2.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090111/4adb02e6/attachment.txt>
-------------- next part --------------




More information about the ffmpeg-devel mailing list