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

Reimar Döffinger Reimar.Doeffinger
Sun Jul 11 16:22:52 CEST 2010

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
     * - 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 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.

More information about the ffmpeg-devel mailing list