Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2] avformat/mov: enable identifying TTML subtitle streams as such
@ 2023-07-12 13:48 Jan Ekström
  2023-07-17 11:35 ` Jan Ekström
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Ekström @ 2023-07-12 13:48 UTC (permalink / raw)
  To: ffmpeg-devel

From: Jan Ekström <jan.ekstrom@24i.com>

The contents are full TTML XML documents. TTML writing tests'
results are updated as the streams are now properly identified
as TTML ones.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
---
 libavformat/mov.c                | 11 +++++++++--
 tests/ref/fate/mov-mp4-ttml-dfxp |  9 +++++----
 tests/ref/fate/mov-mp4-ttml-stpp | 10 ++++++----
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 444aca5235..f05254c9cb 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2263,6 +2263,11 @@ static int mov_codec_id(AVStream *st, uint32_t format)
                     (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE &&
                     st->codecpar->codec_id == AV_CODEC_ID_NONE)) {
             id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
+            if (id <= 0) {
+                id = (format == MOV_MP4_TTML_TAG || format == MOV_ISMV_TTML_TAG) ?
+                     AV_CODEC_ID_TTML : id;
+            }
+
             if (id > 0)
                 st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
             else
@@ -2457,8 +2462,10 @@ static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb,
     // ttxt stsd contains display flags, justification, background
     // color, fonts, and default styles, so fake an atom to read it
     MOVAtom fake_atom = { .size = size };
-    // mp4s contains a regular esds atom
-    if (st->codecpar->codec_tag != AV_RL32("mp4s"))
+    // mp4s contains a regular esds atom, dfxp ISMV TTML has no content
+    // in extradata unlike stpp MP4 TTML.
+    if (st->codecpar->codec_tag != AV_RL32("mp4s") &&
+        st->codecpar->codec_tag != MOV_ISMV_TTML_TAG)
         mov_read_glbl(c, pb, fake_atom);
     st->codecpar->width  = sc->width;
     st->codecpar->height = sc->height;
diff --git a/tests/ref/fate/mov-mp4-ttml-dfxp b/tests/ref/fate/mov-mp4-ttml-dfxp
index 15f4f9b69b..2d60f3d964 100644
--- a/tests/ref/fate/mov-mp4-ttml-dfxp
+++ b/tests/ref/fate/mov-mp4-ttml-dfxp
@@ -1,13 +1,13 @@
 2e7e01c821c111466e7a2844826b7f6d *tests/data/fate/mov-mp4-ttml-dfxp.mp4
 8519 tests/data/fate/mov-mp4-ttml-dfxp.mp4
 #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 +26,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 7726cd332e..0a8e423449 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.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avformat/mov: enable identifying TTML subtitle streams as such
  2023-07-12 13:48 [FFmpeg-devel] [PATCH v2] avformat/mov: enable identifying TTML subtitle streams as such Jan Ekström
@ 2023-07-17 11:35 ` Jan Ekström
  2023-07-21 11:17   ` Jan Ekström
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Ekström @ 2023-07-17 11:35 UTC (permalink / raw)
  To: ffmpeg-devel

On Wed, Jul 12, 2023 at 4:48 PM Jan Ekström <jeebjp@gmail.com> wrote:
>
> From: Jan Ekström <jan.ekstrom@24i.com>
>
> The contents are full TTML XML documents. TTML writing tests'
> results are updated as the streams are now properly identified
> as TTML ones.
>
> Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>

Ping?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avformat/mov: enable identifying TTML subtitle streams as such
  2023-07-17 11:35 ` Jan Ekström
@ 2023-07-21 11:17   ` Jan Ekström
  2023-07-28 13:25     ` Jan Ekström
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Ekström @ 2023-07-21 11:17 UTC (permalink / raw)
  To: ffmpeg-devel

On Mon, Jul 17, 2023 at 2:35 PM Jan Ekström <jeebjp@gmail.com> wrote:
>
> On Wed, Jul 12, 2023 at 4:48 PM Jan Ekström <jeebjp@gmail.com> wrote:
> >
> > From: Jan Ekström <jan.ekstrom@24i.com>
> >
> > The contents are full TTML XML documents. TTML writing tests'
> > results are updated as the streams are now properly identified
> > as TTML ones.
> >
> > Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
>
> Ping?

I have verified that the stpp extradata is indeed the contents of
XMLSubtitleSampleEntry as defined by 14496-12, which seems correct. If
there are no objections, I will apply this on Monday.

Jan
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avformat/mov: enable identifying TTML subtitle streams as such
  2023-07-21 11:17   ` Jan Ekström
@ 2023-07-28 13:25     ` Jan Ekström
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Ekström @ 2023-07-28 13:25 UTC (permalink / raw)
  To: ffmpeg-devel

On Fri, Jul 21, 2023 at 2:17 PM Jan Ekström <jeebjp@gmail.com> wrote:
>
> On Mon, Jul 17, 2023 at 2:35 PM Jan Ekström <jeebjp@gmail.com> wrote:
> >
> > On Wed, Jul 12, 2023 at 4:48 PM Jan Ekström <jeebjp@gmail.com> wrote:
> > >
> > > From: Jan Ekström <jan.ekstrom@24i.com>
> > >
> > > The contents are full TTML XML documents. TTML writing tests'
> > > results are updated as the streams are now properly identified
> > > as TTML ones.
> > >
> > > Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
> >
> > Ping?
>
> I have verified that the stpp extradata is indeed the contents of
> XMLSubtitleSampleEntry as defined by 14496-12, which seems correct. If
> there are no objections, I will apply this on Monday.
>

Applied as b300552dfb525990e28eeef14edb67ef5ceacb65

Jan
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-28 13:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-12 13:48 [FFmpeg-devel] [PATCH v2] avformat/mov: enable identifying TTML subtitle streams as such Jan Ekström
2023-07-17 11:35 ` Jan Ekström
2023-07-21 11:17   ` Jan Ekström
2023-07-28 13:25     ` Jan Ekström

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git