[FFmpeg-devel] DVB subtitles transcoding

Wim Vander Schelden lists at fixnum.org
Wed Nov 6 17:09:18 CET 2013


Hi all,

I'm trying to solve a bug in DVB subtitle decoding/demuxing, reported here:
http://trac.ffmpeg.org/ticket/2024

In case it matters, I'm testing with the following command line:

ffmpeg -v debug -i Vogelpark.ts -map 0:#0xfc5 -scodec dvbsub test.ts

Where Vogelpark.ts is a MPEG2-TS with one program, containing 1 video
stream, 1 audio stream, 1 DVB Teletext subtitle stream and 2 DVB subtitle
streams (one of which is on PID 0xfc5).

The error message that comes out is:

[mpegts @ 0x2648d20] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 551350 >= 309708
av_interleaved_write_frame(): Invalid argument

I've worked out what the problem is (with the help of nevcariel, ubitux and
others on #ffmpeg-devel):

   1. DVB subtitles are encoded as a series of rectangular bitmaps, and
   they are *individually* "flushed" to be displayed using a display
   segment packet.
   2. The way the DVB subtitles decoder (avcodec/dvbsubdec.c) currently
   works, is that it keeps track of all the other segments (which define
   regions, colour lookup tables, and contain the actual bitmaps) until a
   display segment is encountered, at which point it renders all these things
   to an AVSubtitle.
   3. On the encoding side, DVB subtitles differ from other subtitle codecs
   because it is currently the only codec that needs to have two packets to do
   its work: one to render the subtitle and one to indicate that it can be
   removed from the screen. These have (obviously) different PTS'es.
   4. It's possible that a later AVSubtitle appears before an earlier one
   dissappears from the screen. In fact, it's quite common for live
   subtitling, where each word is pushed & displayed as a separate region
   (have a look at
   http://samples.ffmpeg.org/MPEG-VOB/transport/dvbsub/dvbsubtest.ts for an
   example of this happening).
   5. Because the current subtitle encoding happens to write out the
   display & clear packets for DVB in sequence, a later subtitle can trigger
   the above error in the muxer.

So this is the problem. As for the solution: I don't have a clue on how to
fix this cleanly. There's already quite a bit of DVB subtitles specific
code in ffmpeg.c, and I'd rather remove from it than add to it, fixing the
issue in the decoder.

I'd love to get this fixed, so I'm hoping that someone has an idea how this
could be solved.

Kind regards,

Wim


More information about the ffmpeg-devel mailing list