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

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Sep 27 04:16:28 EEST 2021


Jan Ekström:
> 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.

Does this mean that MOV_MP4_TTML_TAG is legal for QTFF/MOV, but
MOV_ISMV_TTML_TAG is not? If so, why does the latter have a MOV prefix?
Furthermore, you seem to believe that putting MOV_MP4_TTML_TAG earlier
in the list ensures that it is not set when muxing mov. Yet this only
ensures that it does not get autoselected, but what about the case when
the tag is already set (e.g. when remuxing such an ismv ttml stream from
a format where this is actually legal)?

> ---
>  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",
> 



More information about the ffmpeg-devel mailing list