[FFmpeg-devel] [PATCH] avformat/isom: enable TTML demuxing from MP4-likes

Jan Ekström jeebjp at gmail.com
Sun Sep 26 19:43:40 EEST 2021


As ff_codec_movsubtitle_tags is shared between demuxing and muxing,
the muxing parts have to go in before demuxing in order to not
generate invalid media, as adding an identifier to this list enables
muxing into QTFF/MOV.
---
 libavformat/isom.c               |  2 ++
 tests/ref/fate/mov-mp4-ttml-dfxp | 10 ++++++----
 tests/ref/fate/mov-mp4-ttml-stpp | 10 ++++++----
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/libavformat/isom.c b/libavformat/isom.c
index 4df5440023..852d237481 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -77,6 +77,8 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = {
     { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'e', 'x', 't') },
     { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
     { AV_CODEC_ID_EIA_608,  MKTAG('c', '6', '0', '8') },
+    { AV_CODEC_ID_TTML,     MOV_MP4_TTML_TAG          },
+    { AV_CODEC_ID_TTML,     MOV_ISMV_TTML_TAG         },
     { AV_CODEC_ID_NONE, 0 },
 };
 
diff --git a/tests/ref/fate/mov-mp4-ttml-dfxp b/tests/ref/fate/mov-mp4-ttml-dfxp
index e24b5d618b..531d6856ec 100644
--- a/tests/ref/fate/mov-mp4-ttml-dfxp
+++ b/tests/ref/fate/mov-mp4-ttml-dfxp
@@ -1,13 +1,14 @@
 2e7e01c821c111466e7a2844826b7f6d *tests/data/fate/mov-mp4-ttml-dfxp.mp4
 8519 tests/data/fate/mov-mp4-ttml-dfxp.mp4
+#extradata 0:       20, 0x1dfc0302
 #tb 0: 1/1000
-#media_type 0: data
-#codec_id 0: none
+#media_type 0: subtitle
+#codec_id 0: ttml
 0,          0,          0,    68500,     7866, 0x456c36b7
 {
     "packets": [
         {
-            "codec_type": "data",
+            "codec_type": "subtitle",
             "stream_index": 0,
             "pts": 0,
             "pts_time": "0.000000",
@@ -26,7 +27,8 @@
     "streams": [
         {
             "index": 0,
-            "codec_type": "data",
+            "codec_name": "ttml",
+            "codec_type": "subtitle",
             "codec_tag_string": "dfxp",
             "codec_tag": "0x70786664",
             "time_base": "1/1000",
diff --git a/tests/ref/fate/mov-mp4-ttml-stpp b/tests/ref/fate/mov-mp4-ttml-stpp
index 77bd23b7bf..7c03ef92cc 100644
--- a/tests/ref/fate/mov-mp4-ttml-stpp
+++ b/tests/ref/fate/mov-mp4-ttml-stpp
@@ -1,13 +1,14 @@
 cbd2c7ff864a663b0d893deac5a0caec *tests/data/fate/mov-mp4-ttml-stpp.mp4
 8547 tests/data/fate/mov-mp4-ttml-stpp.mp4
+#extradata 0:       48, 0x62100c0d
 #tb 0: 1/1000
-#media_type 0: data
-#codec_id 0: none
+#media_type 0: subtitle
+#codec_id 0: ttml
 0,          0,          0,    68500,     7866, 0x456c36b7
 {
     "packets": [
         {
-            "codec_type": "data",
+            "codec_type": "subtitle",
             "stream_index": 0,
             "pts": 0,
             "pts_time": "0.000000",
@@ -26,7 +27,8 @@ cbd2c7ff864a663b0d893deac5a0caec *tests/data/fate/mov-mp4-ttml-stpp.mp4
     "streams": [
         {
             "index": 0,
-            "codec_type": "data",
+            "codec_name": "ttml",
+            "codec_type": "subtitle",
             "codec_tag_string": "stpp",
             "codec_tag": "0x70707473",
             "time_base": "1/1000",
-- 
2.31.1



More information about the ffmpeg-devel mailing list