[FFmpeg-devel] [Sponsored work] ASCII Text subtitles in DVB subtitles

Andrey Utkin andrey.krieger.utkin at gmail.com
Sun Jan 12 19:37:28 CET 2014

2014/1/9 Sylvain <sylvain at lahiette.com>:
> Hello all,
> I am currently using DVB subtitles in bitmap, as supported by the
> mpegts enc/dec of FFMPEG.
> But i would like also to transport raw text instead of bitmaps inside
> MPEG2-TS streams.
> The EN 300 743 specification for DVB Subtitles describe the
> descriptors needed to insert raw text, so this is something known but
> rarely implemented.
> Instead of doing it ourself, i would like to sponsor this development
> to someone in the FFMPEG developper community, as it will be probably
> faster and more efficient. So is there someone out there willing to
> implement DVB ASCII text support in the mpegtsenc / dec files ?

If i understand it right,
"DVB Subtitles" (EN 300 743)  is bitmap-based format,
"DVB Teletext" (EN 300 472) is text-based format.

You probably want to use the second one, exactly to be able to mux it
into MPEG TS and demux out of it, and to translate this format to
other text-based or bitmap-based formats, and to translate to this
format from other text-based formats.

Well, the subject seems underdeveloped in ffmpeg. Despite some initial
support is here, it is limited and somewhat broken.

Here is a sample file with DVB teletext subtitles:

Remuxing is supported, but broken:
ffmpeg -i ~/Downloads/teletextsubtitles.ts -an -vn -scodec copy -f
mpegts /tmp/subtitles.ts
ffmpeg -i ~/Downloads/teletextsubtitles.ts  -i /tmp/subtitles.ts -map
0:0 -map 1:0 -vcodec copy -scodec copy /tmp/subtitles2.ts
The resulting file, subtitles2.ts, pretends to contain teletext
stream, but there are no subtitles shown at playback.

Decoding is supported (there is libzvbi_teletext decoder, requiring
libzvbi and configure flag --enable-libzvbi), but transcoding it to
other formats, like dvb_subtitle or ass doesn't work:

ffmpeg -i ~/Downloads/teletextsubtitles.ts -acodec copy -vcodec copy
-scodec dvb_subtitle -y -f mpegts /dev/null
fails with message "Subtitle encoding failed". Problem is caused by
subtitle regions having 41 color in palette, which is too big for
supported modes in dvb_subtitle format.

ffmpeg -i ~/Downloads/teletextsubtitles.ts -vcodec copy -acodec copy
-scodec ass -f mpegts /dev/null -y
Fails with message "Only SUBTITLE_ASS type supported".
Same as above was with "ssa" subtitle encoder.

ffmpeg -i ~/Downloads/teletextsubtitles.ts -vcodec copy -acodec copy
-scodec dvd_subtitle -f vob /dev/null -y
fails with "Application provided invalid, non monotonically increasing
dts to muxer in stream 2" (2 is index of subtitle elementary stream).

Trying "srt" encoder failed with "Error while opening encoder for
output stream #0:2 - maybe incorrect parameters such as bit_rate,
rate, width or height". I didn't find exact reason for that yet. Also
from sources it seems that it also supports only SUBTITLE_ASS type.

Trying "xsub" encoder failed also because of non-monotonic dts
produced by decoder, and there were warnings due to high number of
colors in palette.

Sylvain, please describe precisely what abilities do you need for your work.

Andrey Utkin

More information about the ffmpeg-devel mailing list