[FFmpeg-trac] #2024(undetermined:new): Reencoding dvbsub fails

FFmpeg trac at avcodec.org
Wed Nov 6 16:45:17 CET 2013

#2024: Reencoding dvbsub fails
             Reporter:  cehoyos      |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  git-master   |  undetermined
             Keywords:  dvbsub       |               Resolution:
  av_interleaved_write_frame         |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |

Comment (by wvdschel):

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

     * DVB subtitles are encoded as a series of rectangular bitmaps, and
 they are individually "flushed" to be displayed using a display segment
     * 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.
     * 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
     * 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).
     * 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.

Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2024#comment:4>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list