[FFmpeg-devel] [RFC] TS/DVB subtitle sub_id hack

Baptiste Coudurier baptiste.coudurier
Mon Jul 12 00:33:00 CEST 2010


On 7/11/10 9:17 AM, Michael Niedermayer wrote:
> On Sun, Jul 11, 2010 at 04:22:52PM +0200, Reimar D?ffinger wrote:
>> Hello,
>> currently the DVB subtitle handling is a mess that's basically not going
>> to work for anyone not using ffmpeg or ffplay binaries, and even violates
>> the documentation.
>> First, the documentation of the AVCodecContext:sub_id field that is mostly involved
>> here:
>>       * - decoding: Set by libavcodec. (FIXME: Is this OK?)
>>       */
>>      int sub_id;
>>
>> However in this case it is actually set by libavformat/mpegts.c:
>> st->codec->sub_id = (anc_page<<  16) | comp_page;
>>
>> Worse, unless this is set correctly, the dvbsub decoder will not produce any output
>> at all, even though most TS streams only have one single subid in the whole
>> subtitle stream anyway.
>
> i think what mpegts&  dvbsub do with sub_id is not in line with what
> the field is supposed to be used for.
>
>
>>
>> I have two suggestions for quick fixes:
>> 1) Identify invalid values for sub_id, and use them to make the decoder output everything
>> 2) Have the dvbsub decoder always decode everything and only make it set the sub_id
>>     according to the data it just decoded, thus matching the documentation.
>>     Filtering by sub_id then has to be done elsewhere. For this, it would be good
>>     to know how sub_id is used elsewhere, and also samples of TS streams where this
>>     sub_id value is actually relevant would be useful.
>
> neither alone will work, they also violate the specs. the spec says clearly
> that the id values from the pmt should be used.
>
> maybe something along the lines of:
> put the 2 ids in extradata in mpegts.c (1-2 line change)
> make dvbsub use the 2 ids from extradata (1-2 line change)
> if dvbsub finds no extradata print a big warning that multiple languages
> could be displayed on top of each other and display all.
> if there are multiple pmt entries that refer to the same stream, create
> multiple subtitle streams with differening extradata.
>
> comments and other suggestions welcome but this seems the easiest way to fix
> this. it does have a issue with subtitle stream duplication on stream copy
> if this (rare) feature is used
>

Even easier is to use codec_tag.

I don't think extradata is a good idea. It makes applications do if 
codec_id == CODEC_ID_DVBSUB then set extradata which is more complicated 
than setting sub_id even if it does not conform to the documentation.

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list