[FFmpeg-devel,0/3] Initial implementation of TTML encoding/muxing

Message ID 20201204144643.73279-1-jeebjp@gmail.com
Headers show


Jan Ekström Dec. 4, 2020, 2:46 p.m. UTC
I've intentionally kept this initial version simple (no styling etc) to focus
on the basics. As this goes through review, additional features can be added
(I had initial PoC for styling implemented some time around previous VDD), and
there is another patch set in my queue which would then add support for muxing
TTML into MP4.

The basic issue with this specific patch set is that implementing subtitle
encoding/muxing as it is implemented with all other subtitle formats now
mis-matches the behavior of how the TTML demuxing in various formats currently
works in FFmpeg:

* The demuxers return AVPackets with full documents (as most containers'
  packets just contain a full document).
* Subtitle encoding returns single paragraph's content based on the
  AVSubtitle rectangles fed to it.

Thus codec copy remuxing from, say, MXF would not work as the demuxer pushes
out full documents, and the TTML muxer expects paragraphs' contents.

There are multiple ways of handling this, such as:
* Some sort of check based on ?!?!
** adding flags into extradata
** string comparison of packet's contents  against "<tt"
   (no, I'm not really thinking of this)
** etc
* Separate codec ids for TTML documents and TTML paragraphs

I'd like to hear what other people in this project would prefer for handling
this, before venturing too far ahead.


Jan Ekström (2):
  ffprobe: switch to av_bprint_escape for XML escaping
  TTML encoder and muxer

Stefano Sabatini (1):
  avutil/{avstring,bprint}: add XML escaping from ffprobe to avutil

 Changelog                  |   1 +
 doc/general_contents.texi  |   1 +
 fftools/ffprobe.c          |  29 ++-----
 libavcodec/Makefile        |   1 +
 libavcodec/allcodecs.c     |   1 +
 libavcodec/ttmlenc.c       | 154 +++++++++++++++++++++++++++++++++++++
 libavcodec/version.h       |   2 +-
 libavformat/Makefile       |   1 +
 libavformat/allformats.c   |   1 +
 libavformat/ttmlenc.c      | 123 +++++++++++++++++++++++++++++
 libavformat/version.h      |   2 +-
 libavutil/avstring.h       |   1 +
 libavutil/bprint.c         |  14 ++++
 tests/fate/subtitles.mak   |   3 +
 tests/ref/fate/sub-ttmlenc | 122 +++++++++++++++++++++++++++++
 tools/ffescape.c           |   1 +
 16 files changed, 434 insertions(+), 23 deletions(-)
 create mode 100644 libavcodec/ttmlenc.c
 create mode 100644 libavformat/ttmlenc.c
 create mode 100644 tests/ref/fate/sub-ttmlenc